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 help
wagiwombledog Offline
Junior Member

Posts: 8
Threads: 4
Joined: Mar 2012
Reputation: 0
#1
Key help

I'm having a problem getting a key to open a door, can you please help?
waterworks_door=Door
waterworks_key=Key
Here is the script:

void OnStart()
{
AddUseItemCallback("", "waterworks_key", "waterworks_door", "UsedKeyOnDoor", true);
}

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

note: I have more script than this but it is working fine.

Thanks Smile
09-26-2012, 08:24 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#2
RE: Key help

Doesn't look like it's wrong. Are you getting an error or something? Are the names in the editor and script correct (exactly the same)?

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
(This post was last modified: 09-26-2012, 08:28 PM by Robby.)
09-26-2012, 08:25 PM
Website Find
wagiwombledog Offline
Junior Member

Posts: 8
Threads: 4
Joined: Mar 2012
Reputation: 0
#3
RE: Key help

(09-26-2012, 08:25 PM)Nemet Robert Wrote: Doesn't look like it's wrong. Are you getting an error or something? Are the names in the editor and script correct (exactly the same)?
I don't get an error message on start-up of my CS, but when I use the key on the door it either doesn't unlock, or I get the message "can't use item in this way" or something. Sad
09-27-2012, 05:13 AM
Find
Mine Turtle Offline
Senior Member

Posts: 647
Threads: 32
Joined: Mar 2011
Reputation: 29
#4
RE: Key help

(09-27-2012, 05:13 AM)wagiwombledog Wrote:
(09-26-2012, 08:25 PM)Nemet Robert Wrote: Doesn't look like it's wrong. Are you getting an error or something? Are the names in the editor and script correct (exactly the same)?
I don't get an error message on start-up of my CS, but when I use the key on the door it either doesn't unlock, or I get the message "can't use item in this way" or something. Sad

make sure you have both the names of the key and the door in the level editor correctly matching. you have to press enter once youve typed in the name of an entity in the level editor, or else it'll go back to default. id check some errors in the script but im out of time atm

[Image: 201107142327000.gif]
09-27-2012, 07:51 AM
Find




Users browsing this thread: 1 Guest(s)