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
Machine Lever Problem...
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
RE: Machine Lever Problem...

Here's one way of doing it (warning: this code is untested):

PHP Code: (Select All)
// up, up, down, up, down, up
const int[] complex_lever_states = {-1, -1, 1, -1, 1, -1};

void OnStart()
{
    for (
int i = 1; i < 7; ++i)
        
SetEntityConnectionStateChangeCallback("L"+i, "ComplexLeverPuzzle");
}

void ComplexLeverPuzzle(string &in entity, int state)
{
    
SetLocalVarInt("ComplexLever_"+entity, state);
    
CheckComplexLeverStates();
}

void CheckComplexLeverStates()
{
    for (
int i = 1; i < 7; ++i)
    {
        if (
GetLocalVarInt("ComplexLever_L"+i) != complex_lever_states[i-1])
            return;
    }

    
SetEntityActive("ShardDoor", false);
    
GiveSanityBoost();
    
PlayMusic("02_puzzle.ogg", false, 0.7f, 0, 10, false);
    
PlaySoundAtEntity("door_safety_open", "door_safety_open.snt", "Player", 0.0f, false);
} 

Tutorials: From Noob to Pro
12-06-2011, 04:29 AM
Website Find


Messages In This Thread
Machine Lever Problem... - by sasukeroxxx - 11-29-2011, 11:57 PM
RE: Machine Lever Problem... - by flamez3 - 11-30-2011, 01:56 AM
RE: Machine Lever Problem... - by GreyFox - 11-30-2011, 03:55 AM
RE: Machine Lever Problem... - by flamez3 - 11-30-2011, 04:44 AM
RE: Machine Lever Problem... - by sasukeroxxx - 12-05-2011, 08:48 PM
RE: Machine Lever Problem... - by flamez3 - 12-06-2011, 03:49 AM
RE: Machine Lever Problem... - by Your Computer - 12-06-2011, 04:29 AM
RE: Machine Lever Problem... - by sasukeroxxx - 12-07-2011, 04:42 AM



Users browsing this thread: 1 Guest(s)