Axamoretl Posted September 24, 2023 (edited) Hey all! I'm working on a map and I've got a couple of script related issues that seem to be tied to how quickly things happen. First, a secret tied to a "pressure plate" (Actor Hits Floor 9999 + Actor Leaves Sector 9997), but it seems to be malfunctioning. If the player runs across the plate, it breaks the script and lets the player access the secret switch at any time versus it being contingent on them being on the plate to do so. Here's a quick video breakdown of the issue: Code for the AHF 9999 Thing: script "S1 Target On" (void) { if ((s1Done) == 0) { PlaySound ( 0, "chunk", CHAN_BODY, 1., FALSE, 0); Ceiling_MoveToValue (2, 36, 96, 0); Floor_LowerByValue (4, 150, 3); ChangeCeiling (3, "CEILYEL"); delay(25); } else delay(1); } Code for the ALS 9997 Thing: script "S1 Target Off" (void) { if ((s1Done) == 0) { PlaySound ( 0, "chunk", CHAN_BODY, 1., FALSE, 0); Ceiling_MoveToValue (2, 36, 32, 0); Floor_RaiseByValue (4, 150, 3); ChangeCeiling (3, "FLOOR1_7"); delay(25); } else delay(1); } Second, killing enemies at the same time causes this script to only count once script "ET1" (void) { diffCounter = diffCounter + 1; } I've tried putting script "ET1" (void) { delay(1); diffCounter = diffCounter + 1; } and script "ET1" (void) { diffCounter = diffCounter + 1; delay(1); } Though I'm not sure why I thought either would work lmao Any help on this will be greatly appreciated. And I did check the wiki and the forum ahead of time. Couldn't quite find exactly what I needed. Edited September 24, 2023 by Axamoretl 0 Quote Share this post Link to post
Paf Posted September 25, 2023 44 minutes ago, Axamoretl said: Second, killing enemies at the same time causes this script to only count once not sure, but maybe they're not set to execute always? also, it'd be easier to actually have the map here so it can be checked rather than just going off of scripts (which could be perfectly fine) 0 Quote Share this post Link to post
Axamoretl Posted September 25, 2023 5 minutes ago, Paf said: not sure, but maybe they're not set to execute always? also, it'd be easier to actually have the map here so it can be checked rather than just going off of scripts (which could be perfectly fine) https://drive.google.com/file/d/1s6RqcuoaiK6dIgNkBzApFUd9zVeKR7ec/view?usp=sharing Ez peasy. The sooner I get this sorted the sooner the map can be completed! 0 Quote Share this post Link to post
The DANDY Company Posted September 25, 2023 (edited) It happens when you walk on/off the switch really fast. Because the "Off" script is called before sector 2's ceiling has finished moving up, the command to lower the ceiling won't occur. I think I fixed it by adding TagWait(2) in the two switch scripts like below. This waits for sector 2 to stop before calling the next action. script "S1 Target On" (void) { if ((s1Done) == 0) { PlaySound ( 0, "chunk", CHAN_BODY, 1., FALSE, 0); Floor_LowerByValue (4, 150, 3); ChangeCeiling (3, "CEILYEL"); TagWait(2); Ceiling_MoveToValue (2, 36, 96, 0); delay(25); } else delay(1); } script "S1 Target Off" (void) { if ((s1Done) == 0) { PlaySound ( 0, "chunk", CHAN_BODY, 1., FALSE, 0); Floor_RaiseByValue (4, 150, 3); ChangeCeiling (3, "FLOOR1_7"); TagWait(2); Ceiling_MoveToValue (2, 36, 32, 0); delay(25); } else delay(1); } Andarchitect The DANDY Company Edited September 25, 2023 by The DANDY Company 1 Quote Share this post Link to post
Axamoretl Posted September 25, 2023 1 hour ago, The DANDY Company said: It happens when you walk on/off the switch really fast. Because the "Off" script is called before sector 2's ceiling has finished moving up, the command to lower the ceiling won't occur. I think I fixed it by adding TagWait(2) in the two switch scripts like below. This waits for sector 2 to stop before calling the next action. script "S1 Target On" (void) { if ((s1Done) == 0) { PlaySound ( 0, "chunk", CHAN_BODY, 1., FALSE, 0); Floor_LowerByValue (4, 150, 3); ChangeCeiling (3, "CEILYEL"); TagWait(2); Ceiling_MoveToValue (2, 36, 96, 0); delay(25); } else delay(1); } script "S1 Target Off" (void) { if ((s1Done) == 0) { PlaySound ( 0, "chunk", CHAN_BODY, 1., FALSE, 0); Floor_RaiseByValue (4, 150, 3); ChangeCeiling (3, "FLOOR1_7"); TagWait(2); Ceiling_MoveToValue (2, 36, 32, 0); delay(25); } else delay(1); } Andarchitect The DANDY Company BAM! That did the trick! Thanks for that one. All I gotta do is figure out why my int operator ignores multiple cases happening at once and it should be smooth sailin onward! 0 Quote Share this post Link to post
Axamoretl Posted September 25, 2023 18 hours ago, Paf said: not sure, but maybe they're not set to execute always? also, it'd be easier to actually have the map here so it can be checked rather than just going off of scripts (which could be perfectly fine) Coming back to this, what do you mean by "not set to execute always"? Shouldn't it execute, by default, every time an enemy dies? Or did I miss a command/code line for this? 0 Quote Share this post Link to post
boris Posted September 25, 2023 By default a specific script can not be executed again while it's already running - that's the case when the enemies executing the script on their death die in the same tic. If you still want to execute the script you have to use an action like ACS_ExecuteAlways. A common alternative to do something if specific enemies died is to have an script running in an infinite loop and just count the things (for example using ThingCountName) until their number reaches 0. 1 Quote Share this post Link to post
Axamoretl Posted September 29, 2023 On 9/25/2023 at 3:00 PM, boris said: By default a specific script can not be executed again while it's already running - that's the case when the enemies executing the script on their death die in the same tic. If you still want to execute the script you have to use an action like ACS_ExecuteAlways. A common alternative to do something if specific enemies died is to have an script running in an infinite loop and just count the things (for example using ThingCountName) until their number reaches 0. BINGO! That did the trick. Y'all rule. 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.