Frictional Games Forum (read-only)

Full Version: How to make locked door and key that opens it.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I dont know how and please tell me what i would write.

Thanks.
(09-30-2010, 05:12 PM)LoneWolf Wrote: [ -> ]I dont know how and please tell me what i would write.

Thanks.

This has been addressed a thousand times and is in the tutorial section as a video.
It doesn't work for me. Any idea Huh

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave(
{
}
void OnStart()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "UsedKeyOnDoor", true); --> is your key named "awesomekey_1"? The door name must be "mansion_1" as well.
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true); --> again door name "mansion_1"?
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1"); --> just to remove the key from inventory after it is used, key name "awesomekey_1"
}

Check the tutorial video on making doors. If you follow step by step you can't go wrong.
I've done everything like in the video. That's why i don't understand. Sad

edit: I've found the problem. The extension of my folder was .hps.hps instead of .hps ! Dodgy

It works now! Youhou! Tongue

Anyway thank you! Big Grin