assigning cargo to script-added ships

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

assigning cargo to script-added ships

Post 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?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post 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.
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post 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...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Post Reply