nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
[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 |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: [newbie] Simple script problem :S
So what's your problem?
|
|
02-12-2011, 04:39 PM |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
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 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 |
|
Linus Ågren
Senior Member
Posts: 309
Threads: 58
Joined: Jan 2011
Reputation:
5
|
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 |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
RE: [newbie] Simple script problem :S
Changed that, but still it doesn't change anything.
|
|
02-12-2011, 05:01 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: [newbie] Simple script problem :S
Are you trying to lock the door with a key?
|
|
02-12-2011, 05:20 PM |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
RE: [newbie] Simple script problem :S
no, open it
|
|
02-12-2011, 05:27 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
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 |
|
nkmol
Senior Member
Posts: 252
Threads: 19
Joined: Feb 2011
Reputation:
4
|
RE: [newbie] Simple script problem :S
*sigh* still same problem
|
|
02-12-2011, 06:40 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
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 |
|
|