Frictional Games Forum (read-only)
SetSwingDoorClosed Script Not Shutting The Door *Fixed* - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: SetSwingDoorClosed Script Not Shutting The Door *Fixed* (/thread-16827.html)



SetSwingDoorClosed Script Not Shutting The Door *Fixed* - Atilla280 - 07-08-2012

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


RE: SetSwingDoorClosed Script Not Shutting The Door. - JMFStorm - 07-08-2012

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.


RE: SetSwingDoorClosed Script Not Shutting The Door. - Atilla280 - 07-08-2012

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.


RE: SetSwingDoorClosed Script Not Shutting The Door. - Traggey - 07-08-2012

Wrong forum, moved.


RE: SetSwingDoorClosed Script Not Shutting The Door. - Atilla280 - 07-08-2012

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.