Ra02 Posted December 7, 2009 Hi all, I want to make a script that will require 2 switches to be activated to deactivate a forcefield. I thought making int forcefld and then if (forcefld == 0) and (forcefld == 1) but I want to do a thing that it won't depend which switch you activate both will do 1. How can I do that. E.g. you activate one of those switches and it will say: 1 more to go, then you activate the 2nd (independently) and it will say: Forcefield is deactivated. Thanks 0 Share this post Link to post
Patrick Posted December 7, 2009 here's a rough pseudocode example of how to do this: //This script should be called when the player tries to pass or use the forcefield global int i_check = 0; func forcefield () { if (int i_check <= 2) { print "You need 2 switches to open this object"; elseif (i_check == 1) then print "1 more to go"; else print "forcefield inactive"; open_door(tid); //or whatever script opens your forcefield } } for each switch, you'd need something like this: //associate this script with each switch in question func open_forcefield() { i_check = i_check+1; } I can provide an example when I have time to make this (probably later today) This is only pseudocode, so you'll need to convert it to ACS. That shouldn't be too hard since the syntax is very similar if not the same. 0 Share this post Link to post
Ra02 Posted December 9, 2009 thanks for help but I've figured it out thanks to Cheogsh.. int forcefld; Script 1 (void) { forcefld = forcefld +1; } Script 2 (void) { if (forcefld == 0) { print(s:"Forcefield is on"); } if (forcefld == 1) { print(s:"1 more to go"); } if (forcefld == 2) { setlinetexture(1, SIDE_FRONT, TEXTURE_MIDDLE, "-"); setlinetexture(1, SIDE_BACK, TEXTURE_MIDDLE, "-"); setlineblocking(1, OFF); } } 0 Share this post Link to post