void OnStart()
{
AddUseItemCallback("", "Key123", "Door123", "UseKeyOnDoor", true);
AddUseItemCallback("", "Study123", "Doors122", "UseKeyOnDoor2", true);
AddEntityCollideCallback("Player", "SoundArea", "crossarea", true, 1);
SetEntityPlayerInteractCallback("Tomby1", "ActivateMonster", true);
AddEntityCollideCallback("Player", "area1", "Open_Door", true, 1);
AddEntityCollideCallback("Player", "Look2", "LookBack", true, 1);
AddUseItemCallback("", "Tomby1", "Wooden", "UseKeyOnDoor3", true);
AddEntityCollideCallback("Player", "LightScript", "lightsdown", true, 1);
AddEntityCollideCallback("Player", "LookDoooor1", "LookBack2", true, 1);
SetEntityPlayerInteractCallback("Tower1", "ActivateMonster2", true);
AddUseItemCallback("", "Torture12", "Door32", "UseKeyOnDoor4", true);
AddEntityCollideCallback("Player", "Text", "Omgtext", true, 1);
FadeOut(0);
FadePlayerRollTo(65, 20, 20);
MovePlayerHeadPos(-1, -0.45, -1.1, 20, 1);
AddTimer("ActivatePlayer", 3, "WakeUp");
SetLightVisible("BoxLight_1", false);
FadeImageTrailTo(3, 1);
FadeRadialBlurTo(1, 1);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door123", false, true);
PlaySoundAtEntity("", "unlock_door", "Door123", 0, false);
RemoveItem("Key123");
}
void UseKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Doors122", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Doors122", 0, false);
RemoveItem("Study123");
}
void ActivateMonster(string &in asEntity)
{
SetEntityActive("Alexander1", true);
AddEnemyPatrolNode("Alexander1", "PathNodeArea_1", 0, "idle");
AddEnemyPatrolNode("Alexander1", "PathNodeArea_2", 0, "idle");
AddEnemyPatrolNode("Alexander1", "PathNodeArea_3", 0, "idle");
SetPlayerActive(false);
AddTimer("", 5.0f, "Walkagain");
StartPlayerLookAt("Alexander1", 5.0f, 5.0f, "");
}
void Open_Door(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door1", false, true);
SetSwingDoorDisableAutoClose("door1", true); // Disable autoclose means its not gonna close by it self.
AddTimer("", 0.5, "Door_Effect"); // Leading to functions in Door_Effect script.
}
void Door_Effect (string &in asTimer)
{
CreateParticleSystemAtEntity("", "ps_dust_whirl", "AreaOpenEffect", false); // Makes a patricle system at the scriptbox AreaOpenEffect.
PlaySoundAtEntity("AreaOpenEffect", "scare_wind.snt", "Player", 1, true); // Plays a sound at the scriptbox named AreaOpenEffect.
AddPropForce("door1", 0, 0, 5000, "world"); // Gives the door a push so it goes open.
AddTimer("", 0.5, "Door_Scare"); // For adding more effect like Sound/Sanity Damage.
}
void Door_Scare(string &in asTimer)
{
PlaySoundAtEntity("scare", "react_scare.snt", "Player", 1, true); // For better scare effect.
GiveSanityDamage(25, true); // Your screen goes a bit forward to scare you more.
}
void LookBack(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("door1", 2, 25, "CallbackName");
SetPlayerActive(false);
AddTimer("", 3.5f, "Walkagain2");
}
void CallbackName()
{
StopPlayerLookAt();
}
void UseKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Wooden", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Wooden", 0, false);
RemoveItem("Tomby1");
}
void lightsdown(string &in asParent, string &in asChild, int alState)
{
SetLampLit("Torch1", false, false);
SetLampLit("Torch2", false, false);
SetLampLit("Torch3", false, false);
SetLampLit("Torch4", false, false);
SetLampLit("Torch5", false, false);
SetLampLit("Torch6", false, false);
}
void LookBack2(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Mansion11", 2, 25, "CallbackName");
}
void ActivateMonster2(string &in asEntity)
{
SetEntityActive("Creepy1", true);
AddEnemyPatrolNode("Creepy1", "PathNodeArea_4", 0, "idle");
}
void UseKeyOnDoor4(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door32", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Door32", 0, false);
RemoveItem("Torture12");
}
void Walkagain(string &in asTimer)
{
SetPlayerActive(true);
StopPlayerLookAt();
}
void Walkagain2(string &in asTimer)
{
SetPlayerActive(true);
}
void WakeUp(string &in timer_name)
{
if(timer_name == "Start")
{
SetLightVisible("BoxLight_1", true);
FadeIn(4);
AddTimer("MoveHead", 1, "WakeUp");
}
else if (timer_name == "MoveHead")
{
FadeImageTrailTo(0, 1);
FadeRadialBlurTo(1, 1);
MovePlayerHeadPos(-0.5, -0.2, -1.1, 2, 2);
FadePlayerRollTo(0, 1.7, 500);
AddTimer("ActivatePlayer", 2, "WakeUp");
}
else if (timer_name == "ActivatePlayer")
{
MovePlayerHeadPos(0, 0, 0, 2, 2);
SetPlayerActive(true);
}
}