DJ1447
Junior Member
Posts: 3
Threads: 1
Joined: Jan 2012
Reputation:
0
|
!!!SCRIPTING HELP!!!
I have been trying to get a key to unlock a door but its not working here is my extra lang:
<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_key1">Item Description</Entry>
<Entry Name="ItemName_key1">Item Name</Entry>
</CATEGORY>
that is all i have in it and here is my map:
void OnStart()
{
AddUseItemCallback("", "key1", "Door1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked(door1, false, true);
PlaySoundAtEntity("", "unlock_door", door1, 0, false);
RemoveItem(key1);
}
}
and that is all thats in that map... PLZ HELP!
|
|
01-19-2012, 02:08 AM |
|
Quotentote
Member
Posts: 118
Threads: 23
Joined: Dec 2011
Reputation:
11
|
RE: !!!SCRIPTING HELP!!!
void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door1", false, true); PlaySoundAtEntity("", "unlock_door", "door1", 0, false); RemoveItem("key1"); }
you forgot the " " at the door + you wrote Door1 instead of door1 (capital D) at void onstart. check in your map how it is named
(This post was last modified: 01-19-2012, 02:12 AM by Quotentote.)
|
|
01-19-2012, 02:10 AM |
|
DJ1447
Junior Member
Posts: 3
Threads: 1
Joined: Jan 2012
Reputation:
0
|
RE: !!!SCRIPTING HELP!!!
(01-19-2012, 02:10 AM)Quotentote Wrote: void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("door1", false, true); PlaySoundAtEntity("", "unlock_door", "door1", 0, false); RemoveItem("key1"); }
you forgot the " " at the door + you wrote Door1 instead of door1 (capital D) at void onstart. check in your map how it is named
Thnx for trying but still doesnt work
|
|
01-19-2012, 02:50 AM |
|
Statyk
Schrödinger's Mod
Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation:
241
|
RE: !!!SCRIPTING HELP!!!
(01-19-2012, 02:08 AM)DJ1447 Wrote: I have been trying to get a key to unlock a door but its not working here is my extra lang:
Item Description
Item Name
that is all i have in it and here is my map:
void OnStart()
{
AddUseItemCallback("", "key1", "Door1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked(door1, false, true);
PlaySoundAtEntity("", "unlock_door", door1, 0, false);
RemoveItem(key1);
}
}
and that is all thats in that map... PLZ HELP!
You have an extra "}" at the bottom of the script. Remove that.
|
|
01-19-2012, 03:22 AM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: !!!SCRIPTING HELP!!!
Got Ninjaed by Statyk :c
And what is not working? Are you getting an error?
(This post was last modified: 01-19-2012, 03:42 AM by flamez3.)
|
|
01-19-2012, 03:41 AM |
|
DJ1447
Junior Member
Posts: 3
Threads: 1
Joined: Jan 2012
Reputation:
0
|
RE: !!!SCRIPTING HELP!!!
(01-19-2012, 03:41 AM)flamez3 Wrote: Got Ninjaed by Statyk :c
And what is not working? Are you getting an error?
no just when i pick up the key it wont unlock the door
|
|
01-19-2012, 11:44 PM |
|
Statyk
Schrödinger's Mod
Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation:
241
|
RE: !!!SCRIPTING HELP!!!
1) Make sure the key names in the level and script match PERFECTLY, AS WELL AS the door.
2) Make sure to put quotations around strings. for example:
SetSwingDoorLocked(door1, false, true);
should be:
SetSwingDoorLocked("door1", false, true);
|
|
01-20-2012, 12:16 AM |
|
|