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


Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[newbie] Simple script problem :S
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#1
[newbie] Simple script problem :S

i made a script for a key to open a door. the door is called mansion_2 en the key is called Key_1

Script :

void Onstart()
{
AddUseItemCallback("", "Key_1", "mansion_2", "UsedKeyDoor", true);
}

void UsedKeyDoor()
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveItem("Key_1");
}
(This post was last modified: 02-12-2011, 04:26 PM by nkmol.)
02-12-2011, 04:24 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: [newbie] Simple script problem :S

So what's your problem?

02-12-2011, 04:39 PM
Website Find
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#3
RE: [newbie] Simple script problem :S

(02-12-2011, 04:39 PM)Tanshaydar Wrote: So what's your problem?

well my script doesn't work Tongue fist of all. whith the SetSwingDoorLocked script does that mean that that script is locking the door, so i don't have to lock it in Level Editor? (actually i already tryed it, but the script won't lock)

When i put the key(Key_1) on the door(mansion_2) it sais, "connot use this item this way!".
(This post was last modified: 02-12-2011, 04:46 PM by nkmol.)
02-12-2011, 04:45 PM
Find
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#4
RE: [newbie] Simple script problem :S

It's supposed to be:
void UsedKeyDoor(string &in asItem, string &in asEntity)

Creator of The Dark Treasure.
02-12-2011, 04:53 PM
Website Find
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#5
RE: [newbie] Simple script problem :S

Changed that, but still it doesn't change anything.
02-12-2011, 05:01 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#6
RE: [newbie] Simple script problem :S

Are you trying to lock the door with a key?

02-12-2011, 05:20 PM
Website Find
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#7
RE: [newbie] Simple script problem :S

no, open it
02-12-2011, 05:27 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#8
RE: [newbie] Simple script problem :S

Could you try to give a name to your AddItemUseCallBack function, like that:

AddUseItemCallback("FunctionToOpenMansion_2", "Key_1", "mansion_2", "UsedKeyDoor", true);

02-12-2011, 06:33 PM
Website Find
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#9
RE: [newbie] Simple script problem :S

*sigh* still same problem Sad
02-12-2011, 06:40 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#10
RE: [newbie] Simple script problem :S

Well, let's go step by step.
- Level editor: Door's name is true, it's locked, key's name is true.
- In script file key's and door's name is true, functions are correct (after changes with string &in asEntity etc.)
- But in game, key cannot be used on the door?

02-12-2011, 06:43 PM
Website Find




Users browsing this thread: 4 Guest(s)