Page 1 of 1

ZScript: A way to detect if extreme death'd

Posted: Thu Jun 28, 2018 11:39 pm
by Major Cooke
I'm having trouble finding a way to make monsters detect and drop items based on if they died extremely or not, but the thing is, I'm trying to avoid using xdeath states because not every monster has them. In order to maintain compatibility and affect all monsters from my mod and NOT from my mod alike, there seems to be no apparent way to do this and even checking for the damagetype is potentially folly.

I wonder, could "DamageTypeReceived" be appended with a ".Extreme" after it?

So if a rocket has a damagetype "Nunchuck" and it has the +EXTREMEDEATH flag, the DamageTypeReceived for the victim becomes "Nunchuck.Extreme" or something along those lines. That way people can tell if a monster died to extreme damage irregardless of having an xdeath state or not.

Re: ZScript: A way to detect if extreme death'd

Posted: Fri Jun 29, 2018 2:24 am
by Apeirogon
Checks, if projectile have "in gibs" flag, and if its true, check have monster more hp than attack, and if no return "send to home in a closed coffin", dont work?
That was a question...

Re: ZScript: A way to detect if extreme death'd

Posted: Fri Jun 29, 2018 9:06 am
by Major Cooke
Using WorldThingDied does work, but some exceptions do occur such as if the inflictor is null. Missiles disappearing before the event can be called are a problem, especially in mods that have nothing to do with my own which can jack up the system.

Re: ZScript: A way to detect if extreme death'd

Posted: Fri Jun 29, 2018 10:28 am
by Matt
I usually use if(health<-gibhealth)

As for specific types, could WorldThingDamaged + giving a dummy inventory item / spawning a thinker work?

Re: ZScript: A way to detect if extreme death'd

Posted: Fri Jun 29, 2018 10:54 am
by Apeirogon
You can forcibly extend life of projectile actor, by adding fev ticks to it (x)death state, to be sure that event can read informations from it, giving to projectile some inventory item.

Re: ZScript: A way to detect if extreme death'd

Posted: Sat Jun 30, 2018 5:30 am
by Marisa the Magician
Note that gibhealth is int.min unless directly specified in the actor defaults.

Re: ZScript: A way to detect if extreme death'd

Posted: Sat Jun 30, 2018 7:07 am
by Accensus
Time to post this.

Re: ZScript: A way to detect if extreme death'd

Posted: Sat Jun 30, 2018 3:09 pm
by Matt
......why did I think this was in the scripting help board rather than feature suggestions

Re: ZScript: A way to detect if extreme death'd

Posted: Sat Jun 30, 2018 4:07 pm
by Marisa the Magician
Anyway, the idea of appending .Extreme to the damage might not be very good since it'd potentially break existing mods. You know, since we have a KILLED actor flag already, why not have a GIBBED one too?

Re: ZScript: A way to detect if extreme death'd

Posted: Sat Jun 30, 2018 4:59 pm
by Xaser
Marisa Kirisame wrote:Anyway, the idea of appending .Extreme to the damage might not be very good since it'd potentially break existing mods.
This would definitely break multiple things of mine.

Re: ZScript: A way to detect if extreme death'd

Posted: Sat Jun 30, 2018 5:14 pm
by Matt
I think a gibbed flag would be the cleanest, most easy to use and access solution.

Mucking around with more damage types and whatnot would probably break some things for me in the future even if they didn't now.

Re: ZScript: A way to detect if extreme death'd

Posted: Sun Jul 01, 2018 6:50 am
by Major Cooke
Works too!

Re: ZScript: A way to detect if extreme death'd

Posted: Thu Jul 12, 2018 3:35 am
by Cacodemon345
If the GIBBED flag's going to be implemented, make it so that it gets set before WorldThingDamaged is called, so that it works better. Otherwise, it is going to be less useful should the flag be set after WorldThingDied is called.

Re: ZScript: A way to detect if extreme death'd

Posted: Thu Jul 12, 2018 9:50 am
by Graf Zahl
It could only be set right before calling WorldThingDied. The act of damaging does not know anything about how the actor will die, only the act of dying itself can know.