Circular room has 4 entrances. ACS Script Linedef help!

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
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Circular room has 4 entrances. ACS Script Linedef help!

Post by Hidden Hands »

I have an ACS script that runs when the player walks over a linedef that triggers a small scene. This happens when the player enters a circular room that has four entrances. It doesn't matter which entrance the player enters from, because the linedef is on each entrance. But here it my problem. I only want this script to execute ONCE. If it is activated by one entrance, I need the other three to become inactive. How can I do this with my code?

Code: Select all

script 8 (void)
{
	SetPlayerProperty (0, 1, PROP_TOTALLYFROZEN);
	AmbientSound("shadowconsciousness/taunt3", 127);
	SpawnSpotForced("HauntDevil",2,3,0);
	Sector_SetColor (3, 0, 255, 255);
	Light_ChangeToValue(3, 128);
	delay (200);
	AmbientSound("Ghost/Scream", 127);
	Thing_Remove (3);
	Sector_SetColor (3, 255, 255, 255);
	Light_ChangeToValue(3, 104);
	delay (80);
    SetPlayerProperty (0, 0, PROP_TOTALLYFROZEN);
}
That's the code, but each time I enter the area from each entrance it plays each time. I have it set to one time use, but because their are four "different" entrances it triggers each on when the player walks over it once. Please help.

Thanks in advance!
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Circular room has 4 entrances. ACS Script Linedef help!

Post by ramon.dexter »

Well, use variables.

Code: Select all

bool firedscript = false;
script 8 (void)
{

if (!firedscript) {
   SetPlayerProperty (0, 1, PROP_TOTALLYFROZEN);
   AmbientSound("shadowconsciousness/taunt3", 127);
   SpawnSpotForced("HauntDevil",2,3,0);
   Sector_SetColor (3, 0, 255, 255);
   Light_ChangeToValue(3, 128);
   delay (200);
   AmbientSound("Ghost/Scream", 127);
   Thing_Remove (3);
   Sector_SetColor (3, 255, 255, 255);
   Light_ChangeToValue(3, 104);
   delay (80);
    SetPlayerProperty (0, 0, PROP_TOTALLYFROZEN);
firedScript = true;
}
}
User avatar
Hidden Hands
Posts: 1053
Joined: Tue Sep 20, 2016 8:11 pm
Location: London, England
Contact:

Re: Circular room has 4 entrances. ACS Script Linedef help!

Post by Hidden Hands »

Exactly what I needed! Excellent, thank you so much!
Post Reply

Return to “Scripting”