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


Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
lever problems
HumiliatioN Offline
Posting Freak

Posts: 1,179
Threads: 64
Joined: Dec 2010
Reputation: 18
#5
RE: lever problems

This is my script why it's not working?

SetEntityConnectionStateChangeCallback("lever_1", "L1"); // So when the player interacts with one of these levers, it calls the function to do whatever it says inside them.
SetEntityConnectionStateChangeCallback("lever_2", "L2");
SetEntityConnectionStateChangeCallback("lever_3", "L3");
SetEntityConnectionStateChangeCallback("lever_4", "L4");
}

void Correct() // This function is called when the game sees "Correct();" in the code.
{
GiveSanityBoost(); // If the player starts with 100 sanity, there will be no sanity boost visable because sanity is already at it's max.
SetSwingDoorLocked("cabinet_simple_2", false, true); // I didn't add a sound so don't be surprized and then assume it didn't work. Tongue
}
void L1(string &in asEntity, int alState)
{
if (alState == 1) // This checks to see if the player pulls the lever down, instead of up which would be -1.
{
if(GetLocalVarInt("Lev") == 3) // This checks to see if the local variable integer "Lev" equals 3.
{
SetLocalVarInt("Lev", 4);
SetEntityInteractionDisabled("lever_1", true);
SetLeverStuckState("lever_1", 1, true);
return;
}
else if (GetLocalVarInt("Lev") != 3) // If it doesn't equal, then it sets the levers interactable again and removes the stuck-ness of the levers.
{
SetLocalVarInt("Lev", 1);
for (int i = 1; i > 0 && i < 5; i++)
{
SetEntityInteractionDisabled("lever_"+i, false); // This may look advanced, but what it really is doing is simplifying it to where you don't have to set the lever's interactablility for each lever individually.
}
for (int x = 1; x > 0 && x < 5; x++)
{
SetLeverInteractionDisablesStuck("lever_"+x, true); // The easier way to say this is to do this: SetLeverInteractionDisablesStuck("lever_1", true);
} // SetLeverInteractionDisablesStuck("lever_2", true);
return; // SetLeverInteractionDisablesStuck("lever_3", true);
} // SetLeverInteractionDisablesStuck("lever_4", true);
}
}
void L2(string &in asEntity, int alState)
{
if (alState == 1)
{
if(GetLocalVarInt("Lev") == 2)
{
SetLocalVarInt("Lev", 3);
SetEntityInteractionDisabled("lever_2", true);
SetLeverStuckState("lever_2", 1, true);
return;
}
else if (GetLocalVarInt("Lev") != 2)
{
SetLocalVarInt("Lev", 1);
for (int i = 1; i > 0 && i < 5; i++)
{
SetEntityInteractionDisabled("lever_"+i, false);
}
for (int x = 1; x > 0 && x < 5; x++)
{
SetLeverInteractionDisablesStuck("lever_"+x, true);
}
return;
}
}
}
void L3(string &in asEntity, int alState)
{
if (alState == 1)
{
if(GetLocalVarInt("Lev") == 4)
{
SetLocalVarInt("Lev", 5);
SetEntityInteractionDisabled("lever_3", true);
SetLeverStuckState("lever_3", 1, true);
Correct(); // This asks for the game to call function "void Correct()" because this is the last lever that needs to be pulled.
return;
}
else if (GetLocalVarInt("Lev") != 4)
{
SetLocalVarInt("Lev", 1);
for (int i = 1; i > 0 && i < 5; i++)
{
SetEntityInteractionDisabled("lever_"+i, false);
}
for (int x = 1; x > 0 && x < 5; x++)
{
SetLeverInteractionDisablesStuck("lever_"+x, true);
}
return;
}
}
}
void L4(string &in asEntity, int alState)
{
if (alState == 1)
{
if(GetLocalVarInt("Lev") == 1)
{
SetLocalVarInt("Lev", 2);
SetEntityInteractionDisabled("lever_4", true);
SetLeverStuckState("lever_4", 1, true);
return;
}
else if (GetLocalVarInt("Lev") != 1)
{
SetLocalVarInt("Lev", 1);
for (int i = 1; i > 0 && i < 5; i++)
{
SetEntityInteractionDisabled("lever_"+i, false);
}
for (int x = 1; x > 0 && x < 5; x++)
{
SetLeverInteractionDisablesStuck("lever_"+x, true);
}
return;
}
}
}


Only lever_4 when I pushed that down its only activated one :/ and its stuck then... Help!

“Life is a game, play it”
06-30-2011, 10:35 PM
Find


Messages In This Thread
lever problems - by Dizturbed - 06-29-2011, 05:38 PM
RE: lever problems - by Kyle - 06-29-2011, 06:17 PM
RE: lever problems - by Dizturbed - 06-29-2011, 08:14 PM
RE: lever problems - by Kyle - 06-29-2011, 08:27 PM
RE: lever problems - by HumiliatioN - 06-30-2011, 10:35 PM
RE: lever problems - by Kyle - 06-30-2011, 10:39 PM
RE: lever problems - by HumiliatioN - 07-01-2011, 09:14 AM
RE: lever problems - by Kyle - 07-01-2011, 11:40 PM
RE: lever problems - by HumiliatioN - 07-02-2011, 12:08 AM
RE: lever problems - by rojkish - 07-02-2011, 12:39 AM
RE: lever problems - by Kyle - 07-02-2011, 09:59 PM



Users browsing this thread: 1 Guest(s)