Page 1 of 1

assigning cargo to script-added ships

Posted: Wed Sep 30, 2009 11:57 am
by Commander McLane
Quick question: What is the recommended way to give cargo to ships generated by a script through a custom role?

The wiki seems to suggest that max_cargo and likely_cargo only work for ships spawned by the system populator. So what do I do for ships added by script? Do I have to spawn: cargopods in their death_actions, or is there another way?

And on a related note: How does cargo_carried work, anyway? Is it used in the shipdata-entry of a ship, or in the entry of a cargopod only?

Posted: Wed Sep 30, 2009 12:12 pm
by Thargoid
Personally I would set the cargo to zero in the shipdata.plist, and then spawn in the script using this.shipDied event. Look at the pods from the Conger or the Hammerhead's sleds in Aquatics for examples.

Or if you want a single item of specific cargo, look in the set-up for the cloaking device mission (script and shipdata.plist entries).

And if I remember correctly cargo_carried goes in the ship's list entry, and defines what's in the cargopod(s) (or metal fragment(s) etc) that gets spawned when the ship dies.

Posted: Wed Sep 30, 2009 12:38 pm
by Kaks
Sometimes NPCs also drop cargo pods when attacked. I'll need to look it up properly, but I think that cargo_carried is used for those too...