My custom monster can't be killed after resurrecting

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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
splattenburgers
Posts: 2
Joined: Fri Apr 12, 2024 5:17 pm

My custom monster can't be killed after resurrecting

Post by splattenburgers »

I attempted to create a zombieman variant with a 50% chance of reviving after death, but it returns non-solid and unkillable for some reason.

Here is the actor code:

Code: Select all

class ZombieManRevenge : Actor replaces ZombieMan
{
	Default
	{
		Health 20;
		Radius 20;
		Height 56;
		Speed 8;
		PainChance 200;
		Monster;
		+FLOORCLIP
		SeeSound "grunt/sight";
		AttackSound "grunt/attack";
		PainSound "grunt/pain";
		DeathSound "grunt/death";
		ActiveSound "grunt/active";
		Obituary "$OB_ZOMBIE";
		Tag "$FN_ZOMBIE";
		DropItem "Clip";
	}
 	States
	{
	Spawn:
		POSS AB 10 A_Look;
		Loop;
	See:
		POSS AABBCCDD 4 A_Chase;
		Loop;
	Missile:
		POSS E 10 A_FaceTarget;
		POSS F 8 A_PosAttack;
		POSS E 8;
		Goto See;
	Pain:
		POSS G 3;
		POSS G 3 A_Pain;
		Goto See;
	Death:
		POSS H 5 A_Jump(128, "FakeDeath");
		POSS I 5 A_Scream;
		POSS J 5 A_NoBlocking;
		POSS K 5;
		POSS L -1;
		Stop;
	FakeDeath:
		POSS H 5;
		POSS I 5 A_Scream;
		POSS J 5 A_ChangeFlag("A_NoBlocking", FALSE);
		POSS K 5;
		POSS L 150;
		POSS L 1 A_Jump(256, "Raise");
		POSS L -1;
		Stop;
	XDeath:
		POSS M 5;
		POSS N 5 A_XScream;
		POSS O 5 A_NoBlocking;
		POSS PQRST 5;
		POSS U -1;
		Stop;
	Raise:
		POSS K 5;
		POSS JIH 5;
		Goto See;
	}
}
Jarewill
 
 
Posts: 1855
Joined: Sun Jul 21, 2019 8:54 am

Re: My custom monster can't be killed after resurrecting

Post by Jarewill »

That happens because you jump to the Raise state directly instead of resurrecting the monster, which creates a ghost.
You will have to use a function like A_RaiseSelf to resurrect the monster first.

Also your A_ChangeFlag won't work because "A_NoBlocking" is not a valid flag.
Since you use ZScript, you can directly change the flag, like so: POSS J 5 { bNOBLOCKING = false; }
Post Reply

Return to “Scripting”