Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved Script help!
Author Message
klacke Offline
Junior Member

Posts: 7
Joined: May 2011
Reputation: 0
Post: #1
Script help!
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
(This post was last modified: 06-05-2011 06:22 AM by klacke.)
05-15-2011 10:17 AM
Find all posts by this user Quote this message in a reply
Roenlond Offline
Senior Member

Posts: 331
Joined: Apr 2011
Reputation: 0
Post: #2
RE: Script help!
(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:

////////////////////////////
// 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.
05-15-2011 10:26 AM
Find all posts by this user Quote this message in a reply
klacke Offline
Junior Member

Posts: 7
Joined: May 2011
Reputation: 0
Post: #3
RE: Script help!
haha it was so easy? omg ;P Ty!
05-15-2011 10:31 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: