Hello,
it would be usfeful to add a NewDamage property to the event WorldThingDamaged, like WorldLineDamaged and WorldSectorDamaged do, because Damage is a read-only property.
I'm asking this because I'm trying to apply different damages to the player without subclassing the player class, otherwise it works only for the new class and not for every player class avaialable during the game.
WorldThingDamaged(WorldEvent e) : add NewDamage
Moderator: GZDoom Developers
-
- Posts: 137
- Joined: Tue Jan 29, 2008 4:02 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11 Pro
- Graphics Processor: nVidia with Vulkan support
-
- Posts: 8192
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: WorldThingDamaged(WorldEvent e) : add NewDamage
WorldThingDamaged can't be changed like this since it was made strictly for postmortem, but I have an idea.
Perhaps having a WorldThingPreDamage virtual, a new function to perform what is desired in, could suffice. This would be called before DamageMobj so it's not intrusive on the code, and contains an IsFinal boolean to stop further event handlers from running it if needed.
Modders can use this to effectively intercept damage variables before they're actually processed. However it's still subject to DamageMobj itself and any overrides the original player had. I'm also contemplating sending along the original parameters in a struct so anyone overriding DamageMobj can compare, since actors overriding them are meant to have the final say.
I'll be giving this a try since this will be beneficial to a project I'm working on too.
Perhaps having a WorldThingPreDamage virtual, a new function to perform what is desired in, could suffice. This would be called before DamageMobj so it's not intrusive on the code, and contains an IsFinal boolean to stop further event handlers from running it if needed.
Modders can use this to effectively intercept damage variables before they're actually processed. However it's still subject to DamageMobj itself and any overrides the original player had. I'm also contemplating sending along the original parameters in a struct so anyone overriding DamageMobj can compare, since actors overriding them are meant to have the final say.
I'll be giving this a try since this will be beneficial to a project I'm working on too.
-
- Posts: 137
- Joined: Tue Jan 29, 2008 4:02 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11 Pro
- Graphics Processor: nVidia with Vulkan support
Re: WorldThingDamaged(WorldEvent e) : add NewDamage
Would be super nice having this function, it could help doing some mods.
Thanks
Thanks
-
- Posts: 8192
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: WorldThingDamaged(WorldEvent e) : add NewDamage
Yeah. I agree, it would be nifty but this may take some time.
-
- Global Moderator
- Posts: 1093
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
Re: WorldThingDamaged(WorldEvent e) : add NewDamage
I was going to suggest this but then I found this post. Has this gotten any attention? Because it's really inconvenient that the only function to override damage is ModifyDamage on an item.
-
- Posts: 8192
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: WorldThingDamaged(WorldEvent e) : add NewDamage
Can you tell me what you would use this for, Jekyll? Gonna be blunt, after thinking of this some more, it's going to devolve into a game of hijacking and the damage system is already a clusterfuck as is.
-
- Global Moderator
- Posts: 1093
- Joined: Mon Jul 21, 2008 4:08 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia (Modern GZDoom)
Re: WorldThingDamaged(WorldEvent e) : add NewDamage
Plenty of cases where you'd want to modify the receiving of damage globally. One of the simplest examples would be a universal headshot system, where the damage is increased if the puff/projectile hits the top 20% of the monster's height:Major Cooke wrote:Can you tell me what you would use this for, Jekyll? Gonna be blunt, after thinking of this some more, it's going to devolve into a game of hijacking and the damage system is already a clusterfuck as is.
Code: Select all
if (inflictor.pos.z >= height * 0.8)[/b]
-
- Posts: 8192
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: WorldThingDamaged(WorldEvent e) : add NewDamage
Sorry, but thinking more on it, I'm gonna back out of this. I want original damage values passed to my actors so people can't try and hijack things. As a rule of thumb, DamageMobj should be the de facto start and end of it. I absolutely do not want it to be modified outside, because then I don't know if that was the actual true amount of damage originally passed in. This is especially for inter-mod compatibility.
Please use ModifyDamage instead.
Please use ModifyDamage instead.