Instead of injecting, co-operation is also possible
. If it's just Spicy Hermits, then I'm 100% absolutely, positively sure we can find a way to get the OXPs work together.
I know! But in theory, somebody else could have introduced a ship script too. For Spicy Hermits I could easily find a solution even without your cooperation, because I know your OXP, but there are hundreds of OXPs around, and some of their creators aren't even available anymore. So I would like to find solutions that should, at least in theory, work with OXPs unknown to me. A world script "shipDied" event would have been the easiest way as is the "shipSpawned" event for situations where you don't want to add a ship script.
Often there might also be some other ways to achieve what one desires. What are you trying to achieve?
I simply want to record the death event of a rock hermit, because I have to mark the destroyed hermit in the memory database. You use a ship script, but you need it anyhow.
I had the idea to add the beacon to a "visual effect" at the same position as the hermit, as this would (hopefully!) survive the destruction. Then, on saving or leaving the system, I could check all beacons if the associated hermit is still there. So there are definitely other methods, but I didn't want to do something unnecessarily complicated only because I didn't find a suitable event handler! That's why I asked.
If Norby's suggestion works (I'll probably know this evening), that's exactly what I need. But I'll try the "visual effect" method too, because it has another advantage: The ASC wouldn't lose it's target when the hermit is destroyed while it is set in the compass, and that's the intended behaviour.
For both methods, I wouldn't need to override shipdata.plist and introduce my own ship script. It would even work with OXP rock hermits with different data_keys and models, as long as they stick to the usual roles. And it would work with or without Spicy Hermits, and without you having to change anything!