Gunrock Posted April 11, 2020 I have a door (non repeatable) script that prints the following message: script 7 (void) { ambientsound("amb9",127); hudmessage(s:"This object requires a sacrifice to open."; HUDMSG_FADEOUT, 1, CR_gray, 0.5, 0.5, 4.0, 1.0 // Time to fade to nothingness. ); } This script opens that door and prints a message: script 8 (void) { ambientsound("amb9",127); hudmessage(s:"Sacrifice accepted. Your pathway has now opened."; HUDMSG_FADEOUT, 1, CR_gray, 0.5, 0.5, 4.0, 1.0 // Time to fade to nothingness. ); Door_Open(20,32); } The problem is script 7 can still print the message even though the door is already opened. How can I cancel out script 7 when all conditions are met? Thanks guys as always!! 0 Share this post Link to post
Gez Posted April 11, 2020 script 7 (void) { ambientsound("amb9",127); hudmessage(s:"This object requires a sacrifice to open."; HUDMSG_FADEOUT, 1, CR_gray, 0.5, 0.5, 4.0, 1.0 // Time to fade to nothingness. ); } script 8 (void) { ambientsound("amb9",127); hudmessage(s:"Sacrifice accepted. Your pathway has now opened."; HUDMSG_FADEOUT, 1, CR_gray, 0.5, 0.5, 4.0, 1.0 // Time to fade to nothingness. ); Door_Open(20,32); } There are several different possibilities here. Perhaps the simplest would be with a variable. bool doorOpened = false; script 7 (void) { if (doorOpened) terminate; ambientsound("amb9",127); hudmessage(s:"This object requires a sacrifice to open."; HUDMSG_FADEOUT, 1, CR_gray, 0.5, 0.5, 4.0, 1.0 // Time to fade to nothingness. ); } script 8 (void) { doorOpened = true; ambientsound("amb9",127); hudmessage(s:"Sacrifice accepted. Your pathway has now opened."; HUDMSG_FADEOUT, 1, CR_gray, 0.5, 0.5, 4.0, 1.0 // Time to fade to nothingness. ); Door_Open(20,32); } But IMO the most elegant is to clear script 7 out of the lines that trigger it. But this require said lines to have a line ID. If your map format is UDMF, that's simple enough, with Hexen format it's more complex, you have to use special 121:Line_SetIdentification on them (instead of the ACS_Execute special that they currently have), and then have an OPEN script to attach ACS_Execute to them. But anyway, assuming your script-7-running lines have line ID 1337, then your scripts will look like this: script 7 (void) { ambientsound("amb9",127); hudmessage(s:"This object requires a sacrifice to open."; HUDMSG_FADEOUT, 1, CR_gray, 0.5, 0.5, 4.0, 1.0 // Time to fade to nothingness. ); } script 8 (void) { SetLineSpecial(1337, 0) ambientsound("amb9",127); hudmessage(s:"Sacrifice accepted. Your pathway has now opened."; HUDMSG_FADEOUT, 1, CR_gray, 0.5, 0.5, 4.0, 1.0 // Time to fade to nothingness. ); Door_Open(20,32); } And there you go, the lines are made entirely inert when the door is opened. 0 Share this post Link to post
Gunrock Posted April 12, 2020 Thanks as always Gez. It finally fixed the issue I was having throughout most of my mods in the past too. I was looking through the zdoom wiki and couldn't fully figure out about using "bool doorOpened = false;" I guess after all these years of mapping I still have much to learn ;) 0 Share this post Link to post