(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.