Moving Shelf Using Secret Books - 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: Moving Shelf Using Secret Books (/thread-16259.html) |
Moving Shelf Using Secret Books - SonOfLiberty796 - 06-18-2012 So I wanted to use the secret books method that the original Amnesia game had where when you pulled the books (on time that is), it would open the shelf. However, for me, it's a bit different I want it to be if you pull the right books (some are real, some are fake) the shelf opens and if you pull the fake books, it restarts the whole puzzle. I got the shelf movement to work... sort of. It moves backwards through the wall instead of to the side. That's not how it's suppose to be, it should move to the side, like in the Amnesia game itself. I tried checking how they made it work... but I don't see how! They didn't use an Area or anything like that. They did use the "SetMoveObjectState" and that's pretty much all I see that made me understand how it worked. But somehow, they made their shelf move to the side, not backwards, like mine. Please help!! If you need me to go more into detail, I can record a very quick video demonstrating what I mean. EDIT: I found out what was the problem. Apparently you CANNOT rotate the shelf to whatever position you want it to be (Ex. rotating it -180 on the X axis). How the shelf is placed in the level editor is how the shelf has to be. You cannot touch it, move it, rotate it, NOTHING, or else it doesn't work correctly. Thanks for all the help guys but I figured it out by doing some trial and error. However, you guys gave me some useful info. to use maybe in the future, so thank you for that RE: Moving Shelf Using Secret Books - SilentHideButFine - 06-18-2012 (06-18-2012, 03:02 AM)Xvideogamer720X Wrote: So I wanted to use the secret books method that the original Amnesia game had where when you pulled the books (on time that is), it would open the shelf. However, for me, it's a bit differentvoid OnStart() { for(int i=1;i<=3;i++) AddEntityCollideCallback("SecretBook_"+i, "AreaSecretBook_"+i, "CollideSecretBook", false, 0); } void CollideSecretBook(string &in asParent, string &in asChild, int alState) { if(alState == 1) { SetLocalVarInt("Var"+asParent, 1); AddTimer(asParent, 20, "PushBackBook"); SetPropObjectStuckState(asParent, 1); PlaySoundAtEntity("Sound"+asParent, "gameplay_tick", asParent, 0.0f, false); StartScreenShake(0.001f, 0.5f, 0.5f, 0.5f); PlayGuiSound("16_lever_stuck", 0.3f); /*DEBUG */ AddDebugMessage("Book in area: "+asParent, true); } else { SetLocalVarInt("Var"+asParent, 0); RemoveTimer(asParent); PlaySoundAtEntity("Sound2"+asParent, "lock_door", asParent, 1.5f, false); PlayGuiSound("16_lever_stuck", 0.2f); StopSound("Sound"+asParent, 1.0f); /*DEBUG */ AddDebugMessage("Book out of area: "+asParent, true); } /*All books are pulled before time is out and the secret room is revealed. */ if(GetLocalVarInt("VarSecretBook_1") == 1 && GetLocalVarInt("VarSecretBook_2") == 1 && GetLocalVarInt("VarSecretBook_3") == 1) { FadeLightTo("PointLight_30", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 3.0f); SetMoveObjectState("shelf_secret_door_1", 1); SetPropObjectStuckState("SecretBook_*", -1); SetEntityInteractionDisabled("SecretBook_*", true); PlaySoundAtEntity("BooksDone", "lock_door", "Player", 0, false); CreateParticleSystemAtEntity("dust", "ps_dust_falling_door_quick", "AreaDoorParticle", false); for(int i=1;i<=3;i++){ RemoveTimer("SecretBook_"+i); StopSound("SoundSecretBook_"+i, 0.0f); } GiveSanityBoostSmall(); PlayMusic("03_puzzle_secret.ogg", false, 0.7f, 0, 10, false); SetSwingDoorLocked("shelf02_3", false, true); /*DEBUG */ AddDebugMessage("All books in position, move shelf!", true); } } void PushBackBook(string &in asTimer) { SetPropObjectStuckState(asTimer, -1); AddTimer("2"+asTimer, 0.25f, "PushBackBook02"); /*DEBUG */ AddDebugMessage("Push back book: "+asTimer, true); } void PushBackBook02(string &in asTimer) { if(asTimer == "2SecretBook_1") SetPropObjectStuckState("SecretBook_1", 0); else if(asTimer == "2SecretBook_2") SetPropObjectStuckState("SecretBook_2", 0); else SetPropObjectStuckState("SecretBook_3", 0); } it works for me RE: Moving Shelf Using Secret Books - SonOfLiberty796 - 06-18-2012 That's complicated as hell... I actually saw that in their script, but didn't understand it at all. Looks like I'm gonna have to do some trial and error and see if this will actually work for me. Thanks for the help! Unless someone else could help me with something easier/better or just help me understand that script, but it looks like it doesn't get easier than that. :p RE: Moving Shelf Using Secret Books - Dutton - 06-18-2012 The best thing you could do, is to actually learn what the script means by itself, that way you'll have a better overview of whats happening when, and why. RE: Moving Shelf Using Secret Books - Adny - 06-18-2012 SetMoveObjectState is all you need. 1 refers to the "open" position of something (activated), and 0 refers to the "closed" position of something (inactivated); 0 is the starting position of a given entity unless otherwise changed via the level editor. Also, there are 4 different types of secret moving shelves: shelf_secret_door.ent shelf_secret_door_interact.ent shelf_secret_door_joint.ent shelf_secret_door_rot.ent make sure yours is not interact, joint, or rot. (based on the issue you described, it seems you are using a rotating shelf and have no AngularOffsetArea). Make sure you're using "shelf_secret_door.ent"; this specific shelf moves left/right when the SetMoveObjectState is changed to 1. SilentHideButFine's copy and paste of the shelf puzzle in game isn't very helpful to you; it is a somewhat advanced script that deals with the movement of the books and the effects for the puzzle, rather than the actual movement of the secret shelf. So quick overview: -Use shelf_secret_door.ent -Use SetMoveObjectState and set it to 1 to "activate" the secret shelf Alternatively, if you're interested in the other types of shelves, I am only familiar with a few; if you use the "Rotate" (rot) shelf, you need to go into the level editor and place a script area roughly the same length and height of the bookshelf, and put this area wherever you the bookshelf to "hinge" at, or rotate around. In the bookshelves options, make sure to put the name of the script area in the box under "AngularOffsetArea". Hope that helped! RE: Moving Shelf Using Secret Books - SonOfLiberty796 - 06-18-2012 (06-18-2012, 02:13 PM)andyrockin123 Wrote: SetMoveObjectState is all you need. 1 refers to the "open" position of something (activated), and 0 refers to the "closed" position of something (inactivated); 0 is the starting position of a given entity unless otherwise changed via the level editor.Dude. You don't know how much I love you. *kid voice* You're my new friend *end kid voice* lol :p Thank you SO much! What you wrote is pretty much a guide! You should publish this in the tutorials section of the wiki page. And yeah, the script looked like it was more about the puzzle itself more than the shelf :p not to mention it had all these numbers and symbols and what not that I have not learned. I'll try out what you said and come back with the results; I'm pretty sure what you said will work EDIT: Hmm.. it's still doing the exact same thing. I was really sure that it would finally work, but it didn't :/ I did use the "shelf_secret_door.ent" and made sure I didn't click on or use the other three shelfs... However, what I find strange is that the "shelf_secret_door.ent" (the one you're telling me to use), is it still has the option for an "AngularOffsetArea". I even checked on the original Amnesia map, Archives, and the shelf they are using is the exact same; it also has that "AngularOffestArea" option. I'll keep testing and see what's up... something isn't right here. But yeah, to conclude, I'm still having the same problem :/ RE: Moving Shelf Using Secret Books - SilentStriker - 06-18-2012 I took the time before and messed around with the secret shelf they use in the old archives and the script they use for it to open is pretty straight forward the AngularOffsetArea is where the shelf should rotate so if you put a script area on one side of the shelf and then write the script area inside the AngularOffset option it will rotate around the middle of the script area in the Old Archives they use the ConnectEntities script to make it start rotating RE: Moving Shelf Using Secret Books - SonOfLiberty796 - 06-18-2012 (06-18-2012, 08:04 PM)SilentStriker Wrote: I took the time before and messed around with the secret shelf they use in the old archives and the script they use for it to open is pretty straight forward the AngularOffsetArea is where the shelf should rotate so if you put a script area on one side of the shelf and then write the script area inside the AngularOffset option it will rotate around the middle of the script areaThat's for the rotating shelf, though. And I'm talking about the shelf in the Archives, not the Old Archives. But thanks for telling me this though! It may help in the future EDIT: I found out what was the problem. Apparently you CANNOT rotate the shelf to whatever position you want it to be (Ex. rotating it -180 on the X axis). How the shelf is placed in the level editor is how the shelf has to be. You cannot touch it, move it, rotate it, NOTHING, or else it doesn't work correctly. |