Corpse comes to life...

Archive of the old editing forum
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.
Locked
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Corpse comes to life...

Post by Hidden Hands »

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.
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Corpse comes to life...

Post by Nevander »

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).
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: Corpse comes to life...

Post by Hidden Hands »

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?
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Corpse comes to life...

Post by Nevander »

Hidden Hands wrote:Also is there no way to animate the corpses only when you enter their area or trigger them in someway?
That's what the Thing_Raise script will do.

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
}
When you enter an area (player enters sector action) OR cross a line, this script runs:

Code: Select all

script 2 (void)
{
	Thing_Raise(tid, 0);
}
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: Corpse comes to life...

Post by Hidden Hands »

Okay thank you. Finally, where do I put this script in the WAD or in the line-def script action?
Nevander
Posts: 2254
Joined: Mon Jan 06, 2014 11:32 pm

Re: Corpse comes to life...

Post by Nevander »

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.
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: Corpse comes to life...

Post by Hidden Hands »

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.
Ah great. I'm working with UDMF so that shouldn't be a problem. Thank you greatly.
User avatar
amv2k9
Posts: 2178
Joined: Sun Jan 10, 2010 4:05 pm
Location: Southern California

Re: Corpse comes to life...

Post by amv2k9 »

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}}
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: Corpse comes to life...

Post by Hidden Hands »

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}}
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.

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
	  }
}
Locked

Return to “Editing (Archive)”