[ZScript]Virtual functions for customizing resurrection

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

Moderator: GZDoom Developers

User avatar
Ghastly
... in rememberance ...
Posts: 6109
Joined: Fri Jul 06, 2007 2:34 pm

[ZScript]Virtual functions for customizing resurrection

Post by Ghastly »

At the moment, monster resurrection (Archvile reviving an Imp, for example) is very hard-coded and there's very little customization it allows. All we can do is put action functions in the very specific states, with no references to actor that was resurrected, or what actor did the resurrecting. In addition, all monsters that can resurrect can revive all monsters that can be resurrected, with no room for customization there. This only allows the "this monster is resurrecting another monster" behavior, and doesn't allow for any other way for a monster to use dead monsters; for example, the Gremlin in Quake: Scourge of Armagon, which consumes corpses to create more Gremlins. So I propose a set of virtual functions to allow room for customization:

(Disclaimer: My names are terrible, I'm just using these for example.)

IsHealing: Called on the resurrecting monster, gets passed a pointer to the monster being resurrected, and sets the state jump for the calling actor. On the current Archvile, this would just jump to the Heal state and play the sound. The main reason this is different from just jumping to the Heal state is the pointer to the resurrected monster, so we could jump to a different state for different revived monsters, or do something to the revived monster.

BeingHealed: Called on the resurrected monster, gets passed a pointer to the monster that is resurrecting it, and sets the state jump for the calling actor. On current monsters, this would make it alive again and jump to the Raise state. The main reason this is different from current behavior is the pointer to the resurrecting monster, so we could jump to a different state for a different monster reviving it, or do something to the monster reviving us.

CanHeal: Called to see if the calling actor can resurrect the other, passed a pointer to the actor that it's attempting to revive. If it returns true, then the calling actor can resurrect it. We could use this to, for example, make a resurrector that can only resurrect if certain other conditions are met.

With these, we could make a monster that gives some buff the monster they're reviving, make healer-specific raise states, make actors that can use dead monsters for other things instead of reviving them, make monsters that can only revive a subset of other monsters (a weaker archvile that can only revive zombies, for example), or make a weapon that turns monster corpses into bombs that do something to the resurrector when they try to revive it. At the moment, any such behavior we want to do like this would affect all monsters that can resurrect, and all monsters that could be resurrected.

The thing I'm iffy on is state jumps in virtual functions. I don't know if we can do that. It's not a huge deal if we can't, since we can still accomplish that as long as we have pointers to the other actors.
User avatar
nazakomu
Posts: 131
Joined: Wed Nov 30, 2016 12:51 am
Graphics Processor: nVidia with Vulkan support

Re: [ZScript]Virtual functions for customizing resurrection

Post by nazakomu »

This actually sounds like a fantastic idea! I really like the intricate and in-depth explanations given here, which makes it feel more like these should be implemented as virtual functions.

I actually realized that resurrection stuff was not very flexible quite a while ago and presumed somebody would eventually make a feature suggestion. But I did not anticipate that it would be this elaborate.
Post Reply

Return to “Feature Suggestions [GZDoom]”