Frictional Games Forum (read-only)
Door script 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Door script error (/thread-7888.html)



Door script error - masken94 - 05-08-2011

I have made ​​a key that works for a door. But when I try to make a key to another another door, I get error. I do not know what I'm doing wrong.Huh
This is the script

////////////////////////////
/ / Run first time starting map
void onStart ()
{
AddUseItemCallback ("", "the_key", "the_door", "KeyOnDoor", true);
}

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

////////////////////////////
/ / Run first time starting map
void onStart ()
{
AddUseItemCallback ("", "key_2", "derect", "usedkeyondoor", true);
}

void usedkeyondoor (string & in asItem, string & in asEntity)
{
SetSwingDoorLocked ("derect", false, true);
PlaySoundAtEntity ("", "unlock_door", "derect", 0, true);
RemoveItem ("key_2");
}


RE: Door script error - Simpanra - 05-08-2011

///////////////////////////
/ / Run first time starting map
void onStart ()
{
AddUseItemCallback ("", "the_key", "the_door", "KeyOnDoor", true);
AddUseItemCallback ("", "key_2", "derect", "usedkeyondoor", true);
}

void KeyOnDoor (string & in asItem, string & in asEntity)
{
SetSwingDoorLocked ("the_door", false, true);
PlaySoundAtEntity ("", "unlock_door", "the_door", 0, true);
RemoveItem ("the_key");
}
void usedkeyondoor (string & in asItem, string & in asEntity)
{
SetSwingDoorLocked ("derect", false, true);
PlaySoundAtEntity ("", "unlock_door", "derect", 0, true);
RemoveItem ("key_2");
}






Mended it =)


RE: Door script error - masken94 - 05-08-2011

Thank you. Now i don't get error now. but second key_2 wont work with derect.


RE: Door script error - Simpanra - 05-08-2011

(05-08-2011, 07:59 PM)masken94 Wrote: Thank you. Now i don't get error now. but second key_2 wont work with derect.

are you sure you called it key_2 in the editor? It might be worth checking =)


RE: Door script error - masken94 - 05-09-2011

(05-08-2011, 08:07 PM)Simpanra Wrote:
(05-08-2011, 07:59 PM)masken94 Wrote: Thank you. Now i don't get error now. but second key_2 wont work with derect.

are you sure you called it key_2 in the editor? It might be worth checking =)

Yes. but some how i did manage to get it work. Can it have something to do with the .lang file.