Virtualize reaction to pain

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

Moderator: GZDoom Developers

User avatar
phantombeta
Posts: 2104
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Virtualize reaction to pain

Post by phantombeta »

As is, there's no way to change what happens when a monster gets pained- it's hardcoded to set the state to the Pain state, set the actor's target pointer, "wake up" the actor, and perform hardcoded behaviours related to "Electric" and "PoisonCloud" damage types.
There's no way to change or disable the latter two hardcoded damage type behaviours; not as much of a problem with the latter, but the former messes with things by randomly making the actor full-bright and calling Actor::Howl instead of changing the state, and there's no way to change pain to do something other than setting the state and the target pointer.
This would be primarily useful for custom monster AI. The state setting is a bit annoying to deal with, but the target setting is very problematic for any AI with more advanced targetting behaviour. "Waking up" the actor is also a problem, it's technically possible to override some of that behaviour by overriding Actor::OkayToSwitchTarget to do your custom behaviour and always return false, but this only works if the monster has no target or the target isn't the actor causing pain.

To be clear, I'm not asking for any of the code for deciding if pain should be triggered to be virtualized- only the parts that actually make changes to the actor, because those are the ones that can be problematic for custom AI.
ZzZombo
Posts: 315
Joined: Mon Jul 16, 2012 2:02 am

Re: Virtualize reaction to pain

Post by ZzZombo »

I think it's also warranted to allow to customize all other forced state changes like `+SKULLFLY`'d actor slamming into a solid, or even `A_Look()` calls setting the state to the `See` state label. And before you comment "use the `state` param", etc, let me remind while it's wholly appropriate when making your own actors, it's a huge pain in the ass when you make a mod on top of an existing. And making hundreds of extra replacing actors does take tons of effort as well. However, this comment is meant only to address the part of the original post regarding the state changes.

Return to “Feature Suggestions [GZDoom]”