Help a newbie with an HPS file? - 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: Help a newbie with an HPS file? (/thread-16585.html) |
Help a newbie with an HPS file? - lbrosious96 - 06-29-2012 here is the code I have for my first map. It worked perfectly with the first key (monsterdoor/monsterdoorkey_1). Then, I wanted to add a second key/door, called irondoor_key and irondoor respectively, i get so many errors when loading my map. What Did i do wrong? I followed a tutorial, and I have basic/intermediate knowledge of C++ (took a highschool class or two) so go easy on me. Thank you! I will answer any and all questions you have to the best of my ability! I am getting the error "main (11,2) : ERR : Unexpected end of file" on line 11 row 2 its blank...so im not sure what to do void OnStart() { AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "irondoor"key", "irondoor", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(monsterdoorkey_1, monsterdoor) { SetSwingDoorLocked("monsterdoor", "irondoor", false, true); PlaySoundAtEntity("", "unlock_door", "monsterdoor", "irondoor", 0, false); RemoveItem("monsterdoorkey_1", "irondoor_key"); } RE: Help a newbie with an HPS file? - Cruzore - 06-29-2012 AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "irondoor"key", "irondoor" "UsedKeyOnDoor", true); You can't just add a new one, you have to make a new command for that. Also, the UsedKeyOnDoor function has a wrong syntax. And everything in it is wrong too. In fact, you got that many mistakes, that I think it's better to just correct everything, so you can see what you did wrong. PHP Code: void OnStart() RE: Help a newbie with an HPS file? - Adny - 06-29-2012 Alright, I see where you went wrong. You can't stuff more information into 1 callback than what is allowed; you put 2 items (keys) and 2 entities (doors in this case) into 1 callback (AddUseItemCallback). Also, the syntax (stuff inside the parentheses) for UsedKeyOnDoor is wrong. This needs to be 2 callbacks and 2 functions, not one. Also, is it irondoor_key or irondoorkey? You have 2 different names. Anyways, here's the revised script: void OnStart() { AddUseItemCallback("", "irondoor_key", "irondoor" "use_iron_key", true); AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "use_monster_key", true); } void use_iron_key(string &in asItem, string &in asEntity) { SetSwingDoorLocked("irondoor" false, true); PlaySoundAtEntity("", "unlock_door", "irondoor" 0, false); RemoveItem("irondoor_key"); } void use_monster_key(string &in asItem, string &in asEntity) { SetSwingDoorLocked("monsterdoor", false, true); PlaySoundAtEntity("", "unlock_door", "monsterdoor", 0, false); RemoveItem("monsterdoorkey_1"); } RE: Help a newbie with an HPS file? - ApeCake - 06-29-2012 ...what FastHunteR and andyrockin123 said. |