Yuki Senmatsu Posted February 23, 2015 I REALLY need to check what goes in what before posting. Well bugger. Anywho, Hi, I'm trying something new, a script where to activate a switch to restore power to a door so you can open it again. Seen other scripts, confusing as heck. Could someone please give me a example for a script like that? Thanks in advance. -Omegalore 0 Share this post Link to post
Pure Hellspawn Posted February 23, 2015 here's a little pseudocode to help. hopefully this will give a little idea bool powered = false; use door script function { if powered == false print door is not powered. must power to open electricity crackle scripts go here else open door script goes here script to possibly change indicator from red to green goes here } script for switch { if powered == false print door is now powered. you may open the door. else print door is already powered. } 0 Share this post Link to post
baja blast rd. Posted February 23, 2015 There is probably a simpler, more elegant way, but this works for me: #include "zcommon.acs" int p = 0; script 1 (void) { p++; print(s:"A door somewhere has been powered."); } script 2 (void) { if (p == 0) { print(s:"The door isn't powered!"); } else { Door_Open(0,80,0); } } I missed that you wanted to do it with a switch, but a simple "if (p == 0) / else" in script 1 could handle the distinction between not powered and already powered. Here's a simple WAD in ZDoom UDMF that demonstrates it. Try opening the door before and after killing the demon. (As that sentence alone should demonstrate, this WAD is extremely terrible.) http://www.mediafire.com/download/dgpaplfii31j8g8/scriptdemo.wad 0 Share this post Link to post
Yuki Senmatsu Posted February 23, 2015 rdwpa said:There is probably a simpler, more elegant way, but this works for me: Alright, that works great with me. Thanks. Closing thread. 0 Share this post Link to post
Recommended Posts