Frictional Games Forum (read-only)
Key On Door Error - 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: Key On Door Error (/thread-10612.html)

Pages: 1 2


RE: [Help!]Key On Door Error - Elven - 10-05-2011

First, use "", not *"

You need to replace Myfunc with keyondoor

Main 2 big mistakes what i can see straight away.



RE: [Help!]Key On Door Error - jmayo - 10-05-2011

Forgot That One Last *

[Image: errorwo.png]


////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Prisonkey_1", "prison_1", "usedkeyondoor", true);
}
void keyondoor(string &in asItem, string &in asEntity)
{
Setswingdoorlocked("prison_1", false, true);
Playsoundatentity("", "unlock_door", "prison_1", 0, false);
Removeitem("Prisonkey_1");
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


RE: [Help!]Key On Door Error - Your Computer - 10-05-2011

Fix the HPL2 function names as they are shown here: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

Also, "keyondoor" != "usedkeyondoor", therefore the item isn't going to trigger the callback.


RE: [Help!]Key On Door Error - Obliviator27 - 10-05-2011

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Prisonkey_1", "prison_1", "keyondoor", true);
}
void keyondoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("prison_1", false, true);
PlaySoundAtEntity("", "unlock_door", "prison_1", 0, false);
RemoveItem("Prisonkey_1");
}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

That should work for you. The errors were caused by
1) Inaccurate function names.

Example:
Setswingdoorlocked won't be read by the engine, as your capitalization was incorrect
SetSwingDoorLocked is the proper way of writing it.

2) Incorrect Callback

You had usedkeyondoor as your target callback, as definted by the AddUseItemCallback, but your function was named keyondoor. Therefore, the engine won't be able to find the function you called for, and what you want to happen simply won't.



RE: [Help!]Key On Door Error - jmayo - 10-05-2011

Thx Big Grin


RE: Key On Door Error - schmupper - 10-05-2011

Already fixed