Frictional Games Forum (read-only)
Script help! - 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: Script help! (/thread-8006.html)



Script help! - klacke - 05-15-2011

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


RE: Script help! - Roenlond - 05-15-2011

(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.


RE: Script help! - klacke - 05-15-2011

haha it was so easy? omg ;P Ty!