Frictional Games Forum (read-only)
Link a Key to a Door - 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: Link a Key to a Door (/thread-14113.html)



Link a Key to a Door - Twitchez - 03-19-2012

Hey Everyone!

I been trying for a couple of hours now linking a key to a door. I managed to name the key in the way I wanted to, using the extra_english.lang file, but unfortunatley I am unable the key to the door I want to.


////////////////////////////
// Run first time starting map
void OnStart()
{
wakeUp();
PlayGuiSound("break_wood1.ogg", 1);
PlayGuiSound("general_thunder1.ogg", 1);
SetPlayerLampOil(0);
PlayMusic("react_breath1",false,100.0f,0.0f,1,false);
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}


If you manage to solve this problem, I would be very grateful [Image: smile.gif]

Cheers!
/Twitchez


RE: Link a Key to a Door - SilentStriker - 03-19-2012

That's better! Smile

Ok so does it give you error or does it just not work? Smile



RE: Link a Key to a Door - Twitchez - 03-19-2012

(03-19-2012, 08:37 PM)SilentStriker Wrote: That's better! Smile

Ok so does it give you error or does it just not work? Smile
I didn't write the codes I used for example "wakeUp();", because that works like a charm. The problem is that when I enter my map, I go and pick up my key (which is named the way I want it). I go to my door, which is locked. I try to use my key, but it just says "Cannot use this item..." Undecided


RE: Link a Key to a Door - SilentStriker - 03-19-2012

Ok, check so both the door and the key is named right, if they are try renaming them to your liking. For example if it is a Mansion door name it MansionDoor_1 and the key MansionKey_1 or something like that Smile



RE: Link a Key to a Door - Twitchez - 03-19-2012

(03-19-2012, 08:45 PM)SilentStriker Wrote: Ok, check so both the door and the key is named right, if they are try renaming them to your liking. For example if it is a Mansion door name it MansionDoor_1 and the key MansionKey_1 or something like that Smile
I solved the problem. Apperantly, it seems like the HPL Editor won't allow me to name doors and keys with letters like å,ä and ö without giving me problems. So much for being a Swede Tongue But thanks a lot for giving me the heads up.

//Problem Solved


RE: Link a Key to a Door - SilentStriker - 03-19-2012

(03-19-2012, 08:51 PM)Twitchez Wrote:
(03-19-2012, 08:45 PM)SilentStriker Wrote: Ok, check so both the door and the key is named right, if they are try renaming them to your liking. For example if it is a Mansion door name it MansionDoor_1 and the key MansionKey_1 or something like that Smile
I solved the problem. Apperantly, it seems like the HPL Editor won't allow me to name doors and keys with letters like å,ä and ö without giving me problems. So much for being a Swede Tongue But thanks a lot for giving me the heads up.

//Problem Solved
Nä det är för den är skriven för engelska tangentbord och då finns inte ÅÄÖ Wink

Varsegod ^^