Frictional Games Forum (read-only)
Help on locking level doors? - 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: Help on locking level doors? (/thread-16889.html)

Pages: 1 2


RE: Help on locking level doors? - Cruzore - 07-12-2012

paste the callback too, and where you placed it


RE: Help on locking level doors? - Wyz - 07-12-2012

void OnStart()
{
SetPlayerLampOil(0);
PlayMusic("ambience_voice.ogg", true, 1, 5, 0, true);

//-------CALLBACKS-------
//////////////////////////

AddUseItemCallback("", "OldKey", "Atrium", "AtriumDoorUnlock", true);
}


//-------UNLOCKS-------
////////////////////////

void AtriumDoorUnlock(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Atrium", false);
PlaySoundAtEntity("", "unlock_door", "Atrium", 0, false);
RemoveItem("OldKey");
}

That's the section that's supposed to unlock my door, I get a "cannot use item this way!" message when I use the key, but the door unlocks when I pick the key up. Thanks

Also, as I pick up the key, I can audibly hear the door unlock in the next room. Maybe it's the order of my script? Could I separate my AtriumDoorUnlock function to happen once I use the key?


RE: Help on locking level doors? - SilentStriker - 07-12-2012

You have probably a callback somewhere that when you pick up the key it calls the function AtriumDoorUnlock. Have you written AtriumDoorUnlock inside the key's entity tab?


RE: Help on locking level doors? - Wyz - 07-12-2012

(07-12-2012, 03:57 PM)SilentStriker Wrote: You have probably a callback somewhere that when you pick up the key it calls the function AtriumDoorUnlock. Have you written AtriumDoorUnlock inside the key's entity tab?
Yes, the callback func is listed on the key. Is that my problem? Because my callback is a useitem, could that be what you're saying, the unlock function is called as I pick it up?


RE: Help on locking level doors? - SilentStriker - 07-12-2012

Yes the callback func in the key is called when the key is picked up so remove that and it should work Smile


RE: Help on locking level doors? - Wyz - 07-12-2012

(07-12-2012, 08:26 PM)SilentStriker Wrote: Yes the callback func in the key is called when the key is picked up so remove that and it should work Smile
Thank you so much it worked!! Big Grin


RE: Help on locking level doors? - SilentStriker - 07-12-2012

You're welcome Smile