Ok, this will be a big bit of text but it was fun making it c:
void OnStart()
{
SetLocalVarInt("DoorOpen", 0);
SetEntityConnectionStateChangeCallback("lever_simple01_1", "lever_func1");
SetEntityConnectionStateChangeCallback("lever_simple01_2", "lever_func2");
SetEntityConnectionStateChangeCallback("lever_simple01_3", "lever_func3");
SetEntityConnectionStateChangeCallback("lever_simple01_4", "lever_func4");
SetEntityConnectionStateChangeCallback("lever_simple01_5", "lever_func5");
}
void lever_func1(string &in asEntity, int alState)
{
if (alState ==1) //down
{
RemoveTimer("TooLate");
SetLeverStuckState("lever_simple01_2", 0, false);
SetLeverStuckState("lever_simple01_5", 0, false);
StopSound("ticker", 0);
StopSound("ticker2", 0);
SetLocalVarInt("DoorOpen", 0);
}
if (alState ==-1) //up
{
RemoveTimer("TooLate");
SetLeverStuckState("lever_simple01_2", 0, false);
SetLeverStuckState("lever_simple01_5", 0, false);
StopSound("ticker", 0);
StopSound("ticker2", 0);
SetLocalVarInt("DoorOpen", 0);
}
}
void lever_func2(string &in asEntity, int alState)
{
if (alState ==1) //down
{
AddTimer("1", 5, "TooLate");
PlaySoundAtEntity("ticker", "gameplay_tick_long_dist.snt", "lever_simple01_1", 0, false);
AddLocalVarInt("DoorOpen", 1);
SetLeverStuckState("lever_simple01_2", 1, false);
func_on();
}
}
void lever_func3(string &in asEntity, int alState)
{
if (alState ==1) //down
{
RemoveTimer("TooLate");
SetLeverStuckState("lever_simple01_2", 0, false);
SetLeverStuckState("lever_simple01_5", 0, false);
StopSound("ticker", 0);
StopSound("ticker2", 0);
SetLocalVarInt("DoorOpen", 0);
}
if (alState ==-1) //up
{
RemoveTimer("TooLate");
SetLeverStuckState("lever_simple01_2", 0, false);
SetLeverStuckState("lever_simple01_5", 0, false);
StopSound("ticker", 0);
StopSound("ticker2", 0);
SetLocalVarInt("DoorOpen", 0);
}
}
void lever_func4(string &in asEntity, int alState)
{
if (alState ==1) //down
{
RemoveTimer("TooLate");
SetLeverStuckState("lever_simple01_2", 0, false);
SetLeverStuckState("lever_simple01_5", 0, false);
StopSound("ticker", 0);
StopSound("ticker2", 0);
SetLocalVarInt("DoorOpen", 0);
}
if (alState ==-1) //up
{
RemoveTimer("TooLate");
SetLeverStuckState("lever_simple01_2", 0, false);
SetLeverStuckState("lever_simple01_5", 0, false);
StopSound("ticker", 0);
StopSound("ticker2", 0);
SetLocalVarInt("DoorOpen", 0);
}
}
void lever_func5(string &in asEntity, int alState)
{
if (alState ==1) //down
{
AddTimer("1", 5, "TooLate");
PlaySoundAtEntity("ticker2", "gameplay_tick_long_dist.snt", "lever_simple01_1", 0, false);
AddLocalVarInt("DoorOpen", 1);
SetLeverStuckState("lever_simple01_5", 1, false);
func_on();
}
}
void TooLate(string &in asTimer)
{
RemoveTimer("");
SetLeverStuckState("lever_simple01_2", 0, false);
SetLeverStuckState("lever_simple01_5", 0, false);
StopSound("ticker", 0);
StopSound("ticker2", 0);
SetLocalVarInt("DoorOpen", 0);
}
void func_on()
{
if (GetLocalVarInt("DoorOpen") == 2)
{
SetSwingDoorLocked("castle_1", false, false);
SetLeverStuckState("lever_simple01_1", 1, false);
SetLeverStuckState("lever_simple01_2", 1, false);
SetLeverStuckState("lever_simple01_3", 1, false);
SetLeverStuckState("lever_simple01_4", 1, false);
SetLeverStuckState("lever_simple01_5", 1, false);
GiveSanityBoost();
SetMoveObjectState("shelf",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
StopSound("ticker", 0);
StopSound("ticker2", 0);
RemoveTimer("TooLate");
}
}
For the shelf part. You need to go to
http://wiki.frictionalgames.com/hpl2/tut…nd_secretshelfs and rename the shelf you are using to shelf for this to work. All the lever names are:
lever_simple01_1
lever_simple01_2
lever_simple01_3
lever_simple01_4
lever_simple01_5
Lever 1 and 5 a true. Pulling them both down in 5 seconds (message me if you want the timer increased or decreased) will complete the quest. And Pulling any of the other ones will always reset the Variable and Timer. Enjoy