void OnStart()
{
AddUseItemCallback("", "castlekey1", "castle_1", "UsedKeyOnDoor", true);
PlaySoundAtEntity("ambience", "amb_guardian.ogg", "Player", 0 ,false);
AddEntityCollideCallback("Player", "scr_playsound", "PlayGrowl", true, 1);
AddEntityCollideCallback("Player", "scr_scare", "LoudGrowl", true, 1);
AddEntityCollideCallback("Player", "scr_spawngrunt", "SpawnDoorGrunt", true, 1);
SetEntityPlayerLookAtCallback("haunt_door", "ScaryDoor", true);
SetEntityPlayerInteractCallback("potion_sanity_1", "Creepy", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("castlekey1");
AutoSave();
}
void PlayGrowl(string &in asParent, string &in asChild, int alState)
{
PlayMusic("enabled02.ogg", false, 0.8, 2, 0, true);
}
void LoudGrowl(string &in asParent, string &in asChild, int alState)
{
PlayMusic("metal_walk08.ogg", false, 1.0, 2, 0, true);
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0.0f, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0.0f, "");
}
void SpawnDoorGrunt(string &in asParent, string &in asChild, int alState)
{
PlayMusic("enabled02.ogg, false, 0.9, 2, 0, true);
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.0f, "");
}
void ScaryDoor(string &in entity, int alState)
{
PlayMusic("break_wood1.ogg", false, 30.0, 2, 1, true);
CreateParticleSystemAtEntity("door_explosion", "ps_hit_wood.ps", "haunt_door", true);
AddPropImpulse("haunt_door", -12, 8, -92, "world");
}
void Creepy(string &in asParent, string &in asChild, int alState)
{
PlayMusic("general_wind_whirl1.ogg", false, 1.0, 2, 0, true);
SetLampLit("candlestick02_2", false, true);
SetLampLit("torch_static01_21", false, true);
SetLampLit("torch_static01_20", false, true);
SetLampLit("torch_static01_24", false, true);
SetLampLit("torch_static01_25", false, true);
}