3 books open door script - 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: 3 books open door script (/thread-17484.html) Pages:
1
2
|
3 books open door script - Lukaboy8 - 08-04-2012 Hello everybody, I want a script in which you have to pull out 3 books out of the shelves withing 30 seconds to unlock a certain door. How can I make this? Luke RE: 3 books open door script - EXAWOLT - 08-04-2012 AddTimer(string& asName, float afTime, string& asFunction); RemoveTimer(string& asName); if timer runs out, use the removecallback func RE: 3 books open door script - Lukaboy8 - 08-04-2012 I also want to know about how to pull out those books of course RE: 3 books open door script - Adny - 08-04-2012 First, make a small script area in front of each book (the book you should be using is under entities > gameplay, top of the list), be sure to place it so when the book is pulled all the way out, it will collide with the area. Now, here's the script (I did this pretty quickly, so I might've forgotten a thing or two): void OnStart() { AddEntityCollideCallback("NAME_OF_BOOK_1", "NAME_OF_AREA_1", "BookFunc", false, 1); AddEntityCollideCallback("NAME_OF_BOOK_2", "NAME_OF_AREA_3", "BookFunc", false, 1); AddEntityCollideCallback("NAME_OF_BOOK_3", "NAME_OF_AREA_3", "BookFunc", false, 1); SetLocalVarInt("BookVar", 0); } void BookFunc(string &in asParent, string &in asChild, int alState) { AddTimer("puzzletimer", 30.0f, "RestartPuzzle"); if(asParent == "NAME_OF_BOOK_1") { AddLocalVarInt("BookVar", 1); GetPuzzleComplete(); } if(asParent == "NAME_OF_BOOK_2") { AddLocalVarInt("BookVar", 1); GetPuzzleComplete(); } if(asParent == "NAME_OF_BOOK_3") { AddLocalVarInt("BookVar", 1); GetPuzzleComplete(); } } void GetPuzzleComplete() { if(GetLocalVarInt("BookVar") == 3) { SetSwingDoorLocked("NAME_OF_DOOR", false, true); RemoveTimer("puzzletimer"); } } void RestartPuzzle(string &in asTimer) { SetLocalVarInt("BookVar", 0); SetMoveObjectState("NAME_OF_BOOK_1", 0); SetMoveObjectState("NAME_OF_BOOK_2", 0); SetMoveObjectState("NAME_OF_BOOK_3", 0); } Hope that helped! RE: 3 books open door script - EXAWOLT - 08-04-2012 there is a book that you always can pull out/in withous any scripts, then you can make a interact area with : AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem); (the book will fall back when touching the area) addtimer then when you draw a new book, the callback should call: remove timer, and addcollidecallback to enable callbacks for the next books RE: 3 books open door script - Lukaboy8 - 08-05-2012 Thanks for the script andyrockin123! But there are some things I want to change in the script but I don't know how. I want the books to go back in the shelf if the puzzle isn't completed within 30 seconds and I want that you aren't able to push the book back in the shelf. This should only happen if it isn't completed after 30 seconds by itself. How can I make something like that? RE: 3 books open door script - SilentStriker - 08-05-2012 Just look in the original game they have the 3 book puzzle there. RE: 3 books open door script - Lukaboy8 - 08-05-2012 I don't know which script, where to find it and then which codes relate to what I want. RE: 3 books open door script - SilentStriker - 08-05-2012 Look in 03_Archives it has the script you want. RE: 3 books open door script - Lukaboy8 - 08-05-2012 Thanks! My script is done now and sounds are in it too! EDIT: I got an error and it says unexpected and of file. This is my script: PHP Code: void OnStart() |