Frictional Games Forum (read-only)
How add Multi Doors and Keys? Help me please!!! - 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: How add Multi Doors and Keys? Help me please!!! (/thread-14208.html)



How add Multi Doors and Keys? Help me please!!! - skirnks017 - 03-24-2012

Hi forum this is my second question for the HPL Engine in Amnesia.
Ok my ask is how add Doors and Keys (Closed to open doors with keys) Multi Doors and Keys
because I can not do it and do not know where to look

Please Help Me Huh

sorry for my english
Im from chile!!! Rolleyes

PD: i have a .eps file
this is the code of first key and door

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}



But y need add second door and key...and and third and fourth...etc...

Sorry i no0b in amnesia level editor!!! Big Grin



RE: How add Multi Doors and Keys? Help me please!!! - ClayPigeon - 03-24-2012

Just like the first one.

void OnEnter()
{
AddUseItemCallback("", "awesomekey_1", "mansion_1", "KeyOnDoor", true); //First key
AddUseItemCallback("", "nameofsecondkey", "nameofseconddoor", "KeyOnDoor2", true); //Second key
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("awesomekey_1");
}


void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("nameofseconddoor", false, true);
PlaySoundAtEntity("", "unlock_door", "nameofseconddoor", 0, false);
RemoveItem("nameofsecondkey");
}



RE: How add Multi Doors and Keys? Help me please!!! - skirnks017 - 03-24-2012

Yeah!!!!! Tanks!!!!! you are Great!!!!

Then I can keep asking?
without irritating Tongue



RE: How add Multi Doors and Keys? Help me please!!! - ClayPigeon - 03-24-2012

(03-24-2012, 05:50 PM)skirnks017 Wrote: Yeah!!!!! Tanks!!!!! you are Great!!!!

Then I can keep asking?
without irritating Tongue
Sure lol




RE: How add Multi Doors and Keys? Help me please!!! - Your Computer - 03-24-2012

Y u no use parameters?


RE: How add Multi Doors and Keys? Help me please!!! - ClayPigeon - 03-24-2012

(03-24-2012, 07:24 PM)Your Computer Wrote: Y u no use parameters?
Oh yeah I forgot, you can make one function to multiple doors.


void unlock_door(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem(item);
}

That's the function, now simply on every door you add:

AddUseItemCallback("", "key_name", "door_name", "unlock_door", true);

AddUseItemCallback("", "key_name2", "door_name2", "unlock_door", true);


Etc.
Should save you a bunch of lines if you have much doors.