Frictional Games Forum (read-only)
Key to open door on seperate level - 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: Key to open door on seperate level (/thread-16606.html)



Key to open door on seperate level - drunkmonk - 06-30-2012

Hey everyone, i'm having trouble trying to figure out how to script the player picking up a key in one map and using that key to unlock a level door in a different map entirely. So far what I have is the player picks up a key in the east wing guest quarters, and they have to take that key to the lab and use it on a door to the upper levels. I have never done something like this before and I have tried it out myself with no luck, any help would be greatly appriectiated.
Thanks.


RE: Key to open door on seperate level - Damascus - 06-30-2012

Use the script you would normally use to unlock a door, and place it in the script for the door's map. Use the internal name of the key you find in the other map.

Also, please use the Development Support forum for development help.


RE: Key to open door on seperate level - drunkmonk - 06-30-2012

ok so should it look something like this?
void OnStart()
{
AddUseItemCallback("", "Key_Upper_Levels", "Upper_Levels", "UsedKey", true);
}
void UsedKey(string &in item, string &in door)
{
SetLevelDoorLocked("Upper_Levels", false, true);
PlaySoundAtEntity("", "unlock_door", "Upper_Levels", 0,false);
RemoveItem("Key_Upper_Levels");
GiveSanityBoostSmall();
{


RE: Key to open door on seperate level - Damascus - 06-30-2012

Yep. Last bracket needs to be } instead of { though.


RE: Key to open door on seperate level - drunkmonk - 06-30-2012

(06-30-2012, 03:33 AM)Damascus Wrote: Yep. Last bracket needs to be } instead of { though.
Awesome, it's working perfectly. Thank you so much!