Frictional Games Forum (read-only)

Full Version: Door script error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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");
}
///////////////////////////
/ / 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 =)
Thank you. Now i don't get error now. but second key_2 wont work with derect.
(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 =)
(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.