Dumping/ejecting cargo

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Dumping/ejecting cargo

Post by Ramirez »

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.
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Dumping/ejecting cargo

Post by Eric Walch »

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?.
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)

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.
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

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!
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

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.
In your case, with a special ship, you should probably use in a shipscript: "ejectItem(myRole)" to use specific pods.

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.
Post Reply