(SOLVED) LOS-base actor not executing special on "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
Doominer441
Posts: 210
Joined: Thu Oct 24, 2013 9:04 pm
Preferred Pronouns: They/Them

(SOLVED) LOS-base actor not executing special on "Death"

Post by Doominer441 »

I'm making a series of actors for my levels. The basic feature of them is they stand in place and vanish if you look at them. I want things to happen when they do. I assumed that by making A_JumpIfInTargetLOS go to a "Death" state, it would execute any special I assign to the actors as if they were monsters I killed, however this doesn't appear to be the case.

Code: Select all

Actor CreepyGhost1 900
{
	+ISMONSTER
	+LOOKALLAROUND
	RENDERSTYLE TRANSLUCENT
	ALPHA 0.50
	States
	{
	Spawn:
		GHST A 0 A_JumpIfInTargetLOS("Death", 100, 0, 400)
		GHST A 5 A_Look
		Loop
	Death:
		TNT1 A -1 A_NoBlocking
		Stop
	}
}


It certainly vanishes if I look directly at it, but by trying to assign it a variety of specials, none of them execute when it dies. What am I doing wrong?
Last edited by Doominer441 on Thu Mar 07, 2024 8:04 am, edited 1 time in total.
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: LOS-base actor not executing special on "Death"

Post by Jarewill »

The specials might not execute because you aren't actually killing the ghost by jumping to the Death state.
Instead of jumping to the Death state, jump to another state that uses A_Die to kill your ghost. (You will also have to give it a flag such as +SHOOTABLE to make it killable)
For example:

Code: Select all

Actor CreepyGhost1 900
{
	+ISMONSTER
	+LOOKALLAROUND
	RENDERSTYLE TRANSLUCENT
	ALPHA 0.50
	+SHOOTABLE
	States
	{
	Spawn:
		GHST A 0 A_JumpIfInTargetLOS("Die", 100, 0, 400)
		GHST A 5 A_Look
		Loop
	Die:
		TNT1 A 0 A_Die
	Death:
		TNT1 A -1 A_NoBlocking
		Stop
	}
}
User avatar
Doominer441
Posts: 210
Joined: Thu Oct 24, 2013 9:04 pm
Preferred Pronouns: They/Them

Re: (SOLVED) LOS-base actor not executing special on "Death"

Post by Doominer441 »

Thank you, that works perfectly.
Post Reply

Return to “Scripting”