Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Stuck at a lever script
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#2
RE: Stuck at a lever script

Ok, you're making things too complicated. All you need to do is this: create a state change callback for each lever and make them call the same function. Every time a lever changes state, it will check whether each lever is in the correct position, and if all three are correct, it will do something.

Here's a script for it:
PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever_1""LeverStateChange");
    
SetEntityConnectionStateChangeCallback("lever_2""LeverStateChange");
    
SetEntityConnectionStateChangeCallback("lever_3""LeverStateChange");
}

void LeverStateChange(string &in entityint state)
{
    if((
GetLeverState("lever_1") == 1) && (GetLeverState("lever_2") == -1) && (GetLeverState("lever_3") == -1)) {
        
// Do something
    
}


In Ruins [WIP]
03-28-2013, 05:20 PM
Find


Messages In This Thread
Stuck at a lever script - by Soskot - 03-28-2013, 04:23 PM
RE: Stuck at a lever script - by NaxEla - 03-28-2013, 05:20 PM
RE: Stuck at a lever script - by The chaser - 04-08-2013, 06:01 PM
RE: Stuck at a lever script - by NaxEla - 04-08-2013, 06:05 PM
RE: Stuck at a lever script - by Soskot - 03-28-2013, 05:54 PM
RE: Stuck at a lever script - by Soskot - 04-08-2013, 05:21 PM
RE: Stuck at a lever script - by The chaser - 04-08-2013, 06:08 PM
RE: Stuck at a lever script - by Soskot - 04-08-2013, 06:39 PM
RE: Stuck at a lever script - by The chaser - 04-08-2013, 06:55 PM
RE: Stuck at a lever script - by TheGreatCthulhu - 04-08-2013, 09:31 PM



Users browsing this thread: 1 Guest(s)