[Script] Scrap Ship at HQ v2.02 ** NON-BP version **

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

eladan
Posts: 5336
Joined: Sat, 7. Jan 06, 17:01
x4

[Script] Scrap Ship at HQ v2.02 ** NON-BP version **

Post by eladan » Wed, 22. Nov 06, 16:46

Scrap Ship at HQ
--------------------

NOTE: This script is part of bonus pack 3.1.06. If you have installed the version in the bonus pack, you should uninstall this version, and vice versa.

Allows the player to dismantle a ship into its component pieces - roughly the same amounts of each that would be required to build a ship of the same type (less a proportional amount due to hull damage, if any, and a small reduction for wear and tear.) Credit costs will not be retrieved - consider it depreciation! :wink:

A new command in the additional ship commands menu will generate a report to the message log detailing approx. costs for building/RE'ing a ship of that type at the HQ.

Updated 10-12-06 - minor bugfix

Version 2.02 - Download here (Hosted by Xai Corp - thanks moggy!)

Changelog:
v2.02
- Fix for command being interrupted forcing command to be rerun twice to scrap ship again
- Corrected time factor for scrapping and reporting build/RE time for Goner ships

v2.01
- Added German translation by finnTO (Thanks finnTO!)

v2.00
- Script restructure
- Ships will now take around 10% of the time to be recycled that it would take to build the ship at the HQ
- Ship name will change to reflect the progress of recycling (percentage and time left)
- Running the command a second time or issuing any command to the ship before recycling is finished will abort the process, losing any progress made.
- Fixed the wear and tear cost at 5%. There will still also be random reductions of certain resource amounts on top of that.
- Added new command in the additional ship commands which will generate a report on approximate build/RE costs at the HQ for a ship of that type. This command can be run on any ship, and does nothing but generate the report.

v1.20
- Changed code for calculating ship value for recycling (code by Jakesnake5 - thanks Jake!)
- Removed command from playership menu
- Slightly reduces amounts recycled (randomised) - some wares will lose more than others (ore/silicon)
- Added check for more khaak ships, just in case anyone gets one somehow :roll:
- Not in the readme - You will always get at least 1 unit for the primary resources - Energy Cells, Ore, Silicon, Nividium (if khaak,) Teladianium and Crystals.

v1.10
- Fixed bug for script not checking if enough storage existed before recycling
- Fixed bug for khaak ships not providing nividium from recycling
- Fixed low relval ships not supplying resources
- Added script setup check for HQ to disable command if HQ not yet built
- Added log entry giving resource amounts recovered when recycling
- General script cleanup and improvement

v1.00
- Initial release

Kudos to Dave Toome for his work on the HQ production cost calculator - I have based the formulae I am using in this script on his work. The calculator is available for download from this thread

The script uses COMMAND_TYPE_SPECIAL_56, COMMAND_TYPE_SHIP_38 and page id 8235
Last edited by eladan on Tue, 19. Jun 07, 08:29, edited 7 times in total.

Colonelnj10
Posts: 433
Joined: Mon, 6. Feb 06, 04:56
x3

Post by Colonelnj10 » Wed, 22. Nov 06, 22:55

FINALLY!

something that I can do to my capped ships collection!

User avatar
arcana75
Posts: 2158
Joined: Tue, 2. Dec 03, 10:28
x3tc

Post by arcana75 » Thu, 23. Nov 06, 04:34

Does this mean you can use capped ships to directly fuel your RE ships?

:o

eladan
Posts: 5336
Joined: Sat, 7. Jan 06, 17:01
x4

Post by eladan » Thu, 23. Nov 06, 04:48

That's what it means. You could supply the HQ with a steady stream of capped ships, and all you'd need to give the HQ is the credits it needs.

I wrote this with a thought for those people who aren't traders by nature...

[CMA]Radon
Posts: 63
Joined: Wed, 15. Mar 06, 23:07
x3

Post by [CMA]Radon » Thu, 23. Nov 06, 10:10

What's a trader???? :P

This is great. As per above, I have a good use for all those capped ships!!

Heh heh. I can use the resources for other factories too!!! I will await with anticipation to use it and see what sort of resource boost it will give. :twisted:

User avatar
arcana75
Posts: 2158
Joined: Tue, 2. Dec 03, 10:28
x3tc

Post by arcana75 » Thu, 23. Nov 06, 13:32

eladan, can I install this script without actually owning the PHQ? I don't have the PHQ yet.

eladan
Posts: 5336
Joined: Sat, 7. Jan 06, 17:01
x4

Post by eladan » Thu, 23. Nov 06, 14:07

You can install it, yes, but obviously you won't be able to use it until you have the player HQ! :D

If you try to run the command without the HQ it will simply write a message to the effect of "you don't have a HQ" to your log and do nothing.

User avatar
al_main
Posts: 1379
Joined: Wed, 6. Oct 04, 10:26
x3

Post by al_main » Thu, 23. Nov 06, 14:16

Useful little script!

If you wanted to improve on that you could always use:

Code: Select all

002   set script command upgrade: command=COMMAND_SCRAP_SHIP  upgrade=[TRUE] script='(Your check script)'
to register the script and then in the check script return:
[CmdConCheck.Available] if the ship can be scrapped
or return either [CmdConCheck.Disabled] or 0 if the player does not have an HQ or if the ship is the playership.

([CmdConCheck.Disabled] greys out the command, 0 makes it completely unavailable) - perhaps not show the command at all if the player has no HQ and grey it out to make it unselectable on the playership?

That way you avoid some of the log messages sent to the player.

Amyway, just my two cents!

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20601
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Thu, 23. Nov 06, 14:43

[CmdConCheck.Infinte] will make it not show at all ;)

User avatar
al_main
Posts: 1379
Joined: Wed, 6. Oct 04, 10:26
x3

Post by al_main » Thu, 23. Nov 06, 14:53

The same as returning 0 you mean?

Any actual advantage to using that rather than 0 out of interest?

eladan
Posts: 5336
Joined: Sat, 7. Jan 06, 17:01
x4

Post by eladan » Thu, 23. Nov 06, 15:08

Yep, I had planned on writing a check script, but I was too tired last night when I had finished the bulk of the script to be bothered with it then... :roll:

Didn't know about the [CmdConCheck.Disabled] or [CmdConCheck.Available] conditions though! (Was just going to have the command mapping strictly dependent on whether the HQ existed or not...

Still have to look up how to do it... thanks for the suggestion.

jlehtone
Posts: 17268
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Thu, 23. Nov 06, 15:15

al_main wrote:Any actual advantage to using that rather than 0 out of interest?
Better self-documenting?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20601
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Thu, 23. Nov 06, 16:01

al_main wrote:The same as returning 0 you mean?

Any actual advantage to using that rather than 0 out of interest?
well basically, all those constant are are defines to numbers. so putting in [CmdConCheck.Disabled] will simply be using a number, so using a number is the same.

its just clearer when using the constants, as thats what they are designed for

eladan
Posts: 5336
Joined: Sat, 7. Jan 06, 17:01
x4

Post by eladan » Thu, 23. Nov 06, 16:51

New version 1.10 - see first post.

Jakesnake5
Posts: 2874
Joined: Fri, 17. Feb 06, 05:55
x4

Post by Jakesnake5 » Fri, 24. Nov 06, 06:00

Excellent. I was going to write one for a mod I'm helping with, but this will do (modified slightly of course :D)
Perfection is in the hands of God, we bags of dirt can only do the best we can©
Image
Modders are a source of ideas to help the Game Makers improve what they have made. Cherrish them, for they are the fruit of thy labors.©

Post Reply

Return to “X³: Reunion - Scripts and Modding”