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
Can't get unlock door with key code to work?
Storfigge Offline
Member

Posts: 101
Threads: 31
Joined: Sep 2012
Reputation: 0
#1
Can't get unlock door with key code to work?

Hey I've been working on my CS for quite a while now and I'm very close to finishing it so i was making a locked door which a key would be required to open it, I've done this like 4 times before and it has worked... Now it doesn't work. When I use the key it says "Cannot use item this way". I have put in all the code and saved everything I've checked for a mistake many times but can't seem to figure it out. I'm using a sewer_arched door named "water_door" and a key_ laboratory named "key5". I'm not very good with programming though I have solved most problems I've had.

Here's the code

{
AddUseItemCallback("", "key5", "water_door", "UsedKeyOnDoor5", true);
}

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

Really appreciate if someone could tell me what I've done wrong, thx!

(This post was last modified: 11-12-2012, 10:18 AM by Storfigge.)
11-12-2012, 10:17 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Can't get unlock door with key code to work?

Check names again. Script looks normal to me. Check for capitals and such

Trying is the first step to success.
11-12-2012, 11:42 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#3
RE: Can't get unlock door with key code to work?

(11-12-2012, 11:42 AM)beecake Wrote: Check names again. Script looks normal to me. Check for capitals and such
^that.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
11-12-2012, 12:06 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Can't get unlock door with key code to work?

Also where did you ut this line: AddUseItemCallback("", "key5", "water_door", "UsedKeyOnDoor5", true); ?


You did put it in OnStart() right?

Trying is the first step to success.
11-12-2012, 02:35 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#5
RE: Can't get unlock door with key code to work?

When it says "Cannot use this item this way, is a problem of names.Also, remain that scripts are Case-sensitive. It's not the same "key" than "Key".

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
11-12-2012, 07:54 PM
Find
Storfigge Offline
Member

Posts: 101
Threads: 31
Joined: Sep 2012
Reputation: 0
#6
RE: Can't get unlock door with key code to work?

(11-12-2012, 02:35 PM)beecake Wrote: Also where did you ut this line: AddUseItemCallback("", "key5", "water_door", "UsedKeyOnDoor5", true); ?


You did put it in OnStart() right?
Yes... There's nothing wrong with the names either I've checked it a lot of times I've even copy pasted old codes and changed the names and yet it wont work Sad

Heres the entire code for the level


void Onstart()
{
AddUseItemCallback("", "key5", "water_door", "UsedKeyOnDoor5", true);
}

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

void DoorLockedPlayer2(string &in entity)

{
if(GetSwingDoorLocked("metal_1") == true)
{

SetMessage("Messages", "msgname2", 0);

}
}



void OnEnter()
{
}

void OnLeave()
{
}

Does anyone see something that can cause this problem? I just can't figure it out -.-

(This post was last modified: 11-13-2012, 11:02 AM by Storfigge.)
11-13-2012, 10:52 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#7
RE: Can't get unlock door with key code to work?

Is the script exactly names the same as the map? Is it in it's place?

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
11-13-2012, 12:05 PM
Find
Storfigge Offline
Member

Posts: 101
Threads: 31
Joined: Sep 2012
Reputation: 0
#8
RE: Can't get unlock door with key code to work?

(11-13-2012, 12:05 PM)The chaser Wrote: Is the script exactly names the same as the map? Is it in it's place?
Yes the door message i have put in there works just fine :/

The door is placed in water but that shouldn't matter right?? I just tried to rename everything but it still wont work....

(This post was last modified: 11-13-2012, 12:30 PM by Storfigge.)
11-13-2012, 12:21 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#9
RE: Can't get unlock door with key code to work?

Do you have a map .cache? If so, delete it.

Trying is the first step to success.
11-13-2012, 01:14 PM
Find
Storfigge Offline
Member

Posts: 101
Threads: 31
Joined: Sep 2012
Reputation: 0
#10
RE: Can't get unlock door with key code to work?

(11-13-2012, 01:14 PM)beecake Wrote: Do you have a map .cache? If so, delete it.
Damnit didn't notice that >_< ty alot man these forums have helped greatly Smile

11-13-2012, 01:19 PM
Find




Users browsing this thread: 1 Guest(s)