[SCRIPT] Three Books 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] Three Books puzzle (/thread-48791.html) |
Three Books puzzle - serbusfish - 06-01-2016 I am wanting to have the player pull out three books and have a door unlock, and if possible have a time limit + the ticking sound as in the base Amnesia game. I looked how Frictional did it but I cant make much sense of how it works to be honest and I looked for a tutorial but cant find any. I have added 3x script areas in front of each book for them to collide with but that's all I dont know what to do with the script. I'm guessing some sort of local var is needed? Any help would be really appreciated. RE: Three Books puzzle - Mudbill - 06-02-2016 When you pull the book out, it touches the area in front of it. So in your script you will need to add a collision callback to check for this event, one for each book & area. I'm sure they can all call the same code block event. To start off, you'll want to start the timer and ticking noise. Next up, you'll want to add a local variable which will be used to count the amount of books currently positioned. By the end you'll add a check for when that variable is equal to 3, and run the completion event. The timer needs to reset these values and all when it expires. This is just me thinking it in my head, but I believe it will work just fine. But if you need help with the script, here's an example. Hopefully you understand it. PHP Code: void OnStart() Disclaimer: I might've forgotten something. RE: Three Books puzzle - serbusfish - 06-02-2016 (06-02-2016, 03:04 AM)Mudbill Wrote: When you pull the book out, it touches the area in front of it. So in your script you will need to add a collision callback to check for this event, one for each book & area. Brilliant thanks a lot it works perfectly, well almost perfectly. After the first book is pulled the ticking starts, but when the second book is pulled another ticking sound plays on top of the other one, I cant figure out why but to be honest it doesnt matter that much, i'm just happy the puzzle works properly RE: Three Books puzzle - Mudbill - 06-02-2016 Ah, right yeah, that makes sense. You can easily fix that by checking the variable first. PHP Code: if(GetLocalVarInt("Books") == 0) PlaySoundAtEntity(...); |