Frictional Games Forum (read-only)

Full Version: SetSwingDoorClosed Script Not Shutting The Door *Fixed*
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
So you start looking at object named: "Explode1" but SetSwingDoorClosed goes to object named: "Exlode1". MY GOD YOU SHOULD EVEN CHECK THE NAMES BEFORE POSTING.
The door is named Explode1. I have it so when I grab my lantern it unlocks the door, then I have to go get a key, on key pickup it activates SlamDoor and LightsOut, then when I walk out of the room where the key is it slams the door (or should but the door stays wide open), then walk a little further and the lights go out, you walk up to the door (I will have a message that will make the player do that), when the player clicks to open the slammed door, the door explodes and then a servant grunt hallucination comes running out.
Wrong forum, moved.
Quote: So you start looking at object named: "Explode1" but SetSwingDoorClosed goes to object named: "Exlode1". MY GOD YOU SHOULD EVEN CHECK THE NAMES BEFORE POSTING
I see this I fixed it but it still doesn't work.