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
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#5
RE: Stuck at a lever script

(03-28-2013, 05:20 PM)NaxEla Wrote: 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 asEntityint alState)
{
    if((
GetLeverState("lever_1") == 1) && (GetLeverState("lever_2") == -1) && (GetLeverState("lever_3") == -1)) {
        
// Do something
    
}


Fixed. There was "int state" instead "int alState".
Try if it works now, Soskot Wink

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
(This post was last modified: 04-08-2013, 06:01 PM by The chaser.)
04-08-2013, 06:01 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)