Frictional Games Forum (read-only)

Full Version: How add Multi Doors and Keys? Help me please!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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");
}
Yeah!!!!! Tanks!!!!! you are Great!!!!

Then I can keep asking?
without irritating Tongue
(03-24-2012, 05:50 PM)skirnks017 Wrote: [ -> ]Yeah!!!!! Tanks!!!!! you are Great!!!!

Then I can keep asking?
without irritating Tongue
Sure lol

Y u no use parameters?
(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.