[SOLVED] Death.Sky won't work?

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!)
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1117
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

[SOLVED] Death.Sky won't work?

Post by Jekyll Grim Payne »

Code: Select all

Actor GreenPlasmaball : ArachnotronPlasma replaces ArachnotronPlasma
{
translation "192:207=112:127", "240:247=112:127"
+DONTBLAST
+FORCEXYBILLBOARD
+THRUGHOST
+NOEXTREMEDEATH
+BLOODLESSIMPACT
decal ArachnotronPlasmaSplat
damagetype PlasmaDamage
renderstyle Translucent
scale .2
alpha 0.7
States
	{
	Spawn:
		TNT1 A 0 NoDelay A_SpawnItemEx("GreenFlarePlasma",0,0,0,velx,vely,velz,0,SXF_SETMASTER|SXF_ORIGINATOR|SXF_ABSOLUTEVELOCITY)
		ARBA ABCDEF 3 bright
		goto spawn+1
	Death.Sky:
		TNT1 A 0 A_RemoveChildren(1,RMVF_EVERYTHING)
		stop
	Death:
		TNT1 A 0 A_RemoveChildren(1,RMVF_EVERYTHING)
		PEXP ABCDEFGHIJKLM 2 bright A_FadeOut(0.07)
		stop
	}
}
This projectile won't enter its Death.Sky state. I know because the flare it spawns doesn't disappear, so A_RemoveChildren is never executed.
If I give it +SKYEXPLODE, it'll enter its regular Death state.
What am I missing?
Last edited by Jekyll Grim Payne on Tue Jan 23, 2018 2:08 pm, edited 1 time in total.
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: Death.Sky won't work?

Post by Blue Shadow »

SKYEXPLODE flag needs to be set on the projectile for it to enter Death.Sky.
Jekyll Grim Payne wrote:I know because the flare it spawns doesn't disappear, so A_RemoveChildren is never executed.
With the above flag set, in the Death.Sky state sequence, temporarily replace (or just add) A_RemoveChildren with A_PrintBold("Test") and give it a try. Do you see "Test" printed on the screen when the projectile hits the sky?
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1117
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Re: Death.Sky won't work?

Post by Jekyll Grim Payne »

Blue Shadow wrote:SKYEXPLODE flag needs to be set on the projectile for it to enter Death.Sky.
Jekyll Grim Payne wrote:I know because the flare it spawns doesn't disappear, so A_RemoveChildren is never executed.
With the above flag set, in the Death.Sky state sequence, temporarily replace (or just add) A_RemoveChildren with A_PrintBold("Test") and give it a try. Do you see "Test" printed on the screen when the projectile hits the sky?
There's really no need for that because when I put +SKYEXPLODE I can absolutely clearly see that the regular Death sequence is executed: it shows the Death state animations (which simply aren't present in Death.Sky, so it'd just disapper). Which, according to you, is not what should happen.
User avatar
phantombeta
Posts: 2150
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Death.Sky won't work?

Post by phantombeta »

Code: Select all

if (onsky || (line != NULL && line->special == Line_Horizon))
	{
		if (!(mo->flags3 & MF3_SKYEXPLODE))
		{
			// [RH] Don't explode missiles on horizon lines.
			mo->Destroy();
			return;
		}
		nextstate = mo->FindState(NAME_Death, NAME_Sky);
	}
This snippet of code from GZDoom's source shows you need SKYEXPLODE set or the missile will just disappear.
You're either doing something wrong, or the version you're using is too old to have this. The "Death.Sky" state seems to have been added at around GZDoom 3.0.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1117
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Re: Death.Sky won't work?

Post by Jekyll Grim Payne »

Okay, I see what the problem is. The version I was shooting was actually not the one that I posted but a similar version which inherits from FastProjectile instead (to make use of its MissileType feature). And FastProjectile won't recognize Death.Sky state, invariably going into regular Death instead (if +SKYEXPLODE is present).

I don't quite understand this behavior though. Isn't FastProjectile built on regular projectiles? Why wouldn't it use Death.Sky?
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: Death.Sky won't work?

Post by Blue Shadow »

FastProjectile has its own movement code. It looks like when the Death.Sky feature was added, FastProjectile was left out.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1117
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Re: Death.Sky won't work?

Post by Jekyll Grim Payne »

All right, I guess I'll have to go for a workaround. Thanks.

Return to “Scripting”