Referring to an actor's own state rather than its parent's

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
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Referring to an actor's own state rather than its parent's

Post by Matt »

I'm trying to clean up the code to this to make changes to it easier. The wad requires several projectile actors, all of which have the exact same speed, size, and damage including explosions. I don't want to edit umpteen A_Explode calls every time I want to tweak the explosion, so I use a custom state "Fade" to refer to the death animation while "Death" has all the important "destroy the actor and the stuff next to it" bits.

So here's the Fade and Death states for the plasma ball that all other projectiles inherit from:

Code: Select all

	Fade:
		PLSE AB 4 bright
		PLSE CCDDEE 2 bright A_FadeOut (0.2)
		stop
	Death:
		BFE1 A 0 A_Die
		PLSE A 0 A_Explode (24, 32)
		goto Fade
And here's an example of one of the inheriting projectiles:

Code: Select all

	Fade:
		BAL1 C 6 bright
		BAL1 DDEEE 2 bright A_FadeOut (0.2)
		stop
The problem is, instead of referring to the new Fade, the imp ball goes back to the old one so it has the plasma ball explosion. GZDoom (which I'm using specifically for the custom states) doesn't seem to recognize the state at all: if I comment out the Fade state in the parent, the projectile just does the radius damage and disappears without any animation.

One workaround I've tried is to have the Death state be the animation with a "goto Fade" inside it which would only be defined in the parent. All frames before the goto work as intended, but once the Fade state ends and goes back to Death+2, the animation I see is that of the parent.

This effect is the same whether I name a new state or use an existing one like See or XDeath.

So I was wondering: is it actually supposed to work like this, and if so would anyone happen to be able to think of a workaround that doesn't involve the explosionradius or explosiondamage properties?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

gotos are resolved at compile time, not run time. If you need a 'virtual' jump like you apparently want you have to use A_Jump to a label instead.
Locked

Return to “Editing (Archive)”