Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Ra02

Scripting

Recommended Posts

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

Share this post


Link to post

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.

Share this post


Link to post

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);
}
}

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×