Frictional Games Forum (read-only)

Full Version: Script help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have just started with the editor. but when i script so a key would open a door i just get error when opening my map...

Here is my scrip

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true);
}
void MyFunc(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor", False, True);
PlaySoundAtEntity("", "unlock_door", "monsterdoor", 0, false);
RemoveItem(monsterdoorkey_1);
}

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

}


Anyone got a clue whats wrong?
Sorry for my bad english Tongue
(05-15-2011, 10:17 AM)klacke Wrote: [ -> ]I have just started with the editor. but when i script so a key would open a door i just get error when opening my map...

Here is my scrip

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true);
}
void MyFunc(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor", False, True);
PlaySoundAtEntity("", "unlock_door", "monsterdoor", 0, false);
RemoveItem(monsterdoorkey_1);
}

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

}


Anyone got a clue whats wrong?
Sorry for my bad english Tongue

Try this:

Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
   SetSwingDoorLocked("monsterdoor", false, true);
       PlaySoundAtEntity("", "unlock_door", "monsterdoor", 0, false);
       RemoveItem("monsterdoorkey_1");
}

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

}

Added quotes around "monsterdoorkey_1", changed the MyFunc to UsedKeyOnDoor (needs to be the same as the callback above) and changed "False, True" to "false, true" (not sure, but it might not work if capitalized.
haha it was so easy? omg ;P Ty!