Frictional Games Forum (read-only)
How to make locked door and key that opens it. - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: How to make locked door and key that opens it. (/thread-4850.html)



How to make locked door and key that opens it. - LoneWolf - 09-30-2010

I dont know how and please tell me what i would write.

Thanks.


RE: How to make locked door and key that opens it. - trancedj - 09-30-2010

Take a look at:

http://hpl2.frictionalgames.com/tutorials


RE: How to make locked door and key that opens it. - HakePT - 09-30-2010

(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.


RE: How to make locked door and key that opens it. - fantino - 09-30-2010

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(
{
}


RE: How to make locked door and key that opens it. - HakePT - 09-30-2010

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.


RE: How to make locked door and key that opens it. - fantino - 09-30-2010

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