void OnStart()
{
AddEntityCollideCallback("Player", "EnterCreakOnArea", "FuncCreakHorrors", true, 1);
AddTimer("AreaStep_", RandFloat(3.0f,10.f), "TimerAreaStep");
AddTimer("AreaScare_", RandFloat(3.0f,10.f), "TimerAreaScare");
AddEntityCollideCallback("Player", "Suitortime", "Suitortime", true, 1);
AddUseItemCallback("", "Crowbar", "CrowbarDoor", "UseCrowbarOnDoor", true);
AddEntityCollideCallback("Joint", "AreaBreak", "BreakDoor", true, 1);
AddEntityCollideCallback("Suitor", "AreaSuitorLeaving", "SuitorLeaving", true, 1);
AddEntityCollideCallback("Suitor", "AreaSuitorHasEntered", "SuitorEntered", true, 1);
AddEntityCollideCallback("Player", "AreaStartScare", "StartScare", true, 1);
AddEntityCollideCallback("Player", "AreaShowBrute", "CollideShowBrute", true, 1);
AddEntityCollideCallback("Player", "ActiveMonster", "MonsterTime", true, 1);
AddEntityCollideCallback("Player", "AreaVoiceScene", "VoiceScene", true, 1);
AddUseItemCallback("", "UnkKey", "OpenSesame", "UseUnkKeyOnDoor", true);
AddUseItemCallback("", "RustyHammer", "padlock_1", "UseExitKeyOnDoor", true);
AddEntityCollideCallback("Player", "teleport3", "changemap", true , 1);
AddUseItemCallback("", "HollowNeed", "CellDoor", "UseHollowNeedOnDoor", true);
AddEntityCollideCallback("Player", "ChangeMusic", "ChangeMusic", false, 1);
AddEntityCollideCallback("Player", "ChangeMusic_1", "ChangeMusic2", false, 1);
}
void ChangeMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("betrayal", true, 1, 3, 0, true);
}
void ChangeMusic2(string &in asParent, string &in asChild, int alState)
{
PlayMusic("penumbra_music_E1_A9.ogg", true, 1, 3, 0, true);
}
void CrowbarDoorLocked(string &in asEntity)
{
if (GetSwingDoorLocked("CrowbarDoor") == true)
{
SetMessage("Messages", "CrowbarDoor", 0);
}
}
//--------------------------------------------
////////////////////////////////////////////////
//Use Crowbar to open door//
//////////////////////////////////////////////
//-------------------------------------------
void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");
}
void TimerPlaceCrowbar(string &in asTimer)
{
SetEntityActive("Joint", true);
PlaySoundAtEntity("", "puzzle_place_jar.snt", "Player", 0, false);
}
void BreakDoor(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Joint", false);
CompleteQuest("Givequest", "pickupcrowbar");
SetEntityActive("Broken", true);
SetSwingDoorLocked("CrowbarDoor", false, false);
SetSwingDoorClosed("CrowbarDoor", false, false);
SetSwingDoorDisableAutoClose("CrowbarDoor", true);
AddPropImpulse("CrowbarDoor", 0, 0, -3, "world");
CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect", false);
PlaySoundAtEntity("", "break_wood_metal", "AreaEffect", 0, false);
GiveSanityBoostSmall();
PlayMusic("02_puzzle.ogg", false, 0.7, 0.1, 1, false);
AddTimer("",0.1,"TimerPushDoor");
}
void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("CrowbarDoor", 4, 2, -1, "world");
AddTimer("", 1.1, "TimerDoorCanClose");
}
void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("CrowbarDoor", false);
}
//--------------------------------------------
////////////////////////////////////////////////
//Give memento and enable Suitorspawnarea when picked up crowbar//
//////////////////////////////////////////////
//-------------------------------------------
void pickitupfool(string &in asEntityName, string &in asType)
{
SetEntityActive("Suitortime", true);
AddQuest("Givequest", "pickupcrowbar");
}
void PickKey(string &in asEntityName, string &in asType)
{
SetEntityActive("ActiveMonster", true);
}
void TimerDoorForce(string &in asTimer)
{
AddPropForce("cellar_wood01_4", 0, 0, 70, "World");
AddDebugMessage("Hey!", false);
if(asTimer == "doorforce5")
StopSound("SlamDoor", 1.0f);
}
void Suitortime(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Suitor", true);
GiveSanityDamage(10, true);
AddEnemyPatrolNode("Suitor", "PathNodeArea_1",0.001f, "");
AddEnemyPatrolNode("Suitor", "PathNodeArea_8",0.001f, "");
AddEnemyPatrolNode("Suitor", "PathNodeArea_15",0.001f, "");
AddEnemyPatrolNode("Suitor", "PathNodeArea_20",0.001f, "");
AddEnemyPatrolNode("Suitor", "PathNodeArea_24",0.001f, "");
AddEnemyPatrolNode("Suitor", "PathNodeArea_28",0.001f, "");
CheckPoint ("", "PlayerStartArea_2", "CheckPoint01", "Hints", "Hint1");
}
void MonsterTime(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("waterlurker_1", true);
GiveSanityDamage(4, true);
AddEnemyPatrolNode("waterlurker_1", "PathNodeArea_52",0.001f, "");
AddEnemyPatrolNode("waterlurker_1", "PathNodeArea_56",0.001f, "");
AddEnemyPatrolNode("waterlurker_1", "PathNodeArea_59",0.001f, "");
AddEnemyPatrolNode("waterlurker_1", "PathNodeArea_62",0.001f, "");
AddEnemyPatrolNode("waterlurker_1", "PathNodeArea_63",0.001f, "");
CheckPoint ("", "PlayerStartArea_2", "CheckPoint01", "Hints", "Hint1");
}
void SuitorEntered(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("AreaSuitorLeaving", true);
}
void SuitorLeaving(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "enemy_hallucination_disappear.snt", "Player", 5.0f, false);
SetEntityActive("Suitor", false);
}
void TimerSanity(string &in asTimer)
{
GiveSanityDamage(10, true);
}
void TimerAreaStep(string &in asTimer)
{
int iRand = RandInt(1, 6);
PlaySoundAtEntity(asTimer+iRand, "scare_wood_creak_walk.snt", asTimer+iRand, 1, false);
AddTimer("EndRadial", 4.0f, "TimerEndRadial");
AddTimer(asTimer, RandFloat(15.0f, 30.0f), "TimerAreaStep");
}
void TimerAreaScare(string &in asTimer)
{
int iRand = RandInt(1, 6);
PlaySoundAtEntity(asTimer+iRand, "scare_male_terrified.snt", asTimer+iRand, 1, false);
AddTimer("EndRadial", 4.0f, "TimerEndRadial");
AddTimer(asTimer, RandFloat(15.0f, 30.0f), "TimerAreaScare");
}
void StartScare(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("gruntgruff", "scare_male_terrified", "AreaStartScare", 0.0f, false);
AddTimer("sanity", 1, "TimerSanity");
PlaySoundAtEntity("", "scare_whine_loop4.snt", "Player", 5.0f, false);
PlaySoundAtEntity("", "general_wind_whirl", "AreaScare_4", 5.0f, false);
CreateParticleSystemAtEntity("", "ps_dust_paper_blow.ps", "AreaScare_4", false);
}
void PickKey(string &in asEntityName, string &in asType)
{
SetEntityActive("AreaShowBrute", true);
ResetProp("cellar_wood01_5");
AddPlayerSanity(3);
}
////////////////////////////////////////
// Suitor Appears
void CollideShowBrute(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("cellar_wood01_5", 0);
GiveSanityDamage(10, true);
ShowEnemyPlayerPosition("enemy_suitor_1");
SetEntityActive("enemy_suitor_1", true);
}
void EntityCallPickDiary(string &in asEntity, string &in type)
{
AddLocalVarInt("DiaryNr", 1);
if(GetLocalVarInt("DiaryNr") == 1)
PlayMusic("03_paper_village.ogg",false, 0.7f, 0.1f, 9, false);
AddEffectVoice("voices", "VoiceScene2.ogg", "Voice", "OhFather",
false, "Player", 1, 1);
}
void KeyDoorLocked2(string &in asEntity)
{
if (GetSwingDoorLocked("OpenSesame") == true)
{
SetMessage("Messages", "OpenSesame", 0);
}
}
void KeyDoorNeeded(string &in asEntity)
{
if (GetSwingDoorLocked("DoorExit") == true)
{
SetMessage("Messages", "KeyDoorNeeded", 0);
}
}
void UseUnkKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("OpenSesame", false, true);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
RemoveItem(asItem);
CompleteQuest("cellar_wood01_8", "SimpleLock");
}
void UseExitKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("DoorExit", false, true);
SetPropActiveAndFade("padlock_1", false, 2.0f);
PlaySoundAtEntity("", "break_wood_metal.snt", asEntity, 0, false);
CreateParticleSystemAtEntity("ps", "ps_break_wood_small.ps", "padlock_1", false);
AddPlayerSanity(2);
SetEntityActive("ScriptArea_1", true);
}
void BudgeLocked(string &in asEntity)
{
if (GetSwingDoorLocked("cellar_wood01_9") == true)
{
SetMessage("Messages", "Budge", 0);
}
}
void BudgeLocked2(string &in asEntity)
{
if (GetSwingDoorLocked("cellar_wood01_5") == true)
{
SetMessage("Messages", "Budge", 0);
}
}
void BudgeLocked3(string &in asEntity)
{
if (GetSwingDoorLocked("cellar_wood01_7") == true)
{
SetMessage("Messages", "Budge", 0);
}
}
void Dontgoback(string &in asEntity)
{
if (GetSwingDoorLocked("Cantgoback") == true)
{
SetMessage("Messages", "Cantgoback", 0);
}
}
void VoiceScene(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("VoiceScene", 1.0, 1.0, "");
AddEffectVoice("voices", "VoiceScene1.ogg", "Voice", "OhMan",
false, "VoiceScene", 1, 1);
AddTimer("StopHeadMove2", 4, "TimerStopHeadMove2");
}
void TimerStopHeadMove2(string &in asTimer)
{
StopPlayerLookAt();
}
void TouchPainting(string &in asEntity)
{
AddNote("BloodyPaintings", "");
SetMessage("Messages", "Note1", 0);
PlayGuiSound("journal_page.ogg", 1);
}
void OnEnter()
{
PlayMusic("penumbra_music_E1_A9", true, 1, 5, 0, true);
}
void OnLeave()
{
}