Pull lever Combination lock [Help Needed] - 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 (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: Pull lever Combination lock [Help Needed] (/thread-7757.html) |
Pull lever Combination lock [Help Needed] - Simpanra - 05-02-2011 Ok, i have decided to make my next video tutorial on more advanced scripting, in particular; how to make a combination to open or do something (by combo i mean like 3, 2, 4, 1, by pulling levers or books) Lets say i have four levers, each one is called lever1, lever2, lever3 and lever4. And i want them to unlock a door, lets call the door lockeddoor1. Please can somebody make an example script and explain it for me? =) This will be really helpful as i can then make my next video tutorial to put on my thread ^_^ all credit will go to the ones who help me =) thank you, Edd, RE: Pull lever Combination lock [Help Needed] - Kyle - 05-02-2011 It depends what you want to happen once the player does got the combination. RE: Pull lever Combination lock [Help Needed] - Simpanra - 05-02-2011 preferably something cool like a stack of shelves swivelling on an axis to reveal a door, ^_^ RE: Pull lever Combination lock [Help Needed] - Kyle - 05-02-2011 (05-02-2011, 11:16 AM)Simpanra Wrote: preferably something cool like a stack of shelves swivelling on an axis to reveal a door, ^_^ Hmm... I never did something like that before... But I'll try. Code: void OnStart() Ask any questions on how to do it, except now I got to go to school... :/ Also, to quickly say, I would indent it all but it doesn't really work too well on the forums when I post stuff. RE: Pull lever Combination lock [Help Needed] - Simpanra - 05-02-2011 0_0 *tumbleweed tumbles past* well....that looks complicated enough to work.....two questions....number one, when you say "insert what you want to happen here" i have no idea how to make a shelves entity rotate on the X axis...and question two...could you explain the script for me? xDDD Im sorry to be so nooby but i need to understand whats happening so i can explain it in my video =) Thanks man, have a good day at school too =) RE: Pull lever Combination lock [Help Needed] - Kyle - 05-02-2011 I must say thanks. Okay, "SetLocalVarInt("Lev", 1);" sets a local integer named "Lev" that's used as a variable representing 1 as the amount of the variable at the time before it's changed(in the scope(usable in the whole script) of the script). The "SetEntityConnectionStateChangeCallback" is used when a lever, in this case "lever_1", changes state, 1 for down, 0 for middle, -1 for top. So if the lever is pulled up, nothing will happen, but if it's pulled down, then stuff does happens. In the function "L1", it checks to see if the "alState", or which way it's being pulled, and also checks if the local integer variable equals what it asks. So if the local integer variable currently equals 1, and you pull lever_1 down, then the "else if (GetLocalVarInt("Lev") != 3)" checks to see if the local integer variable does NOT equal 3. Since it equals 1, it sets all the levers active again so they can be pulled again in the correct order. So if the player pulls down the correct lever, it sets the local integer variable to the next number so they can pull the next lever. And it also sets the lever to not be able to be interacted with which could cause the player to screw up the combination by accidently pulling it twice, having to restart the combination. Alright, got to go, bye. Also I don't really know how to make the shelves move on it's axis because I never tried. No time, got to go. :/ RE: Pull lever Combination lock [Help Needed] - Roenlond - 05-02-2011 Code: void RotatePropToSpeed(string& asName, float afAcc, float afGoalSpeed, float afAxisX, float afAxisY, float afAxisZ, bool abResetSpeed, string& asOffsetArea); That is most likely the function to use to rotate it. RE: Pull lever Combination lock [Help Needed] - Exostalker - 05-02-2011 Shelf rotate you say? This is what I use, so that after pushing the lever, shelf would rotate: ConnectEntities("shelf_connection", "secret_lever", "secret_shelf", false, 1, "CreateDust"); |