Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
!!!SCRIPTING HELP!!!
Author Message
DJ1447 Offline
Junior Member

Posts: 3
Joined: Jan 2012
Reputation: 0
Post: #1
!!!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
Find all posts by this user Quote this message in a reply
Quotentote Offline
Member

Posts: 118
Joined: Dec 2011
Reputation: 11
Post: #2
RE: !!!SCRIPTING HELP!!!
PHP Code: (Select All)
void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked("door1"falsetrue);
    
PlaySoundAtEntity("""unlock_door""door1"0false);
    
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
Find all posts by this user Quote this message in a reply
DJ1447 Offline
Junior Member

Posts: 3
Joined: Jan 2012
Reputation: 0
Post: #3
RE: !!!SCRIPTING HELP!!!
(01-19-2012 02:10 AM)Quotentote Wrote:  
PHP Code: (Select All)
void UsedKeyOnDoor(string &in asItemstring &in asEntity

SetSwingDoorLocked("door1"falsetrue); 
PlaySoundAtEntity("""unlock_door""door1"0false); 
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
Find all posts by this user Quote this message in a reply
Statyk Offline
Modmau5

Posts: 3,600
Joined: Sep 2011
Reputation: 198
Post: #4
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
Visit this user's website Find all posts by this user Quote this message in a reply
flamez3 Offline
Posting Freak

Posts: 1,320
Joined: Apr 2011
Reputation: 57
Post: #5
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
Find all posts by this user Quote this message in a reply
DJ1447 Offline
Junior Member

Posts: 3
Joined: Jan 2012
Reputation: 0
Post: #6
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
Find all posts by this user Quote this message in a reply
Statyk Offline
Modmau5

Posts: 3,600
Joined: Sep 2011
Reputation: 198
Post: #7
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
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)