In the meantime I had a D'oh! moment. No escape pod was created, because has_escape_pod was NO in shipdata.
Now that is rectified, and I get the defined pod for that ship. However, it is as you say: if I give it CARGO_SCRIPTED_ITEM, the pod's script is triggered, but nobody gets added to slaves, and there is no report screen on docking. It is as if nobody was in the pod, the character gets skipped. If, on the other hand, I give it CARGO_CHARACTER, its ship script isn't executed, although the target inspector shows that the pod has the ship script attached to it,
and there is nobody in my manifest. On top of all that I still get offender cargopods around it.
So, definitely this is not viable.
Which means I am left with attaching the ship script to a standard pod
after it is spawned.
Oh, and thanks, I also figured out that the pod can most easily be identified through its owner property. Code as follows:
Code: Select all
function isMyEscapePod(entity)
{
return entity.name == "Escape capsule" && entity.owner == this.ship
}
this.escapePod = system.filteredEntities(this, isMyEscapePod, this.ship, 5000)
To add a piece of code that gives a
shipWasScooped event to the pod is relatively easy. I know how to do that (thanks to Eric).
But the question remains: Where shall I do it?!? My first idea was in the
shipDied event of the owner (you note that the snippet is from the owner's ship script). But there is a problem with that: What if the player leaves the wreck alone, or decides to deal with it later, and goes for the escape pod first? Or scoops it "accidentally" while pursuing the derelict? In this case the pod's ship script never gets activated.
Any ideas for other events I could put my routine into? There doesn't happen to be a
shipReleasedEscapePod event for ship scripts, by any chance? The existing
shipLaunchedEscapePod seems to work for the player only, according to the Wiki. But of course I can give it a try...
Anyway, additional ideas appreciated.
Or do I have to ask for an amendment to
shipLaunchedEscapePod for NPCs, preferably with a parameter that contains the pod already (and would make my life really easy)?