So I have several issues either resolved clunkily or or not at all, but I'll start with this simple one. Got a mission, you're a defending a cruiser, called 'Cyclone', and it has a death scream if you fail. Halfway through the mission a Satis attempts to kamikaze the cruiser and will do half its total health in damage (so it may or may not kill it), if it does kill it, it plays the standard death scream, and if it doesn't it plays the 'ouch!' message instead. Think how, for a moment, you might implement this, and when you're done compare it to my attached solution (which does work as intended). Now while I'm happy it works, it is, needless to say, much more complicated than I originally thought it would be.
This stems from a few issues, like how hard it is to do a death scream that isn't set up as a persona. Obviously, simply going 'is ship dead? If so have ship death scream' doesn't work because dead ships can't send messages. In the end I took a page from volition themselves which have checked when a ship is at very low health, send a message, and then self-destruct the rest of the way on a few ships in a few missions. Another is checking if a ship did a successful kamikaze or not. Kamikaze damage doesn't count as damage from the kamikaze-er so get-damage-caused doesn't work, and I was hoping that successful kamikaze ships would be flagged as having killed themselves, but no, credit just goes to whichever enemy damaged them the most, or no one if they weren't attacked. Since the kamikaze self-destruct bypasses every % between its current health and 0% I used that to determine if it kamikazed or not.
So, I don't know if what I did is normal for this situation, or I missed a sexp that would've made this much simpler, but please let me know.
A related issue I still have yet to solve is making ships killed by the player death scream. Again, once I'm sure that the ship has been destroyed by the player it's too late to send any messages. I can do the guardian at 1% thing, but then I have to determine if it was the player that brought it to 1%.
I don't know how in demand this is, or how difficult it would be to implement, but simply having a field in the ship editor which allows to pick a message to be used as a custom death scream would be very useful in avoiding this sort of thing.
[attachment stolen by Russian hackers]