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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pull lever Combination lock [Help Needed]
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: Pull lever Combination lock [Help Needed]

(05-02-2011, 11:16 AM)Simpanra Wrote: preferably something cool like a stack of shelves swivelling on an axis to reveal a door, ^_^

Hmm... I never did something like that before... But I'll try.

void OnStart()
{
SetLocalVarInt("Lev", 1);
SetEntityConnectionStateChangeCallback("lever_1", "L1");
SetEntityConnectionStateChangeCallback("lever_2", "L2");
SetEntityConnectionStateChangeCallback("lever_3", "L3");
SetEntityConnectionStateChangeCallback("lever_4", "L4");
}
void Open()
{
[Insert what you want to happen here]
}
void L1(string &in asEntity, int alState)
{
if (alState == 1)
{
if (GetLocalVarInt("Lev") == 3)
{
SetLocalVarInt("Lev", 4);
SetEntityInteractionDisabled("lever_1", true);
return;
}
else if (GetLocalVarInt("Lev") != 3)
{
SetLocalVarInt("Lev", 1);
for (int i = 1; i > 0 && i < 5; i++)
{
SetEntityInteractionDisabled("lever_"+i, false);
}
return;
}
}
}
void L2(string &in asEntity, int alState)
{
if (alState == 1)
{
if (GetLocalVarInt("Lev") == 2)
{
SetLocalVarInt("Lev", 3);
SetEntityInteractionDisabled("lever_2", true);
return;
}
else if (GetLocalVarInt("Lev") != 2)
{
SetLocalVarInt("Lev", 1);
for (int i = 1; i > 0 && i < 5; i++)
{
SetEntityInteractionDisabled("lever_"+i, false);
}
return;
}
}
}
void L3(string &in asEntity, int alState)
{
if (alState == 1)
{
if (GetLocalVarInt("Lev") == 4)
{
SetLocalVarInt("Lev", 5);
SetEntityInteractionDisabled("lever_3", true);
Open();
return;
}
else if (GetLocalVarInt("Lev") != 4)
{
SetLocalVarInt("Lev", 1);
for (int i = 1; i > 0 && i < 5; i++)
{
SetEntityInteractionDisabled("lever_"+i, false);
}
return;
}
}
}
void L4(string &in asEntity, int alState)
{
if (alState == 1)
{
if (GetLocalVarInt("Lev") == 1)
{
SetLocalVarInt("Lev", 2);
SetEntityInteractionDisabled("lever_4", true);
return;
}
else if (GetLocalVarInt("Lev") != 1)
{
SetLocalVarInt("Lev", 1);
for (int i = 1; i > 0 && i < 5; i++)
{
SetEntityInteractionDisabled("lever_"+i, false);
}
return;
}
}
}

Ask any questions on how to do it, except now I got to go to school... :/

Also, to quickly say, I would indent it all but it doesn't really work too well on the forums when I post stuff.

(This post was last modified: 05-02-2011, 11:57 AM by Kyle.)
05-02-2011, 11:39 AM
Find


Messages In This Thread
RE: Pull lever Combination lock [Help Needed] - by Kyle - 05-02-2011, 11:39 AM



Users browsing this thread: 1 Guest(s)