![]() |
Rod Puzzle - 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: Rod Puzzle (/thread-16078.html) |
Rod Puzzle - BrooksyFC - 06-12-2012 Hey Guys, I've been trying to a while now but I can't seem to get anything working on this script. Basically, the player needs to have 3 rods to put into a machine (well that object with the 3 rod holes) which will then enable the player to pull a lever to open a door. I'm pretty sure it was used in the original game, but can someone help me with this script. Like if the player has all the rods, which they will, how do the rods go into the slots e.t.c Thanks in advance RE: Rod Puzzle - FlawlessHappiness - 06-12-2012 void OnStart() { AddUseItemCallback("", "Rod_1", "ScriptArea_1", "UseRod_1", true); ///Rod_1 = 1st rod ///ScriptArea_1 is around the first hole AddUseItemCallback("", "Rod_2", "ScriptArea_2", "UseRod_2", true); ///Rod_2 = 2nd rod ///ScriptArea_2 is around the second hole AddUseItemCallback("", "Rod_3", "ScriptArea_3", "UseRod_3", true); ///Rod_3 = 3rd rod ///ScriptArea_3 is around the third hole } void UseRod_1(string &in asItem, string &in asEntity) { SetEntityActive("Rod_1_Static", true); ///Place a static rod inside the hole inactive RemoveItem("Rod_1); ///This will remove it from the inventory AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3 { ///Do stuff when all 3 has been placed } } void UseRod_2(string &in asItem, string &in asEntity) { SetEntityActive("Rod_2_Static", true); RemoveItem("Rod_2); AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3 { ///Do stuff when all 3 has been placed } } void UseRod_3(string &in asItem, string &in asEntity) { SetEntityActive("Rod_3_Static", true); RemoveItem("Rod_3); AddLocalVarInt("3_Rods", 1); ///Adds 1 to the LocalVarInt if(GetLocalVarInt("3_Rods") == 3) ///Check if the LocalVarInt = 3 { ///Do stuff when all 3 has been placed } } Everything with red color should be deleted RE: Rod Puzzle - BrooksyFC - 06-12-2012 Sweet. Thanks for the reply. I'll give it a try and post back on the results. RE: Rod Puzzle - FlawlessHappiness - 06-12-2012 No problem ![]() RE: Rod Puzzle - BrooksyFC - 06-12-2012 I've put in that code, but I keep getting an error on the first line. Say;s unexpected token for this line: Code: { That first "{" RE: Rod Puzzle - FlawlessHappiness - 06-12-2012 at the void OnStart() ?? Hm.. i dont know.... eh.. RE: Rod Puzzle - Adny - 06-12-2012 Got it, missing right quotation on Rod 1-3 in the RemoveItem area in each UseRod 1-3 function. void UseRod_1(string &in asItem, string &in asEntity) { SetEntityActive("Rod_1_Static", true); ///Place a static rod inside the hole inactive RemoveItem("Rod_1); ///This will remove it from the inventory should be RemoveItem("Rod_1"); Do that for all 3 rod scripts. RE: Rod Puzzle - FlawlessHappiness - 06-12-2012 Woops.. My bad ![]() RE: Rod Puzzle - BrooksyFC - 06-13-2012 (06-12-2012, 07:28 PM)andyrockin123 Wrote: Got it, missing right quotation on Rod 1-3 in the RemoveItem area in each UseRod 1-3 function.Nice one, I'll give that a try after work and see if that works ![]() RE: Rod Puzzle - BrooksyFC - 06-13-2012 Right, I've done that, it all works. But I can't seem to put the rods in the holes of the machine. |