////////////////////////////
// Run first time starting map
void OnStart()
{
PlayMusic("12_amb.ogg", true, 100.0, 0.0, 1, true);
AddEntityCollideCallback("Player", "AreaBangDoor", "CollideBangDoor", true, 1); //Begin the door bang and pain event
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
//////////////////////////////
//BEGIN BANG AND PAIN SOUNDS//
void CollideBangDoor(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("bangs", "05_event_door_bang", "scare_door_1", 1, false);
PlaySoundAtEntity("whineaa", "scare_whine_loop", "Player", 0.5f, false);
FadeSepiaColorTo(0.75f, 0.3f);
FadeImageTrailTo(1.5, 0.5);
AddTimer("bang1", 0.6f, "TimerBangDoor");
AddTimer("bang2", 1.6f, "TimerBangDoor");
AddTimer("bang3", 2.5f, "TimerBangDoor");
AddTimer("bang4", 3.0f, "TimerBangDoor");
}
void TimerBangDoor(string &in asTimer)
{
if(asTimer == "bang1"){
AddPropImpulse("scare_door_1", 0, 0, 5, "World");
PlaySoundAtEntity("scare", "react_scare", "Player", 0.25f, false);
CreateParticleSystemAtEntity("bang1", "ps_dust_impact_vert.ps", "scare_door_1", false);
StartScreenShake(0.008, 0.5f, 0.1f,0.3f);
GiveSanityDamage(10, true);
}
else if(asTimer == "bang2") {
AddPropImpulse("scare_door_1", 0, 0, 5, "World");
CreateParticleSystemAtEntity("bang1", "ps_dust_impact_vert.ps", "scare_door_1", false);
StartScreenShake(0.008, 0.5f, 0.1f,0.3f);
}
else if(asTimer == "bang3") {
AddPropImpulse("scare_door_1", 0, 0, 5, "World");
PlaySoundAtEntity("scare", "react_breath", "Player", 0.5f, false);
CreateParticleSystemAtEntity("bang1", "ps_dust_impact_vert.ps", "scare_door_1", false);
StartScreenShake(0.008, 0.5f, 0.1f,0.3f);
}
else {
SetSwingDoorLocked("scare_door_1", false, false);
FadeSepiaColorTo(0, 0.3f);
FadeImageTrailTo(0, 0.1);
StopSound("whineaa", 4);
}
}
//END BANG AND PAIN SOUNDS//
////////////////////////////
////////////////////////////
// Run when leaving map
void OnLeave()
{
}