Frictional Games Forum (read-only)

Full Version: Link a Key to a Door
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
That's better! Smile

Ok so does it give you error or does it just not work? Smile
(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
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
(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
(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 ^^