ZScript: A way to detect if extreme death'd

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

ZScript: A way to detect if extreme death'd

Post 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.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

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

Post 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...
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

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

Post 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.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

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

Post by Matt »

I usually use if(health<-gibhealth)

As for specific types, could WorldThingDamaged + giving a dummy inventory item / spawning a thinker work?
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

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

Post 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.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

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

Post by Marisa the Magician »

Note that gibhealth is int.min unless directly specified in the actor defaults.
Accensus
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

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

Post by Accensus »

Time to post this.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

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

Post by Matt »

......why did I think this was in the scripting help board rather than feature suggestions
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

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

Post 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?
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

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

Post 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.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

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

Post 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.
User avatar
Major Cooke
Posts: 8170
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

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

Post by Major Cooke »

Works too!
Cacodemon345
Posts: 419
Joined: Fri Dec 22, 2017 1:53 am
Graphics Processor: ATI/AMD (Modern GZDoom)
Contact:

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

Post 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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

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

Post 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.
Post Reply

Return to “Feature Suggestions [GZDoom]”