Frictional Games Forum (read-only)
Level door doesn't open. (SOLVED) - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Level door doesn't open. (SOLVED) (/thread-6796.html)



Level door doesn't open. (SOLVED) - Henriksen - 03-05-2011

Hi.

I made a script that is supposed to unlock a level door.
The problem is that i can hear it unlock and the sanity boost works, but the door are still locked???


Here is the full script:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "Scary1", "TurnOff", true, 0);
AddUseItemCallback("", "Key2", "prison_2", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_2", false, false);
PlaySoundAtEntity("", "unlock_door", "prison_2", 0, false);
RemoveItem("Key2");
PlayMusic("10_puzzle02.ogg", false, 0.7, 0.1, 10, true);
RemoveItem("Key2");
GiveSanityBoost();
}

void TurnOff(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(100.0f, true);
PlaySoundAtEntity("", "react_pant6", "lamp", 0, false);
StartPlayerLookAt("ScaryArea1",5.0f,10.0f,"");
AddTimer("ScaryArea1_02",1.5f,"ScaryArea12");
SetLampLit("lamp", false, true);
SetLampLit("lamp_1", false, true);
SetLampLit("lamp_2", false, true);
SetLampLit("lamp_3", false, true);
SetLampLit("lamp_4", false, true);
PlayMusic("Skummellyd3.ogg", false, 1.0f, 0, 0, false);
AddTimer("LightOn",5.0f,"TurnOn");
AddTimer("LightOn2",3.0f,"TurnOn2");
}

void ScaryArea12(string& asEntityName)
{
StopPlayerLookAt();
}

void TurnOn(string &in asTimer)
{
PlayMusic("Normal.ogg", true, 1.0f, 0, 0, true);
SetLampLit("lamp", true, true);
SetLampLit("lamp_1", true, true);
SetLampLit("lamp_2", true, true);
SetLampLit("lamp_3", true, true);
SetLampLit("lamp_4", true, true);
GiveSanityDamage(5.0f, true);
SetMessage("IntroCategory", "Intro5", 5.0f);
}

void TurnOn2(string &in asTimer)
{
SetEntityActive("infected_1", false);
}

void NoteMemento(string &in asEntity)
{
AddQuest("questtest3","questtest3");
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{
SetupLoadScreen("LoadingText", "Loading_Library", 1, "images.jpg");
}


RE: Level door doesn't open. - Pandemoneus - 03-05-2011

A level door isn't a swing door, use
Code:
SetLevelDoorLocked(string& asName, bool abLocked);
instead.


RE: Level door doesn't open. - Henriksen - 03-05-2011

(03-05-2011, 07:24 PM)Pandemoneus Wrote: A level door isn't a swing door, use
Code:
SetLevelDoorLocked(string& asName, bool abLocked);
instead.

Ahh.

Thanks it works now Wink