Custom monster somehow alive after death?

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
JtoTheB
Posts: 45
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Custom monster somehow alive after death?

Post by JtoTheB »

Apologies for posting on this forum so much but this is quite the urgent issue. I'm making a boss fight map for my mod and have basically finished the boss. The only issue with it is that when I kill it, it plays it's death sound but just does not die. It keeps roaming the map and attacking. I'll post the code below, and any help is appreciated.

Code: Select all

Actor LittleRedBug
{
	Health 8000
	Radius 80
	Scale 0.5
	Height 60
	Monster
	painchance 255
	+FLOAT
	+NOGRAVITY
	+DONTFALL
	+BOSS
	Speed 16
	PainSound "monsters/screech"
	DeathSound "Skeleton/death"
	Obituary "%o was incinerated by Little Red Bug"
	States
	{
		Spawn:
			SMAL A 1 a_look
			loop
		See:
			SMAL A 2 a_chase
			loop
		Pain:
			SMAL A 1 A_PAIN
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,30)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,60)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,90)
		
		Missile:
			SMAL A 10 A_FACETARGET
			SMAL A 10 A_JUMP (256, "missile1", "Missile2", "see", "Missile3")
		Missile1:
			SMAL A 10 A_FACETARGET
			SMAL A 10 a_custommissile("FatShot",30,0)
			SMAL A 10 a_custommissile("FatShot",30,30)
			SMAL A 10 a_custommissile("FatShot",30,60)
			SMAL A 10 a_custommissile("FatShot",30,90)
			SMAL A 10 A_JUMP (256, "missile1", "Missile2", "see", "Missile3")
		Missile2:
			SMAL A 10 A_FACETARGET
			SMAL A 10 A_PLAYSOUND ("Monsters/screech")
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,30)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,60)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,90)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,120)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,150)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,180)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,30)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,60)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,90)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,120)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,150)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,180)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,30)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,60)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,90)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,120)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,150)
			SMAL A 1 A_CUSTOMMISSILE("ENEMYGRENADE",0,180)
			SMAL A 10 A_JUMP (256, "missile1", "Missile2", "see", "Missile3")
		Missile3:
			SMAL A 10 A_FACETARGET
			SMAL A 10 A_PLAYSOUND ("Monsters/screech")
			SMAL A 10 A_CUSTOMMISSILE("NUCLEARMISSILE",0,30)
		Death:
			SMAL B 1 A_Scream
			SMAL B 1 A_NoBlocking
	}
}
User avatar
Enjay
 
 
Posts: 27130
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Custom monster somehow alive after death?

Post by Enjay »

I don't know if this is where the problem lies, but it could be. A few of your state sequences don't have suitable endings. State sequences typically end with a word like "loop", which you have used, or "Goto [insert sequence name here]" or "Stop". If a sequence doesn't end with something like that, it will just "fall through" to the next line of code. In the places where you have used A_Jump, that should be OK because you are ensuring the the sequence goes somewhere. However, your pain sequence always falls through to Missile (whether intended or not, I don't know). More typically a pain sequence ends with "Goto See" to return the enemy to the See state.

Your death sequence just has two frames and then... no further instructions. Normally, a death sequence ends with Stop. So, perhaps GZDoom doesn't know what to do and it just ends up wandering around as a ghost with no hit points.
User avatar
JtoTheB
Posts: 45
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Re: Custom monster somehow alive after death?

Post by JtoTheB »

I have a bit of an issue with the death sequence. When my monster dies, it's corpse shows for a second and then dissapears.
User avatar
JtoTheB
Posts: 45
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Re: Custom monster somehow alive after death?

Post by JtoTheB »

An update on that, I managed to fix it but as I was testing the monster it just... randomly arose from the dead!
User avatar
Enjay
 
 
Posts: 27130
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Custom monster somehow alive after death?

Post by Enjay »

The corpse disappearing after a brief moment is expected from your code.

Your code tells GZDoom to display SMAL B for 1 tic and use the A_Scream pointer, then display SMAL B again for 1 tic, this time using the A_NoBlocking pointer. However, there is nothing to stop it after that. So, the entire death sequence only lasts 2 tics (2/35 of a second) and then falls through to something else.

If you want the final frame to remain, give it a duration of -1 (and follow it with the word Stop).

That may also prevent the "randomly rising from the dead".

If not. Please post what your code looks like after recent changes.
User avatar
JtoTheB
Posts: 45
Joined: Sat Aug 09, 2025 9:46 am
Operating System Version (Optional): Windows 11
Location: New Jersey

Re: Custom monster somehow alive after death?

Post by JtoTheB »

After some polishing, I've managed to fully fix the monster
User avatar
Enjay
 
 
Posts: 27130
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Custom monster somehow alive after death?

Post by Enjay »

Glad to hear you've solved it. :thumb:
Post Reply

Return to “Scripting”