Frictional Games Forum (read-only)
!!!SCRIPTING HELP!!! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: !!!SCRIPTING HELP!!! (/thread-12706.html)



!!!SCRIPTING HELP!!! - DJ1447 - 01-19-2012

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!



RE: !!!SCRIPTING HELP!!! - Quotentote - 01-19-2012

PHP Code:
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



RE: !!!SCRIPTING HELP!!! - DJ1447 - 01-19-2012

(01-19-2012, 02:10 AM)Quotentote Wrote:
PHP Code:
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



RE: !!!SCRIPTING HELP!!! - Statyk - 01-19-2012

(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.


RE: !!!SCRIPTING HELP!!! - flamez3 - 01-19-2012

Got Ninjaed by Statyk :c

And what is not working? Are you getting an error?


RE: !!!SCRIPTING HELP!!! - DJ1447 - 01-19-2012

(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


RE: !!!SCRIPTING HELP!!! - Statyk - 01-20-2012

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);