Combination Lock Using Levers Code? - 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: Combination Lock Using Levers Code? (/thread-17014.html) |
Combination Lock Using Levers Code? - Athom - 07-16-2012 Hey everybody! I want to make a combination lock with three levers. The levers are named lever_1, lever_2, and lever_3. I want it to be arranged as 231. so, lever_2, lever_3, lever_1 I need somebody else to write a sample code for this as i am a huge noob. When the correct combination is put in, i want a cabinet to slide/spin to reveal a secret wall with a key inside. If anybody can get back to me with a sample code, i will be eternally grateful! Thank you! RE: Combination Lock Using Levers Code? - Traggey - 07-16-2012 Wrong forum section, this goes to development support, not tech support, moved. RE: Combination Lock Using Levers Code? - Ongka - 07-16-2012 Which combination should unlock the cabinet? 231 is the same as 123. The only difference is the name of levers. RE: Combination Lock Using Levers Code? - Athom - 07-16-2012 (07-16-2012, 01:52 PM)Ongka Wrote: Which combination should unlock the cabinet?I want them im sorry. I didnt know i should post in that section. I want 3 levers in a room and when pulled in this order (middle, right, left) a secret bookcase will open. Can anybody help me with this? RE: Combination Lock Using Levers Code? - Your Computer - 07-16-2012 At first i was going to explain it all, but decided just to post some code: PHP Code: const string[] secret_door_lever_positions = Note, you'll have to change the names of the levers to "lever_middle", "lever_left" and "lever_right". Since you didn't specify which state you want the levers to be pulled at, pulling them in either direction should work. RE: Combination Lock Using Levers Code? - Ongka - 07-17-2012 It might look pretty confusing for a beginner, because of the const string and all that. But anyway, nice work there buddy! RE: Combination Lock Using Levers Code? - Athom - 07-18-2012 I got a friend to help me with the script for it. Here it is for anyone who wants to use it! void LeverPulled(string &in asEntity, int alState) { if(GetLocalVarInt("Sequence") == 0 && asEntity == "lever_2") { AddLocalVarInt("Sequence", 1); SetLeverStuckState(asEntity, alState, true); PlaySoundAtEntity("", "27_tunnel.snt", "Player", 0, false); } if(GetLocalVarInt("Sequence") == 1 && asEntity == "lever_1") { AddLocalVarInt("Sequence", 1); SetLeverStuckState(asEntity, alState, true); PlaySoundAtEntity("", "27_tunnel.snt", "Player", 0, false); } if(GetLocalVarInt("Sequence") == 2 && asEntity == "lever_3") { AddLocalVarInt("Sequence", 1); SetLeverStuckState(asEntity, alState, true); SetMoveObjectState("shelf_secret_door_1", 1); PlaySoundAtEntity("", "scrape_wood_heavy.snt", "Player", 0, false); PlaySoundAtEntity("", "27_tunnel.snt", "Player", 0, false); StopSound("tunnel", 1.0f); GiveSanityBoostsmall(); } There you go. I think it is a bit simpler than the above script! ENJOY! Small edit, fixing "tunnel" sound lasting for a LONG time! (07-18-2012, 09:20 AM)Athom Wrote: I got a friend to help me with the script for it. Here it is for anyone who wants to use it!I give thanks for writing this script to andyrockin123 and Obliviator27! I love you guys! You RULE! |