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
Key Script?
Armored Cow Offline
Member

Posts: 72
Threads: 3
Joined: Sep 2010
Reputation: 0
#22
RE: Key Script?

I'm having trouble making a key script as well.

The door I am trying to open is named "door_1".

The key is named "key_study" (I think. It's a key that is produced when you shatter a wine bottle, so there's no way to name it, but the option in the menu to have a key inside is named "key_study").

The thing is, when I pick up the key it says I've found the Machine Room Key, and when I try to use it on the door it says "Cannot be used this way!"

This is my code:

void OnStart()
{
    AddUseItemCallback("useexit", "key_study", "door_1", "UseKey", true);
}

void UseKey(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked(asEntity, false, true);

    RemoveItem(asItem);
}

Any help?

EDIT: Also, I really don't know any code and simply copied this from earlier in the thread. It would be great if someone could explain what these commands do.

EDIT2: I tried doing this similarly with a key that was just sitting on a table and got it to work since I was able to name it, but I would still like an answer to my previous question if possible. Also, how do I code in a 2nd key? The thing is, there's a key in the desk door that opens the door to the room but I'm not sure how to code this in.
Thanks!

EDIT3: Got it all figured out
09-16-2010, 02:23 AM
Find


Messages In This Thread
Key Script? - by theDARKW0LF - 09-15-2010, 06:37 AM
RE: Key Script? - by jens - 09-15-2010, 06:56 AM
RE: Key Script? - by theDARKW0LF - 09-15-2010, 06:59 AM
RE: Key Script? - by grahfcard - 09-15-2010, 01:46 PM
RE: Key Script? - by DrMelon - 09-15-2010, 01:49 PM
RE: Key Script? - by jens - 09-15-2010, 01:57 PM
RE: Key Script? - by jens - 09-15-2010, 01:58 PM
RE: Key Script? - by thePyro13 - 09-15-2010, 01:59 PM
RE: Key Script? - by sacroid - 09-15-2010, 02:04 PM
RE: Key Script? - by Jordo76 - 09-15-2010, 02:31 PM
RE: Key Script? - by theDARKW0LF - 09-15-2010, 10:05 PM
RE: Key Script? - by jens - 09-15-2010, 02:33 PM
RE: Key Script? - by sacroid - 09-15-2010, 02:55 PM
RE: Key Script? - by grahfcard - 09-15-2010, 02:50 PM
RE: Key Script? - by sacroid - 09-15-2010, 11:14 PM
RE: Key Script? - by theDARKW0LF - 09-16-2010, 12:43 AM
RE: Key Script? - by Neurological - 09-16-2010, 12:46 AM
RE: Key Script? - by theDARKW0LF - 09-16-2010, 01:03 AM
RE: Key Script? - by Neurological - 09-16-2010, 01:20 AM
RE: Key Script? - by theDARKW0LF - 09-16-2010, 01:34 AM
RE: Key Script? - by Neurological - 09-16-2010, 01:37 AM
RE: Key Script? - by Armored Cow - 09-16-2010, 02:23 AM
RE: Key Script? - by jens - 09-16-2010, 05:23 AM
RE: Key Script? - by Armored Cow - 09-17-2010, 05:18 AM
RE: Key Script? - by jens - 09-17-2010, 07:02 AM
RE: Key Script? - by gosseyn - 09-17-2010, 12:46 PM
RE: Key Script? - by jens - 09-17-2010, 01:00 PM
RE: Key Script? - by gosseyn - 09-17-2010, 08:15 PM
RE: Key Script? - by Wafthrudnir - 09-17-2010, 08:32 PM



Users browsing this thread: 1 Guest(s)