![]() |
[CHAOS] Creating A Lever 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: [CHAOS] Creating A Lever Puzzle (/thread-11457.html) |
Creating A Lever Puzzle - JenniferOrange - 11-21-2011 I'm trying to create a lever puzzle, using either the guiding rod machine or the lever one, it doesn't matter to me. Whichever is easier, I guess. I want to either put levers in a certain up/down state or put the three guiding rods into the machine to cause a screen shake, which in turn causes the huge castle gate to open. I can handle the last part, I'm just clueless on levers. I can do one, but I can't do multiple to save my life. A script or tutorial/thread link would be helpful. Thankyou :] RE: Creating A Lever Puzzle - Your Computer - 11-22-2011
RE: Creating A Lever Puzzle - BlueFury - 11-22-2011 (11-22-2011, 12:02 AM)Your Computer Wrote: thanks bro RE: Creating A Lever Puzzle - JenniferOrange - 11-22-2011 (11-22-2011, 12:02 AM)Your Computer Wrote:I'm sorry is it just me that finds that confusing? ![]() RE: Creating A Lever Puzzle - Your Computer - 11-22-2011 (11-22-2011, 01:12 AM)JenniferOrange Wrote: maybe a script example? PHP Code: /* RE: Creating A Lever Puzzle - JenniferOrange - 11-22-2011 (11-22-2011, 01:49 AM)Your Computer Wrote:(11-22-2011, 01:12 AM)JenniferOrange Wrote: maybe a script example? Thank you, I'll try this! Which function do I use to define the global variables and where should I put them/it? RE: Creating A Lever Puzzle - Your Computer - 11-22-2011 (11-22-2011, 02:04 AM)JenniferOrange Wrote: Thank you, I'll try this! Which function do I use to define the global variables and where should I put them/it? Technically, you don't need to; though, it's just an example, the variable names being placeholders. Replace whatever to suit your needs. RE: Creating A Lever Puzzle - teddan50 - 12-12-2011 My script does for some reason don't work. I have setted all of the levers on stuck in max and InteractionDisablesStuck, so when I have pulled the right levers they are in the wanted positions, but still the "PerformLeverTaskCompleted" doesn't start... void OnStart() { SetEntityConnectionStateChangeCallback("lever_1", "StoreCheckLeverState"); SetEntityConnectionStateChangeCallback("lever_2", "StoreCheckLeverState"); SetEntityConnectionStateChangeCallback("lever_3", "StoreCheckLeverState"); SetEntityConnectionStateChangeCallback("lever_4", "StoreCheckLeverState"); SetEntityConnectionStateChangeCallback("lever_5", "StoreCheckLeverState"); SetEntityConnectionStateChangeCallback("lever_6", "StoreCheckLeverState"); SetEntityConnectionStateChangeCallback("lever_7", "StoreCheckLeverState"); SetEntityConnectionStateChangeCallback("lever_8", "StoreCheckLeverState"); } void CheckLeverStates() { if (GetLocalVarInt("lever_1") == 0 && GetLocalVarInt("lever_2") == 1 && GetLocalVarInt("lever_3") == 0 && GetLocalVarInt("lever_4") == 1 && GetLocalVarInt("lever_5") == 0 && GetLocalVarInt("lever_6") == 1 && GetLocalVarInt("lever_7") == 1 && GetLocalVarInt("lever_8") == 0) { PerformLeverTaskCompleted(); } } void PerformLeverTaskCompleted() { SetSwingDoorLocked("door1", false, false); SetSwingDoorClosed("door1", false, false); PlaySoundAtEntity("", "unlock_door", "door1", 0, false); PlaySoundAtEntity("", "quest_completed.snt", "Player", 0.5f, false); StartEffectFlash(1, 0.4, 1); } void StoreCheckLeverState(string &in entity, int state) { SetLocalVarInt("lever_1", 0); SetLocalVarInt("lever_2", 1); SetLocalVarInt("lever_3", 0); SetLocalVarInt("lever_4", 1); SetLocalVarInt("lever_5", 0); SetLocalVarInt("lever_6", 1); SetLocalVarInt("lever_7", 1); SetLocalVarInt("lever_8", 0); CheckLeverStates(); } RE: Creating A Lever Puzzle - nemesis567 - 12-12-2011 You're not supposed to do this: PHP Code: void StoreCheckLeverState(string &in entity, int state) You should replace that with this: PHP Code: void StoreCheckLeverState(string &in entity, int state) What you are doing by changing that is creating a random variable with the entities name(lever_1, lever_2 etc.), and saving that levers state. In the function CheckLeverStates() you will check the state of each and if the state of each one corresponds to the expected it will trigger the final function. RE: Creating A Lever Puzzle - teddan50 - 12-12-2011 (12-12-2011, 09:12 PM)nemesis567 Wrote: You're not supposed to do this: Ok, I understand... But I still have a problem with the "complete" part. I can't seem to get the door to lock itself (yes I have checked the locked box). And the sound and light effects doesn't start either... |