[SCRIPT] Lock opened with armor 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: [SCRIPT] Lock opened with armor puzzle (/thread-13368.html) |
Lock opened with armor puzzle - Ermu - 02-16-2012 Hey! So, my problem is that i've been making a puzzle, where you need to find 2 armor heads and place them to 2 helmetless armors, to unlock the door. My problem is at the point that there should be the both armor heads placed to unlock the door, but the door will unlock even if there is one helmet only placed, and as i said, it shouldn't unlock until both have been placed. The reason why i placed "else"s at the point it checks for the other armor, is because i thought that would work since it didn't work without it. SCRIPT: void OnStart() { AddEntityCollideCallback("upstairs_doorhead_2", "upstairs_doorarea_2", "upstairsdoor2", true, 1); AddEntityCollideCallback("upstairs_doorhead_1", "upstairs_doorarea_1", "upstairsdoor1", true, 1); } void upstairsdoor1(string &in asParent, string &in asChild, int alState) { SetEntityActive("upstairs_doorhead_1", false); SetEntityActive("upstairs_doorheadless_1", false); SetEntityActive("upstairs_doorarmor_1", true); if(GetEntityExists("upstairs_doorheadless_2") == true) { SetSwingDoorLocked("upstairs_door", false, false); } else { SetSwingDoorLocked("upstairs_door", false, true); } } void upstairsdoor2(string &in asParent, string &in asChild, int alState) { SetEntityActive("upstairs_doorhead_2", false); SetEntityActive("upstairs_doorheadless_2", false); SetEntityActive("upstairs_doorarmor_2", true); if(GetEntityExists("upstairs_doorheadless_1") == true) { SetSwingDoorLocked("upstairs_door", false, false); } else { SetSwingDoorLocked("upstairs_door", false, true); } } Thanks for your help, Ermu. RE: Lock opened with armor puzzle - SilentStriker - 02-16-2012 Use LocalVarInt and then when the LocalVarInt is 2 then that opens the door RE: Lock opened with armor puzzle - Ermu - 02-16-2012 (02-16-2012, 05:54 PM)SilentStriker Wrote: Use LocalVarInt and then when the LocalVarInt is 2 then that opens the doorNot familiar with that, can you give me example/put it in the script? RE: Lock opened with armor puzzle - Statyk - 02-16-2012 Something like this: //____________________________ void OnStart() { SetLocalVarInt("armorbank", 0); //sets a "bank" for integers to be added and be called later AddEntityCollideCallback("upstairs_doorhead_2", "upstairs_doorarea_2", "upstairsdoor2", true, 1); AddEntityCollideCallback("upstairs_doorhead_1", "upstairs_doorarea_1", "upstairsdoor1", true, 1); } void upstairsdoor1(string &in asParent, string &in asChild, int alState) { SetEntityActive("upstairs_doorhead_1", false); SetEntityActive("upstairs_doorheadless_1", false); SetEntityActive("upstairs_doorarmor_1", true); AddLocalVarInt("armorbank", 1); //Adds ONE to the "armorbank" CHECKHEADS(); //Calls the function below. Saves space } void upstairsdoor2(string &in asParent, string &in asChild, int alState) { SetEntityActive("upstairs_doorhead_2", false); SetEntityActive("upstairs_doorheadless_2", false); SetEntityActive("upstairs_doorarmor_2", true); AddLocalVarInt("armorbank", 1); //Adds ONE to the "armorbank" CHECKHEADS(); //Calls the function below. Saves space } void CHECKHEADS() { if(GetLocalVarInt("armorbank") == 2) //checks the bank. If it has 2, it continues. { SetSwingDoorLocked("upstairs_door", false, true); } } RE: Lock opened with armor puzzle - Ermu - 02-16-2012 Thanks! Works now! Also, i've been wondering, how do you get that blue splash on your screen with the "swoosh" sound when you ie. unlock a door or correctly solve a puzzle. RE: Lock opened with armor puzzle - SilentStriker - 02-16-2012 GiveSanityBoost(); or GiveSanityBoostSmall(); AddPlayerSanity(float afSanity); |