![]() |
[SCRIPT] Naming Items. - 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: [SCRIPT] Naming Items. (/thread-13436.html) |
Naming Items. - Genshien - 02-20-2012 alright,im a noobie at scripting for amnesia but i found no error with this code. <LANGUAGE> <CATEGORY Name="CustomStoryMain"> <Entry Name="Description">This is a test [br]</Entry> </CATEGORY> <CATEGORY Name="Inventory"> <Entry Name="ItemName_Key1">Weird Key</Entry> <Entry Name="ItemDesc_Key1">Must be for a nearby Door.</Entry> </CATEGORY> <CATEGORY Name="Journal"> <Entry Name="Note_Note01_Name">Good Evening</Entry> <Entry Name="Note_Note01_Text">I need to find my lantern....maybe i left it in the study? The key lays at rest.</Entry> </CATEGORY> </LANGUAGE> The script for naming and giving a description to my key is not working correctly. The map loads fine and the note loads fine aswell. when i pick up the key it says "Picked up" I have the CustomSubItemTypeName set to Key1 however its not working....need some help with this one guys RE: Naming Items. - Genshien - 02-20-2012 Ok nevermind guys,i found the issue....now im trying to fix this key unlocking the door script. /=========================================== // Starter's Script File! //=========================================== //=========================================== // This runs when the map first starts void OnStart() { AddUseItemCallback("", "key_tower_1", "mansion_3" "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_3", false, true); PlaySoundAtEntity("", "unlock_door.snt", "mansion_3", 0.0f, false); RemoveItem("key_tower_1"); AddDebugMessage("KeyOnDoor", false); } //=========================================== // This runs when the player enters the map void OnEnter(){ } //=========================================== // This runs when the player leaves the map void OnLeave() { } The key isn't opening the door....i've looked at several how-to's but im still confused on how this is supposed to go RE: Naming Items. - JenniferOrange - 02-20-2012 AddUseItemCallback("", "key_tower_1", "mansion_3", "UsedKeyOnDoor", true); You're missing a comma, is all. RE: Naming Items. - Genshien - 02-20-2012 void OnStart() { AddUseItemCallback("", "Key", "mansion_3", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("mansion_3", false, true); PlaySoundAtEntity("", "unlock_door.snt", "mansion_3", 0.0f, false); RemoveItem("Key"); } Updated the script,still doesn't work correctly. Key is the name of the key entity,im not using the CustomSubItemTypeName mansion_3 is the name of the door. RE: Naming Items. - Your Computer - 02-20-2012 Since i don't see anything wrong with the second posted script (first one, aside from the missing comma, had an improperly initiated comment), and since you claim the entities names are correct, i have to ask: Is the name of the script the same as the name of the map that it relates to? Also, does the hpl.log provide any insight? RE: Naming Items. - Genshien - 02-21-2012 dear god i feel so stupid right now i named the map Test and the hps file Test.hps thinking the extension didn't count. turns out i renamed the script file Test same as map and all my scripts work now. im a dunce haha |