SwitchableDecorations maybe APROP_DORMANT related

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!)
User avatar
Enjay
 
 
Posts: 27306
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

SwitchableDecorations maybe APROP_DORMANT related

Post by Enjay »

I'm trying to figure out why this ACS script does not work as I want it to when I apply it to Switchable Decorations, but it does (with no changes) when I try it with dynamic lights:

Code: Select all

Script 34 (void)
{
	if(!GetActorProperty(152,APROP_Dormant))
	{
		Thing_Deactivate(152);
		ThingSound(152, "click", 127);
	}
	else
	{
		Thing_Activate(152);
		ThingSound(152, "click", 127);
	}
}
If I use it with a dynamic light actor, the script does what I intend: use it once and the light turns off and I can hear a click, use it again and the light turns on - again with a click.

If I use it with a SwitchableDecoration actor (for example, a small decorative lantern - but I have tried several different actors) it behaves differently. The lantern goes to its inactive state label, as expected (with a click from the script) when I use the script the first time but, when I use the script again, the actor remains in the inactive condition (but I still hear a click, indicating that the script is running). I can certainly activate/deactivate the decoration using Thing_Activate/Thing_Deactivate in ACS. So, it seems to me as if the GetActorProperty check is failing somehow.

Here's the lantern:

Code: Select all

CLASS LanternLED : SwitchableDecoration  
{ 
	Default 
	{
		Radius 8;
		Height 16;
		+FLOORCLIP;
	}
	States
	{
		Spawn:
		Active:
			LNTN A -1;
			Stop;
			
		Inactive:
			LNTN B -1;
			Stop;
	}
}
My guess is that dynamic lights explicitly set/unset the dormant flag in their definition, but switchable decorations do not (unless I define them to do that myself).
I can easily work around this and get what I want. I just wanted to check why it is happening in the first place.

Return to “Scripting”