** SOLVED ** Key Doesn't Unlock Door! - 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: ** SOLVED ** Key Doesn't Unlock Door! (/thread-21349.html) Pages:
1
2
|
** SOLVED ** Key Doesn't Unlock Door! - FurtherGames - 05-01-2013 I created a key, but the key doesn't unlock the door. Here are my files. HPS FILE: (I know "masion_Door" is spelt wrong) void OnStart() { AddUseItemCallback("", "Key1", "masion_Door", "FUNCTION", true); } void OnEnter() { } void OnLeave() { } void FUNCTION(string &in item, string &in door) { SetLevelDoorLocked("masion_Door", false); PlayGuiSound("unlock.door.snt", 100); RemoveItem("item"); } My extra_english.lang: <LANGUAGE> <RESOURCES> </RESOURCES> <CATEGORY Name="CustomStoryMain"> <Entry Name="Description">Dare to enter the castle tombs...</Entry> </CATEGORY> <CATEGORY Name="Messages"> <Entry Name="doorlock1">No need to go back outside...</Entry> </CATEGORY> </LANGUAGE> My key name and door name match the names they have inside the editor. RE: Key Doesn't Unlock Door, No Desc or Key Name? - DeAngelo - 05-01-2013 Two things: Your Lang problem is highlighted in red here: <LANGUAGE> <RESOURCES> </RESOURCES> <CATEGORY Name="CustomStoryMain"> <Entry Name="Description">Dare to enter the castle tombs...</Entry> </CATEGORY> <CATEGORY Name="Messages"> <Entry Name="doorlock1">No need to go back outside...</Entry> </CATEGORY> <CATEGORY Name="Inventory"> <Entry Name="ItemName_Key1">room key</Entry> <Entry Name="ItemDesc_Key1">The key for my room.</Entry> </CATERGORY> </LANGUAGE> and your key not unlocking your door, the problem is highlighted in red here: void OnStart() { AddUseItemCallback("item", "Key1", "masion_Door", "FUNCTION", true); } void OnEnter() { } void OnLeave() { } void FUNCTION(string &in asItem, string &in asEntity) { SetLevelDoorLocked("masion_Door", false); PlayGuiSound("unlock.door.snt", 100); RemoveItem("item"); } Make those changes and it should work. Oh and the "item" in your RemoveItem at the end should be changed to RemoveItem("Key1"); if you're wanting it to remove the key that unlocked the door. Unless you actually have an item named "item" it won't work. RE: Key Doesn't Unlock Door! - PutraenusAlivius - 05-01-2013 Door unlock. PHP Code: void OnStart() extra_english.lang PHP Code: <LANGUAGE> RE: Key Doesn't Unlock Door! - FurtherGames - 05-01-2013 My key still doesn't unlock the door. I didn't copy the //Syntax mistake. because I didn't think it was needed. Here is my HPS file: void OnStart() { AddUseItemCallback("", "Key1", "masion_Door", "DoorUnlockKey", true); } void OnEnter() { } void OnLeave() { } void DoorUnlockKey(string &in asItem, string &in asEntity) { SetLevelDoorLocked("masion_Door", false); PlayGuiSound("unlock.door.snt", 100); RemoveItem("item"); } RE: Key Doesn't Unlock Door! - DeAngelo - 05-01-2013 Are you sure the key and door are named exactly as shown in your HPS? Sometimes even upper case and lower case makes a difference. RE: Key Doesn't Unlock Door! - FurtherGames - 05-01-2013 (05-01-2013, 12:54 PM)DeAngelo Wrote: Are you sure the key and door are named exactly as shown in your HPS? Sometimes even upper case and lower case makes a difference. Yes, I assure you. Inside the level editor: Key name: Key1 Door name: maison_Door (I know this is spelt wrong) I copied them from the level editor to the HPS File. HPS File: void OnStart() { AddUseItemCallback("", "Key1", "masion_Door", "DoorUnlockKey", true); } void OnEnter() { } void OnLeave() { } void DoorUnlockKey(string &in asItem, string &in asEntity) { SetLevelDoorLocked("masion_Door", false); PlayGuiSound("unlock.door.snt", 100); RemoveItem("Key1"); } RE: Key Doesn't Unlock Door! - DeAngelo - 05-01-2013 You put that in the level editor it's maison_Door but in your script it's masion_Door (the i and s are switched) RE: Key Doesn't Unlock Door! - FurtherGames - 05-01-2013 (05-01-2013, 01:05 PM)DeAngelo Wrote: You put that in the level editor it's maison_Door but in your script it's masion_Door (the i and s are switched) Sorry, that was my own typing mistake. It is masion_Door in both the HPS File and the Level Editor. ONCE AGAIN, MY HPS FILE void OnStart() { AddUseItemCallback("", "Key1", "masion_Door", "DoorUnlockKey", true); } void OnEnter() { } void OnLeave() { } void DoorUnlockKey(string &in asItem, string &in asEntity) { SetLevelDoorLocked("masion_Door", false); PlayGuiSound("unlock.door.snt", 100); RemoveItem("Key1"); } RE: Key Doesn't Unlock Door! - DeAngelo - 05-01-2013 This is probably a dumb question, but are you sure that your door is a level door and not just a regular swing door? Barring that, it may be best to just upload your level in a zip so that someone can take a look hands on at the level and the HPS file. RE: Key Doesn't Unlock Door! - FurtherGames - 05-01-2013 (05-01-2013, 01:12 PM)DeAngelo Wrote: This is probably a dumb question, but are you sure that your door is a level door and not just a regular swing door? Barring that, it may be best to just upload your level in a zip so that someone can take a look hands on at the level and the HPS file. It's a swing door that isn't unlocking. |