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
Having problems with key unlocking a door scripting.
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Having problems with key unlocking a door scripting.

This is the basic key script.


{
AddUseItemCallback("", "KeyOne", "manny", "UsedKeyOnDoor", true);
}


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


KeyOne = The key in your editor. It needs to have the exact same name as in your script.
I guess your key is called KeyOne in both places Wink


Manny = I guess this is the door. Also needs same names, you know Wink


UsedKeyOnDoor = This is the function you call.
A function is called when you write: void [Name of the function](something that specifies the function)
The function-name you put in the void OnStart() and the function you call with 'void' also needs the same names.
In your place:
void UsedKeyOnDoor(string &in asItem, string &in asEntity) <- This specifies that you use an item on something (In this place, a door)

The name could be anything else than UsedKeyOnDoor, as long as they both are the same.
You see there is a lot that needs the same names, so i would just re-check all the names Wink
I hope you understood this

Trying is the first step to success.
(This post was last modified: 06-10-2012, 04:32 PM by FlawlessHappiness.)
06-10-2012, 04:30 PM
Find


Messages In This Thread
RE: Having problems with key unlocking a door scripting. - by FlawlessHappiness - 06-10-2012, 04:30 PM



Users browsing this thread: 2 Guest(s)