Doom_Dude1278 Posted July 28, 2016 script 1 (int sw1, sw2, sw3) { // If all three switches have been thrown, // then activate the radiation leak. if (sw1 && sw2 && sw3) Sector_SetDamage (1, 50, MOD_LAVA); // Turn off the radiation leak. else Sector_SetDamage (1, 0, MOD_WATER); } i saw this off the zdoom wiki tutorials my question/what i dont get is how does this script work as sw1 , sw2 , sw3 isnt a tag so how would this work? thanks 0 Share this post Link to post
scifista42 Posted July 28, 2016 "sw1, sw2, sw3" are arguments of the script. When the script is called, it's always called with specific values as arguments. "sw1, sw2, sw3" within the script will be substituted by these specific values. "if (sw1 && sw2 && sw3)" means "if sw1 is a non-zero value, and sw2 is a non-zero value, and sw3 is a non-zero value, then...". 0 Share this post Link to post
Doom_Dude1278 Posted July 28, 2016 ok i see what ur saying like when it says sw1 it looks for sw1 tag if its not zero but what im saying is how does it know what sw1 is i mean there could be 5 switches how does it know which one is sw1? 0 Share this post Link to post
scifista42 Posted July 28, 2016 Arguments are just numbers. They do not have any inherent relation with tags, nor with switches or any other objects within the map. Their values depend on the values with which the script was called. When you have a script:script 1 (int sw1, sw2, sw3) { ... } And you call it for example this way:ACS_Execute(1,0,15,29,200); Then an instance of the script will start running, and in this instance, "sw1" will have value "15", "sw2" will have value "29", and "sw3" will have value "200". The names "sw1, sw2, sw3" are completely arbitrary. You could have named the arguments anything you wanted, for example "x, y, z". 0 Share this post Link to post
Doom_Dude1278 Posted July 29, 2016 ok so im geting that the script will only do something when something happens that makes all 3 sw's = 0 my final question is how would this make a door requiring the use of 3 switches as its not linked to anything on map? thanks youve been some good help 0 Share this post Link to post
scifista42 Posted July 29, 2016 I would do it this way instead:#include "zcommon.acs" int countSwitches = 0; script 1 (void) { countSwitches++; if(countSwitches==3) { Door_Open(...); } } Make script 1 be executed (non-repeatably) by each of the 3 switches. No arguments are needed here at all. 0 Share this post Link to post
Doom_Dude1278 Posted July 29, 2016 ah now thats clever I dont know why i didnt think of that. thanks for the help matey 0 Share this post Link to post