[SOLVED] If 'something' collides with area function - 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: [SOLVED] If 'something' collides with area function (/thread-15660.html) |
[SOLVED] If 'something' collides with area function - FlawlessHappiness - 05-27-2012 Yea so i have a bookshelf in one room, with 3 empty spaces. In another room there is a lot of books spread out. I want the player to take three books, from all of those books on the floor, and put them into the three spaces. So there has to be a script in the bookshelf which adds and subtracts 1, for every book colliding and not-colliding with it. And this collide-area has to have a certain script that makes the script trigger if 'something' collides with it. Nothing else can collide with the script, because the spaces are just as small as the books are. Does this kind of script exist? I searched a bit for it, and i got that i could take the books names and make a 'for' script. Is there an easier way around? RE: If 'something' collides with area function - Your Computer - 05-27-2012 Sticky areas. RE: If 'something' collides with area function - FlawlessHappiness - 05-27-2012 Thank you! Still haven't explored all the possibilities of HPL I will check it out! I placed "Add_variable_1" and 2 and 3, under AttachFunction. Here is my script so far Spoiler below!
I had some problems with it, but now it works. Remember to place something in the AttachAbleBodyName RE: If 'something' collides with area function - Twitchez - 05-27-2012 Something similar I used for my mod (but with cogwheels) was that I put three script-areas in the places I wanted the cogs to be. Then I took each cog and made a copy of them, assigned them to static and "non-active". The last thing I did was to use the AddEntityCallBack, so when each cog entered the area near where it should have been, the static cog became "visible" and the one you were moving "non-visible". And if you want to run some sort of script when all the books are in the bookshelf, add 1 to your LocalVarInt for every time you add a book, and for each time the Player puts a book in the bookshelf, run an "if" function. "If LocalVarInt ==3...". //Kind Regards RE: If 'something' collides with area function - FlawlessHappiness - 05-27-2012 Yep. The problem would just be that it wouldn't be the same book that appears, than the one you place RE: If 'something' collides with area function - Twitchez - 05-27-2012 (05-27-2012, 10:50 PM)beecake Wrote: Yep. The problem would just be that it wouldn't be the same book that appears, than the one you placeYou don't have to make it a static, it's just a suggestion. Otherwise, AddEntityCollideCallback is a good suggestion for running your code and for AddLocalVarInt. RE: If 'something' collides with area function - FlawlessHappiness - 05-27-2012 Yea Except with that function i have to specify an item. I just want the player to grab 3 books and put them into the spaces But anyway i have found a solution. The sticky area works perfectly! RE: If 'something' collides with area function - Your Computer - 05-28-2012 (05-27-2012, 07:14 PM)beecake Wrote: I placed "Add_variable_1" and 2 and 3, under AttachFunction. Here's the code i would have used; there's no need to add an AttachAbleBodyName to the sticky area: PHP Code: void AttachFunction(string &in area, string &in object) RE: [SOLVED] If 'something' collides with area function - FlawlessHappiness - 05-28-2012 Yea.. well i don't know.. It works for me with my script |