[SOLVED] Creating a monster that resurrects other monsters?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Ariasio
Posts: 40
Joined: Sat Apr 27, 2019 7:47 pm

[SOLVED] Creating a monster that resurrects other monsters?

Post by Ariasio »

I need an explanation on how to create Archvile-style monsters with an ability to resurrect other monsters. From what I've read on the wiki, it has something to do with the A_RaiseChildren function, but I couldn't understand where to apply it and how to tag monsters that are supposed to be risen from the dead as "children" of the main monster. Would anyone be so kind as to guide me through this? Thanks in advance.
Last edited by Ariasio on Fri May 24, 2019 9:41 am, edited 1 time in total.
User avatar
Dan_The_Noob
Posts: 880
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Creating a monster that resurrects other monsters?

Post by Dan_The_Noob »

the wiki entry gives a pretty decent example
https://zdoom.org/wiki/A_RaiseChildren

Parents need to be defined through the creature spawning them, pretty sure?
User avatar
Ariasio
Posts: 40
Joined: Sat Apr 27, 2019 7:47 pm

Re: Creating a monster that resurrects other monsters?

Post by Ariasio »

Dan_The_Noob wrote:the wiki entry gives a pretty decent example
https://zdoom.org/wiki/A_RaiseChildren

Parents need to be defined through the creature spawning them, pretty sure?
But I don't want a creature that spawns enemies of its own and then has the ability to resurrect them. I want to create a necromancer type enemy that raises certain regular enemies from the dead over and over until it's killed, just like the Archvile.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Creating a monster that resurrects other monsters?

Post by Void Weaver »

Resurrection\reviving have a veeeery wide set of realization ways and conditions. So the main question: what exactly are you want to achieve\replicate?

In general there are few quite famous options for reviving:

1. The Arch-vile's native A_VileChase f-tion. As soon it have found a acceptable CORPSE-target it activate hardcoded Heal: state, which immediately raises target.
2. The same thing as above can be used in common A_Chase via its CHF_RESURRECT flag.
The main lack of both options is their hardcoded low corpse-seeking radius. :\ Keep moving...
3. A_CheckForResurrection - a strange corpse-seeking f-tion, looks as the similar version of previous two in therms of corpse-seeking.

4. Set of f-tions A_Raise(Children\Master\Siblings) are quite simple and not bad option, BUT ONLY for those actors whose linked by corresponding pointers by A_SpawnItemEx f-tion SXF_(SET\IS)MASTER flags. :\ Still have limited usage mechanics...

5. A new A_RaiseSelf f-tion. It's a very good f-tion, which revive its caller. Since we know about CustomInventory items then... ;)
6. Thing_Raise. "Old good classic", generalized version of A_RaiseSelf. It's the special action which is "absolutely" universal, acceptable in any form of scripting (DECOR\ACS\ZScript) and performs reviving (almost) directly. Imho it is the BEST solution for True Necromancers! Image And ofc, CustomInventory is a good companion for this tool.
Spoiler: Example of using Thing_Raise at distance in radius and only for "Undead" species (from 2.47)
7. A new Revive. IIUC, it's a more universal but more "brutal" (because completely resets caller properties) version of A_RaiseSelf. I guess its reseting feature irreplaceable in a some specific cases.
------
ZScript have addition "necro" f-tions:
a) CanResurrect - a good flexible reviving "multitool".
b) RaiseActor - good reviver which allow to raise actor via pointer.
------
And now a few obligatory CONDITIONS for successful reviving:
0. An dead one ISN'T Player.
1. An dead one must have "Raise:" state!
2. An dead one must have +CORPSE flag!
3. Resurrection of dead one can begins ONLY FROM frame with -1 duration OR frame with CanRaise keyword (don't confuse with same named f-tion!)!
Last edited by Void Weaver on Fri May 24, 2019 8:04 am, edited 3 times in total.
User avatar
Ariasio
Posts: 40
Joined: Sat Apr 27, 2019 7:47 pm

Re: Creating a monster that resurrects other monsters?

Post by Ariasio »

Void Weaver wrote:Resurrection\reviving have a veeeery wide set of realization ways and conditions. So the main question: what exactly are you want to achieve\replicate?
I want to create a necromancer monster in Decorate. Its main function would be to pretty much just exist and raise only certain actors from the dead with a spell every time they're killed, until the necromancer himself is killed. Also, I'd like it to kill any actors he's revived that are still alive during his death, to achieve the "master is dead and so are his puppets" kind of effect. How would I go about achieving something like that?
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Creating a monster that resurrects other monsters?

Post by Void Weaver »

Well, IF it supposed to be used only in specific mod, then there is simpliest way to write A_SpawnItemEx("minion_actor",0,0,0,0,0,0,0,SXF_SETMASTER) + A_RaiseChildren. Dan_The_Noob absolutely right - there is a good and simple example on the wiki.

Other methods see above.
User avatar
Ariasio
Posts: 40
Joined: Sat Apr 27, 2019 7:47 pm

Re: Creating a monster that resurrects other monsters?

Post by Ariasio »

Void Weaver wrote:Well, IF it supposed to be used only in specific mod, then there is simpliest way to write A_SpawnItemEx("minion_actor",0,0,0,0,0,0,0,SXF_SETMASTER) + A_RaiseChildren. Dan_The_Noob absolutely right - there is a good and simple example on the wiki.

Other methods see above.
Except that really isn't going to give me what I want. I don't know if you've played the first Dark Souls, but there exists a similar trick to what I want. You see, in the catacombs, there are skeletons who keep getting resurrected by a necromancer hidden further down the level. Only when you kill him, the skeletons stop resurrecting. I want to achieve something like that, except on a smaller scale. Basically, I want to place the enemies like I would normally, put the necromancer somewhere nearby, close enough for its resurrect attack to reach the enemies it's supposed to resurrect, and have the player fight "immortal", perpetually resurrecting zombies until he finds the necromancer and kills him, which will result in the raised zombies not only ceasing to raise from the dead again, but also dying on the spot. Is something like that even possible in Decorate?
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Creating a monster that resurrects other monsters?

Post by Void Weaver »

Gosh! IT IS POSSIBLE with A_SpawnItemEx+A_RaiseChildren, and for "Necro's Game Over" you also call A_KillChildren.

You can just predefine a pack of Necro's minions and then periodically raise them:

Code: Select all

Spawn:
    ABCD A 1 NoDelay A_SpawnItemEx("fallen",60,60,0,0,0,0,0,SXF_SETMASTER)
    ABCD A 1 A_SpawnItemEx("fallen",-60,-60,0,0,0,0,0,SXF_SETMASTER)
    ABCD A 1 A_SpawnItemEx("fallen",60,0,0,0,0,0,0,SXF_SETMASTER)
    ABCD A 1 A_SpawnItemEx("fallen",0,60,0,0,0,0,0,SXF_SETMASTER)
    ABCD A 10 A_Look
    Goto Spawn+4
See:
    ABCD ABCDEFGHIJKLMN 2 A_Chase
    Loop
Missile:
    ABCD A 0 A_Jump(256,"Missile1","MinionRaise")
 Missile1:
    ABCD ABCDEFGHIJKL 2 A_FaceTarget
    ABCD N 2 A_CustomMissile
    ABCD OPQ 2
    Goto See
 MinionRaise:
    ABCD ABCDEFGHIJKLM 2
    ABCD N 2 A_RaiseChildren
    ABCD OPQ 2
    Goto See
EDIT:
As variant, if you want to raise only specific species of different monster actors you can check\take code of Mummy from video above.
Last edited by Void Weaver on Fri May 24, 2019 8:31 am, edited 2 times in total.
User avatar
Ariasio
Posts: 40
Joined: Sat Apr 27, 2019 7:47 pm

Re: Creating a monster that resurrects other monsters?

Post by Ariasio »

Void Weaver wrote:Gosh! IT IS POSSIBLE with A_SpawnItemEx+A_RaiseChildren, and for "Necro's Game Over" you also call A_KillChildren.

You can just predefine a pack of Necro's minions and then periodically raise them:

Code: Select all

Spawn:
    ABCD A 1 NoDelay A_SpawnItemEx("fallen",60,60,0,0,0,0,0,SXF_SETMASTER)
    ABCD A 1 A_SpawnItemEx("fallen",-60,-60,0,0,0,0,0,SXF_SETMASTER)
    ABCD A 1 A_SpawnItemEx("fallen",60,0,0,0,0,0,0,SXF_SETMASTER)
    ABCD A 1 A_SpawnItemEx("fallen",0,60,0,0,0,0,0,SXF_SETMASTER)
    ABCD A 10 A_Look
    Goto Spawn+4
See:
    ABCD ABCDEFGHIJKLMN 2 A_Chase
    Loop
Missile:
    ABCD A 0 A_Jump(256,"Missile1","MinionRaise")
 Missile1:
    ABCD ABCDEFGHIJKL 2 A_FaceTarget
    ABCD N 2 A_CustomMissile
    ABCD OPQ 2
    Goto See
 MinionRaise:
    ABCD ABCDEFGHIJKLM 2
    ABCD N 2 A_RaiseChildren
    ABCD OPQ 2
    Goto See
Oh, now I see what you meant. I didn't know about the NoDelay function, so I thought it was only possible for the necromancer to start spawning monsters once it activates, which wasn't the desired result. I'll try tinkering with that function and see what I can get out of it. Thank you for helping me out and I apologize for being a little bit dense.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: Creating a monster that resurrects other monsters?

Post by Void Weaver »

NoDelay is just keyword for execution f-tions in the 1st frame of Spawn state. In older port versions can be replaced by buffer frame.

Well, A_SpawnItemEx+A_RaiseChildren set are still lame solution strongly dependable from sector geometry and can't operate (revive) with non-children actors of the same class. But it's still easiest way. At least for Necromancy neophytes. Image
User avatar
Ariasio
Posts: 40
Joined: Sat Apr 27, 2019 7:47 pm

Re: Creating a monster that resurrects other monsters?

Post by Ariasio »

Void Weaver wrote:Well, A_SpawnItemEx+A_RaiseChildren set are still lame solution strongly dependable from sector geometry and can't operate (revive) with non-children actors of the same class. But it's still easiest way. At least for Necromancy neophytes.
Well, as much as I'd love a more flexible solution, seems like this is what I'm going to have to work with. Still, you'd think there exists something that simply allows you to tag which actors are susceptible to resurrection and which aren't and place a monster performing a "batch resurrection" of sorts that only affects the tagged actors. Unless there is and I'm acting dumb again, in which case, pretend I didn't say that :P Anyways, once again, thanks for the help.
Boondorl
Posts: 169
Joined: Wed Jul 11, 2018 10:57 pm

Re: [SOLVED] Creating a monster that resurrects other monste

Post by Boondorl »

I've played Dark Souls so I see what you're going for. You can put an A_CheckProximity (https://zdoom.org/wiki/A_CheckProximity) in the Death state of the mob you want to be raised and loop to check every 35 or so tics (please don't spam it every tic). If it finds a necromancer, it jumps to a state that allows it to raise itself (A_RaiseSelf can be used here - https://zdoom.org/wiki/A_RaiseSelf; note the special requirements to get it to work).

If you wanna get even fancier with it, you can simulate the Divine weapon effect as well. When the mob spawns, give it an inventory item (see: CustomInventory - https://zdoom.org/wiki/Classes:CustomInventory) and define a special damage type for weapons you want to permanently kill it. If it dies to that type (you can define a special death state for it via Death.type), take that inventory item away. Then before doing the check for a necromancer you can do a check to see if the inventory item is present and, if not, skip the check. Just make sure the Raise state gives it back so they can get the necromancer effect again if a different enemy revives them e.g. an Arch-vile.
User avatar
Ariasio
Posts: 40
Joined: Sat Apr 27, 2019 7:47 pm

Re: [SOLVED] Creating a monster that resurrects other monste

Post by Ariasio »

Boondorl wrote:I've played Dark Souls so I see what you're going for. You can put an A_CheckProximity (https://zdoom.org/wiki/A_CheckProximity) in the Death state of the mob you want to be raised and loop to check every 35 or so tics (please don't spam it every tic). If it finds a necromancer, it jumps to a state that allows it to raise itself (A_RaiseSelf can be used here - https://zdoom.org/wiki/A_RaiseSelf; note the special requirements to get it to work).

If you wanna get even fancier with it, you can simulate the Divine weapon effect as well. When the mob spawns, give it an inventory item (see: CustomInventory - https://zdoom.org/wiki/Classes:CustomInventory) and define a special damage type for weapons you want to permanently kill it. If it dies to that type (you can define a special death state for it via Death.type), take that inventory item away. Then before doing the check for a necromancer you can do a check to see if the inventory item is present and, if not, skip the check. Just make sure the Raise state gives it back so they can get the necromancer effect again if a different enemy revives them e.g. an Arch-vile.
That sounds exactly like the effect I wanted to achieve. Thanks a lot, man.
Boondorl
Posts: 169
Joined: Wed Jul 11, 2018 10:57 pm

Re: [SOLVED] Creating a monster that resurrects other monste

Post by Boondorl »

Keep in mind that this is a purely decorate example and as such is not optimized and still not super flexible. However, if you wanna use the holy grail of modding languages, ZScript, you can do pretty much anything with the right tools. I actually spent some time last night putting together an example of it in action (see the attachment below). It includes quite a few optimizations in comparison to my decorate example and gives a ton of flexibility.

In this example, the Baron of Hell is the Necromancer and the Imps are the Skeletons. They both have the same species tag now to prevent infighting. Imps have been modified so they can't be resurrected by a Necromancer if:
  • They get gibbed
  • They get crushed
  • They get killed by the holiest of shotguns, the Divine Super Shotgun
  • They are friendly to the player
While alive, Necromancers will look for Skeletons to revive every 2-5 seconds (I currently have it randomized). In the function I have it set so it can revive up to 16 at a time within a range of 2048 map units, but you can customize this however you'd like. It also checks if a player is within that range, but that's mainly an optimization tweak and can be extended if that's what you're looking for. Hopefully this can serve as a good template if you'd like to modify it further.
Attachments
Dark Souls Necromancer.pk3
(2.06 KiB) Downloaded 58 times
Post Reply

Return to “Scripting”