Corpse comes to life...
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Corpse comes to life...
How would I go about making dead bodies rise from the dead? By this I mean they are dead by default - they come to life by entering their vicinity or even by random. So what you think is just a corpse could become a potential threat. I have two corpses at the beginning of my game that were supposed to have been killed before it begins. I want these to spring to life in game by complete surprise to the player.
How would I go about this?
Thank you in advance.
How would I go about this?
Thank you in advance.
Re: Corpse comes to life...
Kill them with ACS when the map loads, then do Thing_Raise on them when you are ready. The actors will need raise states AFAIK (just their death animation in reverse).
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Corpse comes to life...
Thank you for the reply. My ACS is a bit weak, unfortunately. Also is there no way to animate the corpses only when you enter their area or trigger them in someway?
Re: Corpse comes to life...
That's what the Thing_Raise script will do.Hidden Hands wrote:Also is there no way to animate the corpses only when you enter their area or trigger them in someway?
When the map loads, this could run:
Code: Select all
script 1 OPEN
{
Thing_Destroy(tid, 0, 0); // tid is the tag of the things to kill
}
Code: Select all
script 2 (void)
{
Thing_Raise(tid, 0);
}
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Corpse comes to life...
Okay thank you. Finally, where do I put this script in the WAD or in the line-def script action?
Re: Corpse comes to life...
Those scripts go in the map's SCRIPTS lump (and later BEHAVIOR once compiled). You do this directly in the map editor assuming you are using a map format that supports ACS natively like Hexen or UDMF using the "Script Editor" button. If you are using Boom then you are SOL anyway because you can't tag things there to begin with.
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Corpse comes to life...
Ah great. I'm working with UDMF so that shouldn't be a problem. Thank you greatly.Nevander wrote:Those scripts go in the map's SCRIPTS lump (and later BEHAVIOR once compiled). You do this directly in the map editor assuming you are using a map format that supports ACS natively like Hexen or UDMF using the "Script Editor" button. If you are using Boom then you are SOL anyway because you can't tag things there to begin with.
Re: Corpse comes to life...
You could also use decorate to do it. While this method does have the drawback of needing a separate defined actor, it can also allow you to do something like this:
Code: Select all
ACTOR RaisedZombie{
MONSTER
States{
Spawn:
ZOMB Z 1 A_LookEx(LOF_NOSOUNDCHECK,0,256,0,360,"IsBackTurned") // Only check for potential targets close by. Look in 360 degree view, and don't do sound checking.
Wait
IsBackTurned:
ZOMB Z 1
TNT1 A 0 A_JumpIfInTargetLOS("IsBackTurned",120) // Is this monster within its target's FOV?
TNT1 A 0 A_LookEx(LOF_NOSOUNDCHECK,0,256,0,360,1) // It's not in the FOV, but is it still close?
Loop
ZOMB Y 4 A_PlaySound("monsters/zombieraise",CHAN_BODY) // It's not in FOV, and it's close. Time to give it a scare!
ZOMB XWVUT 4
Chase:
ZOMB ABCD 4 A_Chase
Loop}}
- Hidden Hands
- Posts: 1053
- Joined: Tue Sep 20, 2016 8:11 pm
- Location: London, England
- Contact:
Re: Corpse comes to life...
This is fantastic. I have only one issue with it.... the zombie just stands there walking on the spot, looking at me and doing nothing else... ? How do I make it pursue me and attack? I modified the code and blended it with my "already active " zombies. But now the dead corpse makes zombie sounds when it should be silent until it renanimates.amv2k9 wrote:You could also use decorate to do it. While this method does have the drawback of needing a separate defined actor, it can also allow you to do something like this:Code: Select all
ACTOR RaisedZombie{ MONSTER States{ Spawn: ZOMB Z 1 A_LookEx(LOF_NOSOUNDCHECK,0,256,0,360,"IsBackTurned") // Only check for potential targets close by. Look in 360 degree view, and don't do sound checking. Wait IsBackTurned: ZOMB Z 1 TNT1 A 0 A_JumpIfInTargetLOS("IsBackTurned",120) // Is this monster within its target's FOV? TNT1 A 0 A_LookEx(LOF_NOSOUNDCHECK,0,256,0,360,1) // It's not in the FOV, but is it still close? Loop ZOMB Y 4 A_PlaySound("monsters/zombieraise",CHAN_BODY) // It's not in FOV, and it's close. Time to give it a scare! ZOMB XWVUT 4 Chase: ZOMB ABCD 4 A_Chase Loop}}
Here is my code.
Code: Select all
ACTOR DormantDead 292
{
Game Doom
obituary "%o was eaten."
health 20
mass 90
speed 8
Radius 20
Height 52
painchance 200
seesound "grunt/sight"
painsound "grunt/pain"
deathsound "grunt/death"
activesound "grunt/active"
MONSTER
+FLOORCLIP
States
{
Spawn:
ZOMB N 1 A_LookEx(LOF_NOSOUNDCHECK,0,256,0,360,"IsBackTurned") // Only check for potential targets close by. Look in 360 degree view, and don't do sound checking.
Wait
IsBackTurned:
ZOMB N 1
TNT1 A 0 A_JumpIfInTargetLOS("IsBackTurned",120) // Is this monster within its target's FOV?
TNT1 A 0 A_LookEx(LOF_NOSOUNDCHECK,0,256,0,360,1) // It's not in the FOV, but is it still close?
Loop
ZOMB M 4 A_PlaySound("monsters/zombieraise",CHAN_BODY) // It's not in FOV, and it's close. Time to give it a scare!
ZOMB MLKJIH 4
Chase:
ZOMB ABCD 7 A_Chase
Loop
See:
ZOMB AABBCCDD 7 A_Chase
loop
Melee:
ZOMB E 8 A_FaceTarget
ZOMB F 16 A_CustomMeleeAttack (random (2, 6) *5, "KnifeHit", "skeleton/swing")
ZOMB E 4
goto See
Pain:
ZOMB G 3
ZOMB G 3 A_Pain
goto See
Death:
ZOMB H 5
ZOMB I 5 A_Scream
ZOMB J 5 A_NoBlocking
ZOMB K 5
ZOMB L 13
ZOMB M 5
ZOMB N -1
stop
XDeath:
ZOMB O 5
ZOMB P 5 A_XScream
ZOMB Q 5 A_NoBlocking
ZOMB RSTUV 5
ZOMB W -1
stop
Raise:
ZOMB MLKJIH 5
goto See
}
}