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.
}
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!