void OnStart()
{
AddEntityCollideCallback("cog_1", "Cog1", "Elevator_start", true, 1);
AddEntityCollideCallback("cog_2", "Cog2", "Elevator_start", true, 1);
AddEntityCollideCallback("cog_3", "Cog3", "Elevator_start", true, 1);
SetEntityConnectionStateChangeCallback("elevator_machine_main_lever_1", "e_lever");
SetEntityConnectionStateChangeCallback("elevator_lever_1", "ele_lever");
SetLocalVarInt("CogCount", 0); //I added this because I found out the LocalVarInt hasn't been called yet.
SetLocalVarInt("MachineryRun", 0);
}
void Elevator_start(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("CogCount", 1);
if (GetLocalVarInt("CogCount")==3)
{
SetLeverStuckState("elevator_machine_main_lever_1", 0, true);
}
}
void e_lever(string &in asEntity, int alState)
{
SetEntityActive("ScriptArea_1", true);
SetLeverStuckState("elevator_lever_1", 0, true);
RotatePropToSpeed("elevator_machine_cog_main_1", 1, 1.5, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_3", 1, 1.5, 1, 0, 0, false, "");
RotatePropToSpeed("elevator_machine_cog_small_2", 1, 1.5, 0, 0, 1, false, "");
RotatePropToSpeed("elevator_machine_cog_small_1", 1, 1.5, 0, 0, 1, false, "");
RotatePropToSpeed("cog_1", 1, 1.5, 0, 0, 1, false, "");
RotatePropToSpeed("cog_2", 1, 1.5, 0, 0, 1, false, "");
RotatePropToSpeed("cog_3", 1, 1.5, 0, 0, 1, false, "");
PlaySoundAtEntity("", "13_press_done.snt", "Player", 0, false);
PlaySoundAtEntity("", "13_machine_run_custom.snt", "elevator_machine_cog_small_2", 0, false);
AddLocalVarInt("MachineryRun", 1);
}
void ele_lever(string &in asEntity, int alState)
{
if(GetLocalVarInt("MachineryRun") == 1);
{
PlaySoundAtEntity("", "14_elevator_activate.snt", "Player", 0, false);
PlaySoundAtEntity("", "elevator_move_normal.snt", "Player", 0, false);
AddTimer("T1", 4.0f, "Timer_2");
}
}
void Timer_2(string &in asTimer)
{
ChangeMap("Dungeons_1.map", "PlayerStartArea_1", "", "");
}
void OnEnter()
{
PlayMusic("10_amb.ogg", true, 2, 2, 0, true);
}
void OnLeave()
{
}