////////////////////////////////
// Run when starting the map
void OnStart()
////////////////////////////////
// Entities
{
AddUseItemCallback("", "Bedroom_Key", "Bedroom_Key_Door", "UsedKeyOnDoor", true); //Assigns the key to the door and sets the action of this as UsedKeyOnDoor
AddEntityCollideCallback("Player", "DoorCloseArea1", "DoorCloseBang", true, 1); //Declaring when a player walks into an area called "Name" Deletes the possibility of it happening again so it can only happen once: Number = 1 for player enters. -1 for when player leaves. 0 for both
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity) //Declaring the Key as a string
{
SetSwingDoorLocked("Bedroom_Key_Door", false, true); //Sets what door the key works on and it can only be used once
PlaySoundAtEntity("", "unlock_door.snt", "Bedroom_Key_Door", 0, false); //Plays sound when the key is used on the door
RemoveItem("Bedroom_Key"); //Removes the key after it has been used
}
void DoorCloseBang(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Bedroom_Key_Door", true, true); //Closes a swing door: Effects indicate true to see the door close
PlaySoundAtEntity("", "24_bang.snt", "Bedroom_Key_Door", 0, false); //Create banging on the door sound when the door shuts
PlaySoundAtEntity("", "react_breath.snt", "Bedroom_Key_Door", 0, false); //Create banging on the door sound when the door shuts
PlaySoundAtEntity("", "15_the_big_scream.snt", "Bedroom_Key_Door", 0, false); //Create banging on the door sound when the door shuts
FadePlayerFOVMulTo(0.6f, 5.0f); //Zooms the screen adding to the wobble effect
FadePlayerAspectMulTo(0.6f, 1.0f); //Stretches the screen giving wobble effect
FadeImageTrailTo(0.5f, 1.0f); //Adds blur making the wobble effect better
StartPlayerLookAt("Bedroom_Key_Door", 10.0f, 10.0f, ""); //Makes the player look at the bedroom door
AddTimer("", 2.0f, "StopLooking"); //timer to stop looking at the door after 2 seconds
}
void StopLooking(string &in asTimer)
{
StopPlayerLookAt(); //Stop looking at the door
}
////////////////////////////////
// Run when entering the map
void OnEnter()
{
}
////////////////////////////////
// Run when leaving the map
void OnLeave()
{
}