Frictional Games Forum (read-only)
Check My Key-to-Door Script. Thanks! - 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: Check My Key-to-Door Script. Thanks! (/thread-10645.html)



Check My Key-to-Door Script. Thanks! - AggressiveGecko - 10-07-2011

Ok this is my scripting to open a specific door with a key. I have spent TOO much time trying to fix this script by watching other people and if someone could just help me out here I would be SO thankful!! BTW i'm using notepad++
////////////////////////////
// Run first time starting map
void Onstart()
{
AddUseItemCallback("", "torturechamberkey_1", "torturechamberdoor_1", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("torturechamberdoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "torturechamberdoor_1", 0, false);
RemoveItem("torturechamberkey_1");
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}



RE: Check My Key-to-Door Script. Thanks! - Gamemakingdude - 10-07-2011

PHP Code:
void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntity,false,true);
    
PlaySoundAtEntity("","unlock_door"asEntity0false);
    
RemoveItem(asItem);


Replace your unlock script with this.
This will work with any key and will unlock any door with the key. Just make sure you change your item call back function to usedkeyondoor.


RE: Check My Key-to-Door Script. Thanks! - Apfel - 10-07-2011

void OnStart()

with capital S



RE: Check My Key-to-Door Script. Thanks! - AggressiveGecko - 10-07-2011

THANK YOU SO MUCH!!! Big Grin