Frictional Games Forum (read-only)
Need help coding for key to work on door - 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: Need help coding for key to work on door (/thread-14132.html)



Need help coding for key to work on door - ryan51695 - 03-20-2012

okay so the lang file is good, but the test.hps file must be wrong. This is what i have so far


//===========================================
// Starter's Script File!
//===========================================

//===========================================
// This runs when the map first starts
void OnStart()
{
AddUseItemCallback("", "door_key", "hallway_door", "UsedKeyOnDoor", true);
}

void MyFunc(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("hallway_door", false, true);
PlaySoundAtEntity("", "unlock_door", "hallway_door", 0, false);
RemoveItem("door_key");
}
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}





if anyone could help me get my key to work on the door id appreciate it Smile thanks!


RE: Need help coding for key to work on door - Obliviator27 - 03-20-2012

When you use the key on the door, you're calling UsedKeyOnDoor, when you named the function to unlock the door MyFunc.



RE: Need help coding for key to work on door - ryan51695 - 03-20-2012

what do you mean?


RE: Need help coding for key to work on door - Obliviator27 - 03-20-2012

void MyFunc(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("hallway_door", false, true);
PlaySoundAtEntity("", "unlock_door", "hallway_door", 0, false);
RemoveItem("door_key");
}
Replace the bolded text with UsedKeyOnDoor



RE: Need help coding for key to work on door - ryan51695 - 03-20-2012

THANK YOU!!!!!