////////////////////////////
// Run first time starting map
void OnStart()
{
InteractConnectPropWithMoveObject("wheeltodoor2", "valve_iron_1", "safety_normal_vert_1", true, false, 0);
SetEntityInteractionDisabled("level_hub_1", true);
Anter();
PlaySoundAtEntity("cat", "react_breath_loop.snt", "soundarea", 0, false);
AddEntityCollideCallback("Player", "ScriptArea_4", "breakvalve", true, 1);
SetEntityConnectionStateChangeCallback("lever_1", "StoreCheckLeverState");
SetEntityConnectionStateChangeCallback("lever_2", "StoreCheckLeverState");
SetEntityConnectionStateChangeCallback("lever_3", "StoreCheckLeverState");
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_7", "CollideAreaBreakWall", true, 1);
}
void Anter()
{
SetPlayerActive(false);
StartPlayerLookAt("ScriptArea_1", 2.0f, 2.0f, "");
AddTimer("scare_timer", 1.0f, "scarestart");
SetMoveObjectState("safety_normal_vert_2", 1);
}
void scarestart(string &in asTimer)
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2.0f, 2.0f, "");
AddTimer("scere_timer", 1.0f, "scerestert");
}
void scerestert(string &in asTimer)
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_3", 2.0f, 2.0f, "");
AddTimer("score_timer", 1.0f, "scorestert");
}
void scorestert(string &in asTimer)
{
StopPlayerLookAt();
StartPlayerLookAt("AreaPushDownBar", 2.0f, 2.0f, "");
AddTimer("scire_timer", 1.0f, "scirestert");
}
void scirestert(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
SetEntityPlayerInteractCallback("door_barricade_1", "Baric", true);
StopSound("cat", 2);
AddTimer("", 15.0f, "begin");
}
void Baric(string &in asEntity)
{
SetSwingDoorClosed("door_barricade_1", true, true);
AddTimer("", 0.5f, "Timer_LockBarricade");
}
void Timer_LockBarricade(string &in asTimer)
{
SetEntityInteractionDisabled("door_barricade_1", true);
SetEntityActive("door_barricade_1", false);
SetEntityActive("door_barricade_locked_1", true);
PlaySoundAtEntity("", "lock_door.snt", "Area_BarricadeLockDust", 0.0f, false);
CreateParticleSystemAtEntity("", "ps_hit_dirt.ps", "Area_BarricadeLockDust", false);
CreateParticleSystemAtEntity("", "ps_hit_metal.ps", "Area_BarricadeLockDust", false);
}
void begin(string &in asTimer)
{
CheckPoint ("RunCheckpoint", "PlayerStartArea_3", "restart", "RunAway", "Running");
PlaySoundAtEntity("", "guardian_ontop.snt", "level_hub_1", 0.0f, false);
AddTimer("", 1.6f, "TimerDeorPound");
SetMessage("Messages", "escape", 5.0f);
PlayMusic("search_brute.ogg", true, 5, 0, 0.5f, true);
PlayMusic("29_amb_end_intense.ogg", true, 5, 0, 0.5f, true);
}
void restart(string &in asName, int alCount)
{
SetEntityActive("rock_small_moveable", false);
SetEntityActive("valve_iron_rusty_breakable_1", false);
SetEntityActive("valve_iron_rusty_breakable_2", true);
SetEntityActive("rock_lock_static_1", true);
ResetProp("rock_small_moveable");
AddPropHealth("valve_iron_rusty_breakable_1", 100);
AddPropHealth("valve_iron_rusty_breakable_2", 100);
SetPropHealth("valve_iron_rusty_breakable_1", 100);
SetPropHealth("valve_iron_rusty_breakable_2", 100);
ResetProp("rock_lock_static_1");
ResetProp("valve_iron_rusty_breakable_2");
ResetProp("valve_iron_rusty_breakable_1");
AddTimer("rebeggining", 5.0f, "begin");
AddEntityCollideCallback("Player", "ScriptArea_4", "breakvalve", true, 1);
}
void TimerDeorPound(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer02", 1.5f, "StopLeok");
}
void StopLeok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer03", 1.4f, "StopLaok");
}
void StopLaok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer04", 1.3f, "StopLiok");
}
void StopLiok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer05", 1.2f, "StopLuok");
}
void StopLuok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer06", 1.1f, "StopLpok");
}
void StopLpok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer07", 1.0f, "StopLtok");
}
void StopLtok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer08", 0.9f, "StopLqok");
}
void StopLqok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer09", 0.8f, "StopLkok");
}
void StopLkok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer10", 0.7f, "StopLyok");
}
void StopLyok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust","ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer11", 0.6f, "StopLhok");
}
void StopLhok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer12", 0.5f, "StopLsok");
}
void StopLsok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer13", 0.4f, "StopLbok");
}
void StopLbok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer14", 0.3f, "StopLgok");
}
void StopLgok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer15", 0.2f, "StopLxok");
}
void StopLxok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer16", 0.1f, "StopLwok");
}
void StopLwok(string& asTimer)
{
PlaySoundAtEntity("puund", "hit_wood", "ScriptArea_3", 0, false);
PlaySoundAtEntity("puund", "25_guardian_activated.snt", "ScriptArea_3", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_3", false);
AddTimer("timer17", 1.0f, "daad");
}
void daad(string& asTimer)
{
CreateParticleSystemAtEntity("pind_dust", "ps_dust_falling_hole", "DA1", false);
CreateParticleSystemAtEntity("p9ind_dust", "ps_dust_falling_hole", "DA2", false);
CreateParticleSystemAtEntity("pi5nd_dust", "ps_dust_falling_hole", "DA2_1", false);
CreateParticleSystemAtEntity("pin2d_dust", "ps_dust_falling_hole", "DA2_2", false);
CreateParticleSystemAtEntity("pind1_dust", "ps_dust_falling_hole", "DA2_3", false);
CreateParticleSystemAtEntity("pind_4dust", "ps_dust_falling_hole", "DA2_4", false);
CreateParticleSystemAtEntity("pind_d4ust", "ps_dust_falling_hole", "DA2_5", false);
CreateParticleSystemAtEntity("pind_du7st", "ps_dust_falling_hole", "DA2_6", false);
CreateParticleSystemAtEntity("pind_dus3t", "ps_dust_falling_hole", "DA2_7", false);
CreateParticleSystemAtEntity("pind_dust", "ps_dust_falling_hole", "DA2_8", false);
CreateParticleSystemAtEntity("8pind_dust", "ps_dust_falling_hole", "DA2_9", false);
CreateParticleSystemAtEntity("p5ind_dust", "ps_dust_falling_hole", "DA2_10", false);
CreateParticleSystemAtEntity("pind_dust", "ps_cave_monster_scream", "ScriptArea_5", false);
PlaySoundAtEntity("papo", "explosion_rock_large.snt", "level_hub_1", 0, false);
SetPropHealth("level_hub_1", 0);
SetPropHealth("door_barricade_locked_1", 0);
CreateParticleSystemAtEntity("stuff","ps_break_wood","ScriptArea_3", false);
CreateParticleSystemAtEntity("stufo","ps_break_wood","ScriptArea_3", false);
CreateParticleSystemAtEntity("stufi","ps_break_wood","ScriptArea_3", false);
AddTimer("timerdie", 2.5f, "dead");
}
void lookatvalve(string& asTimer)
{
RemoveTimer("timerdie");
StopPlayerLookAt();
StartPlayerLookAt("rock_lock_static_1", 2.0f, 2.0f, "");
AddTimer("timer21", 0.5f, "lookatrock");
AddTimer("timer22", 0.5f, "rockbreak1");
}
void dead(string& asTimer)
{
AddTimer("", 5.0f, "govalvekill");
SetEntityActive("castle_silent_1", true);
AddEntityCollideCallback("castle_silent_1", "ScriptArea_6", "youdie", true, 1);
}
void govalvekill(string& asTimer)
{
AddTimer("", 2.0f, "valvekill");
AddTimer("", 3.9f, "valvekill");
AddTimer("", 5.7f, "valvekill");
AddTimer("", 7.5f, "valvekill");
AddTimer("", 9.3f, "valvekill");
AddTimer("", 11.0f, "valvekill");
AddTimer("", 12.5, "valvekill");
AddTimer("", 13.9f, "valvekill");
AddTimer("", 15.1f, "valvekill");
AddTimer("", 16.3f, "valvekill");
AddTimer("", 18.0f, "valvekill");
AddTimer("", 20.0f, "finalvalvekill");
}
void youdie(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("puund", "attack_claw_hit.snt", "Player", 0, false);
GivePlayerDamage(100, "Slash", true, true);
}
void breakvalve(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ScriptArea_6", false);
SetPlayerCrouching(false);
SetPlayerActive(false);
StartPlayerLookAt("valve_iron_rusty_breakable_1", 2.0f, 2.0f, "");
StartPlayerLookAt("valve_iron_rusty_breakable_2", 2.0f, 2.0f, "");
AddTimer("timer20", 1.0f, "lookatvalve");
}
void rockbreak1(string& asTimer)
{
SetEntityActive("rock_lock_static_1", false);
SetEntityActive("rock_lock_static_2", true);
AddTimer("", 0.001f, "rockbreak2");
}
void rockbreak2(string& asTimer)
{
SetEntityActive("rock_lock_static_2", false);
SetEntityActive("rock_lock_static_3", true);
AddTimer("", 0.001f, "rockbreak3");
}
void rockbreak3(string& asTimer)
{
SetEntityActive("rock_lock_static_3", false);
SetEntityActive("rock_lock_static_4", true);
AddTimer("", 0.001f, "rockbreak4");
}
void rockbreak4(string& asTimer)
{
SetEntityActive("rock_lock_static_4", false);
SetEntityActive("rock_lock_static_5", true);
AddTimer("", 0.001f, "rockbreak5");
}
void rockbreak5(string& asTimer)
{
SetEntityActive("rock_lock_static_5", false);
SetEntityActive("rock_lock_static_6", true);
AddTimer("", 0.001f, "rockbreak6");
}
void rockbreak6(string& asTimer)
{
SetEntityActive("rock_lock_static_6", false);
SetEntityActive("rock_lock_static_7", true);
SetPropHealth("valve_iron_rusty_breakable_1", 0);
SetPropHealth("valve_iron_rusty_breakable_2", 0);
CreateParticleSystemAtEntity("stufp","ps_break_pottery","valve_iron_rusty_breakable_1", false);
CreateParticleSystemAtEntity("stufp","ps_break_pottery","valve_iron_rusty_breakable_2", false);
SetPlayerActive(true);
AddTimer("", 0.001f, "rockbreak8");
}
void lookatrock(string& asTimer)
{
StopPlayerLookAt();
StartPlayerLookAt("valve_iron_rusty_breakable_1", 1.0f, 1.0f, "");
StartPlayerLookAt("valve_iron_rusty_breakable_2", 1.0f, 1.0f, "");
AddTimer("", 1.0f, "rockbreak7");
}
void rockbreak7(string& asTimer)
{
StopPlayerLookAt();
}
void rockbreak8(string& asTimer)
{
SetEntityActive("rock_lock_static_7", false);
SetEntityActive("rock_small_moveable", true);
AddTimer("", 0.01f, "rockbreak9");
}
void rockbreak9(string& asTimer)
{
AddPropImpulse("valve_iron_rusty_breakable_1", 0, 0, -0.5f, "world");
AddPropImpulse("valve_iron_rusty_breakable_2", 0, 0, -0.5f, "world");
}
void valvekill(string& asTimer)
{
PlaySoundAtEntity("pu9nd", "hit_wood", "Player", 0, false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_13", false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_14", false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_15", false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_16", false);
CreateParticleSystemAtEntity("puund_dust", "ps_hit_wood", "ScriptArea_17", false);
AddPropImpulse("safety_normal_vert_1", -2, 0, 0, "World");
}
void finalvalvekill(string& asTimer)
{
CreateParticleSystemAtEntity("pind_dust", "ps_dust_falling_hole", "ScriptArea_13", false);
CreateParticleSystemAtEntity("p9ind_dust", "ps_dust_falling_hole", "ScriptArea_14", false);
CreateParticleSystemAtEntity("pi5nd_dust", "ps_dust_falling_hole", "ScriptArea_15", false);
CreateParticleSystemAtEntity("pin2d_dust", "ps_dust_falling_hole", "ScriptArea_16", false);
CreateParticleSystemAtEntity("pind1_dust", "ps_dust_falling_hole", "ScriptArea_17", false);
CreateParticleSystemAtEntity("pind_4dust", "ps_dust_falling_hole", "ScriptArea_18", false);
CreateParticleSystemAtEntity("pind_d4ust", "ps_dust_falling_hole", "ScriptArea_19", false);
CreateParticleSystemAtEntity("pind_du7st", "ps_dust_falling_hole", "ScriptArea_20", false);
CreateParticleSystemAtEntity("pind_dus3t", "ps_dust_falling_hole", "ScriptArea_21", false);
CreateParticleSystemAtEntity("pind_dust", "ps_dust_falling_hole", "ScriptArea_22", false);
CreateParticleSystemAtEntity("8pind_dust", "ps_dust_falling_hole", "ScriptArea_23", false);
CreateParticleSystemAtEntity("p5ind_dust", "ps_dust_falling_hole", "ScriptArea_24", false);
CreateParticleSystemAtEntity("p5ind_dust", "ps_dust_falling_hole", "ScriptArea_25", false);
CreateParticleSystemAtEntity("p5ind_dust", "ps_dust_falling_hole", "ScriptArea_26", false);
CreateParticleSystemAtEntity("p5ind_dust", "ps_dust_falling_hole", "ScriptArea_27", false);
CreateParticleSystemAtEntity("pind_dust", "ps_cave_monster_scream", "ScriptArea_28", false);
PlaySoundAtEntity("papo", "explosion_rock_large.snt", "Player", 0, false);
SetPropHealth("safety_normal_vert_1", 0);
CreateParticleSystemAtEntity("stuff","ps_break_wood","ScriptArea_13", false);
CreateParticleSystemAtEntity("stufo","ps_break_wood","ScriptArea_13", false);
CreateParticleSystemAtEntity("stufi","ps_break_wood","ScriptArea_13", false);
SetEntityActive("castle_silent_2", true);
AddEntityCollideCallback("castle_silent_2", "ScriptArea_11", "valvedie", true, 1);
}
void valvedie(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("puund", "attack_claw_hit.snt", "Player", 0, false);
GivePlayerDamage(100, "Slash", true, true);
}
void CheckLeverStates()
{
if (GetLocalVarInt("lever_1") == 1
&& GetLocalVarInt("lever_2") == -1
&& GetLocalVarInt("lever_3") == 1)
{
PerformLeverTaskCompleted();
}
}
void StoreCheckLeverState(string &in entity, int state)
{
SetEntityActive("ScriptArea_11", false);
SetLocalVarInt(entity, state);
CheckLeverStates();
}
void PerformLeverTaskCompleted()
{
SetMoveObjectState("safety_normal_vert_2", 0);
}
void CollideAreaBreakWall(string &in asParent, string &in asChild, int alState)
{
StopMusic(3.0, 0.5f);
StartScreenShake(0.20f, 5.0f, 1.0f, 5.0f);
SetPlayerActive(false);
AddPlayerSanity(25);
SetLocalVarInt("Door", 1);
AddTimer("", 3.0f, "WallCrash");
}
void WallCrash(string& asTimer)
{
SetEntityActive("rock_debris01_1", true);
SetEntityActive("rock_debris01_2", true);
SetEntityActive("rock_debris01_3", true);
PlaySoundAtEntity("cave", "29_cave_in.snt", "ScriptArea_10", 0, false);
StartPlayerLookAt("ScriptArea_9", 1.0f, 1.0f, "");
CreateParticleSystemAtEntity("stufp","ps_dust_drilling", "ScriptArea_9", false);
CreateParticleSystemAtEntity("stufp","ps_dust_drilling", "ScriptArea_8", false);
AddTimer("", 3.0f, "WallCrish");
AddTimer("", 1.0f, "WallCresh");
AddTimer("", 2.0f, "WallCrush");
}
void WallCresh(string& asTimer)
{
SetEntityActive("rock_debris03_2", true);
SetEntityActive("rock_debris01_4", true);
PlaySoundAtEntity("ceve", "29_cave_in.snt", "ScriptArea_8", 0, true);
}
void WallCrush(string& asTimer)
{
SetEntityActive("rock_debris03_3", true);
SetEntityActive("rock_debris01_5", true);
PlaySoundAtEntity("cive", "29_cave_in.snt", "ScriptArea_9", 0, true);
}
void WallCrish(string& asTimer)
{
SetEntityActive("rock_debris_brown02_1", true);
SetEntityActive("rock_debris02_1", true);
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_8", 1.0f, 1.0f, "");
AddTimer("", 3.0f, "WallCrpsh");
}
void WallCrpsh(string& asTimer)
{
SetEntityActive("rock_debris03_1", true);
SetEntityActive("rock_debris_brown02_2", true);
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_10", 1.0f, 1.0f, "");
FadeOut(1.0f);
SetEntityActive("crowbar_joint_1", false);
StopSound("cave", 3.0f);
StopSound("cive", 3.0f);
StopSound("ceve", 3.0f);
PlaySoundAtEntity("crve", "explosion_rock_large.snt", "ScriptArea_9", 0, true);
AddTimer("", 3.0f, "WallCrqsh");
}
void WallCrqsh(string& asTimer)
{
StopPlayerLookAt();
TeleportPlayer("StartCrash");
SetEntityActive("cave_in_1", true);
FadeIn(5.0f);
AddTimer("", 3.0f, "WallCrgsh");
SetEntityActive("crowbar_1", true);
}
void WallCrgsh(string& asTimer)
{
SetMessage("Messages", "Escaped", 5.0f);
SetPlayerActive(true);
}
void OnLeave()
{
}