I'm trying to script a ship ejecting some cargo - I'm using 1.73.4. I've set up an Anaconda as a like_ship entry and have given it a big cargo of computers. When I destroy the ship in-game the cargo is released as expected.
The AI commands dumpCargo and ejectCargo don't seem to work. I tried using the dumpCargo JS function in a ship script but that didn't seem to work either - I assume that this.ship.dumpCargo() is the right syntax?
Incidentally, the override missile in Missiles and Bombs also used the dumpCargo AI function, so that's not working properly either.
Admittedly I could just use spawn but I'd prefer to use the proper mechanism if possible.
Dumping/ejecting cargo
Moderators: winston, another_commander, Getafix
Dumping/ejecting cargo
Download Resistance Commander plus many other exciting OXPs HERE
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Dumping/ejecting cargo
Probably the wiki needs some better explanation on this point. On ships creation there is no cargo created for the ships. (Only the player gets cargo on every launch)Ramirez wrote:The AI commands dumpCargo and ejectCargo don't seem to work. I tried using the dumpCargo JS function in a ship script but that didn't seem to work either - I assume that this.ship.dumpCargo() is the right syntax?.
NPC ships only get cargo on scooping pods.
When NPC ships explode they release the pods they have scooped. Only when the ship has never scooped cargo, the shipdata.plist is consulted to see what cargo it should leave behind.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
OK, thanks for the clarification. If need be I can probably get the ship to scoop some cargo canisters beforehand, out of sight of the player, so as to make them available for dumping later on.
Good to know it was my misunderstanding rather than a bug!
Good to know it was my misunderstanding rather than a bug!
Download Resistance Commander plus many other exciting OXPs HERE
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
In your case, with a special ship, you should probably use in a shipscript: "ejectItem(myRole)" to use specific pods.Ramirez wrote:If need be I can probably get the ship to scoop some cargo canisters beforehand, out of sight of the player, so as to make them available for dumping later on.
First set up a cargo counter to prevent endless dumping and than decrement on every ejectItem(). You can call it from AI by a script message.
UPS-Courier & DeepSpacePirates & others at the box and some older versions