Hello, I have followed
THIS tutorial and The door will not shut. I have everything correct I collide with the area because the sounds and things go off but the door stays wide open. Here is my full script.
void OnStart()
{
SetEntityPlayerInteractCallback("lantern_1", "Lantern", true);
AddUseItemCallback("OpenDoor", "key1", "JacobsCloset", "UsedKeyOnDoor1", true);
AddUseItemCallback("OpenDoor", "key2", "EmilysCloset", "UsedKeyOnDoor2", true);
AddUseItemCallback("OpenDoor", "key3", "JacobsRoom ", "UsedKeyOnDoor3", true);
AddUseItemCallback("OpenDoor", "key4", "EmilysRoom", "UsedKeyOnDoor4", true);
AddUseItemCallback("OpenDoor", "key5", "Dungeon", "UsedKeyOnDoor5", true);
// ("OpenDoor", "NameOfItem", "NameOfObjectItemWillBeUsedOn", "Function", True)
}
void Lantern(string &in asEntity)
{
SetSwingDoorLocked("Explode1", false, false);
SetMessage("Messages", "FoundLantern", 0);
AddEntityCollideCallback("Player", "SlamDoor", "SlamDoor", true, 1);
}
void SlamDoor(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("Explode1", 0.5f, 0.5f, "");
SetSwingDoorClosed("Exlode1", true, true);
PlaySoundAtEntity("", "react_breath_slow", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
AddEntityCollideCallback("Player", "StopLooking", "StopLooking", true, 1);
}
void StopLooking(string &in asParent, string &in asChild, int alState)
{
StopPlayerLookAt();
SetEntityPlayerInteractCallback("key3", "KeyPickup", true);
}
void KeyPickup(string &in asEntity)
{
AddEntityCollideCallback("Player", "LightsOut1", "LightsOut1", true, 1);
}
void LightsOut1 (string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_walk_stomp.snt", "Player", 0, false);
PlaySoundAtEntity("", "scare_walk_ghost.snt", "Player", 0, false);
PlaySoundAtEntity("", "scare_haunting.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
SetEntityPlayerInteractCallback("Explode1", "Explode1", true);
}
void Explode1(string &in asEntity)
{
StopPlayerLookAt();
SetEntityActive("servant_grunt_1", true);
SetPropHealth("Explode1", 0.0f);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("JacobsCloset", false, true);
//("NameOfDoor", Locked/OrNot, Effects)
PlaySoundAtEntity("", "unlock_door", "JacobsCloset", 0, false);
//("", "SoundFile", "Entity", Fade, KeepPlaying)
RemoveItem("key1");
}
void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("EmilysCloset", false, true);
PlaySoundAtEntity("", "unlock_door", "EmilysCloset", 0, false);
RemoveItem("key2");
}
void UsedKeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("JacobsRoom", false, true);
PlaySoundAtEntity("", "unlock_door", "JacobsRoom", 0, false);
RemoveItem("key3");
}
void UsedKeyOnDoor4(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("EmilysRoom", false, true);
PlaySoundAtEntity("", "unlock_door", "EmilysRoom", 0, false);
RemoveItem("key4");
}
void UsedKeyOnDoor5(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("LevelDoor1", false);
PlaySoundAtEntity("", "unlock_door", "LevelDoor1", 0, false);
RemoveItem("key5");
}
// end
void OnEnter()
{
}
// end
void OnLeave()
{
}
// end