Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help with my coding.
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: I need help with my coding.

In your callback, you made the function "UsedKeyOnDoor" but the function you have is called "UsedDoorKey"; they're supposed to be the same. Also, you should never use spaces in coding (unless you're adding a debug message). Use underscores instead, they look like this --> "_"

Here's a revised version (be sure to change the names of the items in the level editor to match the ones in the script):


void OnStart()
{
AddUseItemCallback("", "Bedroom_Key", "Bedroom_Door", "UsedKeyOnDoor", true);
}

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

void OnEnter()
{

}

void OnLeave()
{

}

I rate it 3 memes.
08-02-2012, 07:43 PM
Find


Messages In This Thread
I need help with my coding. - by tristanisms - 08-02-2012, 07:38 PM
RE: I need help with my coding. - by Adny - 08-02-2012, 07:43 PM
RE: I need help with my coding. - by tristanisms - 08-02-2012, 07:46 PM



Users browsing this thread: 1 Guest(s)