void OnStart()
{
SetLocalVarInt("UnlockedDoor", 1);
AddEntityCollideCallback("Player", "KeyFall", "KeyFalling",true,1);
AddEntityCollideCallback("Player", "CloseHatch", "CollideSwing", true, 1);
AddEntityCollideCallback("Player", "cellar_wood01_1","WaterLurker", false, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "Infected", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "StatueScare", true,1);
AddEntityCollideCallback("Player", "Scare1", "InsaneStarePortrait",true,1);
AddEntityCollideCallback("corpse_male_arm_1", "HandUnlock", "UnlockDoor", true, 1);
AddEntityCollideCallback("Player","Script_05","Inked",true,1);
AddEntityCollideCallback("Player","ScriptArea_3", "DoorOpenScare",false,1);
AddUseItemCallback("", "key_study_1", "hatch_metal01_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "LevelKey", "level_hub_1", "UsedKeyOnDoor",true);
AddUseItemCallback("", "DoorKey2", "level_hub_1", "UsedKeyOnDoor",true);
SetEntityActive("deformed_man_2",false);
GiveItemFromFile("lantern", "lantern.ent");
for(int i=19; i<81; i++)
{
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_"+i, 0.1f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_"+i, 0.0f, "");
}
}
void DoorOpenScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("prison_silent_1",false);
}
void UnlockDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorLocked("mansion_3",false,true);
AddPropImpulse("mansion_3",0,400,0,"");
}
void InsaneStarePortrait(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("insane_portrait", true);
CreateParticleSystemAtEntity("PSDustPainting", "ps_ghost_release.ps", "insane_portrait", false);
StartPlayerLookAt("insane_portrait", 10, 100, "");
PlaySoundAtEntity("snd_scare", "react_scare.snt", "Player", 0.0, false);
GiveSanityDamage(10, true);
FadeImageTrailTo(3, 1);
FadeSepiaColorTo(5, 1);
FadePlayerFOVMulTo(0.7, 0.05);
AddTimer("insane_portraitON", 0.5f, "TimerInsPortrait");
}
void TimerResetPlayer(string &in asTimer)
{
ChangePlayerStateToNormal();
StopPlayerLookAt();
FadeImageTrailTo(0, 1);
FadeSepiaColorTo(0, 1);
//FadeRadialBlurTo(0, 1);
FadePlayerFOVMulTo(1, 0.01f);
SetPlayerMoveSpeedMul(1);
SetPlayerRunSpeedMul(1);
SetPlayerLookSpeedMul(1);
}
void TimerInsPortrait(string &in asTimer)
{
if (asTimer == "insane_portraitOFF")
{
SetEntityActive("insane_portrait", false);
DestroyParticleSystem("PSDustPainting");
FadeIn(1);
StopPlayerLookAt();
AddTimer("timerReset", 1.0f, "TimerResetPlayer");
}
else
{
FadeOut(1);
AddTimer("insane_portraitOFF", 1.5f, "TimerInsPortrait");
}
}
void StatueScare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("deformed_man_2",true);
StartPlayerLookAt("LookAt_1",5,5,"");
GiveSanityDamage(20,true);
AddTimer("",1.0f,"StopLook");
}
void Infected(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1",true);
SetEntityActive("FogArea_1",true);
StartPlayerLookAt("servant_brute_1",5,5,"");
SetMessage("Messages","msg05",5.0f);
AddTimer("",1.0f,"StopLook");
SetSwingDoorClosed("mansion_3",true,true);
SetSwingDoorLocked("mansion_3",true,true);
}
void StopLook(string &in asTimer)
{
StopPlayerLookAt();
SetEntityActive("deformed_man_2",false);
}
void WaterLurker(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("waterlurker_1",true);
}
void KeyFalling(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("key_study_1",true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
if(asEntity == "level_hub_1") {
if(GetLocalVarInt("UnlockedDoor") == 0) {
StartCredits("",false,"Credits","Credits",5);
}
else {
AddLocalVarInt("UnlockedDoor",-1);
RemoveItem(asItem);
return;
}
}
SetSwingDoorLocked(asEntity,false,true);
PlaySoundAtEntity("","unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
void CollideSwing(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("hatch_metal01_1", true, true);
SetSwingDoorLocked("hatch_metal01_1", true, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}