Checking the position of entities - 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: Checking the position of entities (/thread-7823.html) Pages:
1
2
|
RE: Checking the position of entities - dragonlordsd - 05-05-2011 Wow, that's complicated. Alright, I'll give it a shot and tell you how it goes. Thanks for the help. Ugh... I can't see the image you posted... it may be a problem on my end. So there are supposed to be two separate skull entities, and the ones on the floor are supposed to be dyn, but where are the static ones supposed to be? Are they both in the same place, or are the static skulls already in the positions in the drawing? RE: Checking the position of entities - Acies - 05-06-2011 The ones on the floor are static (player is not able to move those) while the ones which are dyn (dynamic = movable) are the ones which the player move around. Ill reupload the image on this site. The script "deactivate" the skulls which are moveable when they come close to the sticky area and "activate" the skulls which are unmovable. Thus, when the player moves one of the skulls close to the position you want that skull "clicks" into place and becomes unmovable. You can place the dynamic skulls where you wish The static (stuck ones) set previously at the positions/places of the ritual by you. The static skulls should be set to be "deactivated" (= invisible for the player), and once activated becomes visible! If you want to you could send me your map and I will do one of the sticky-areas for you. Perhaps that will make it clearer RE: Checking the position of entities - dragonlordsd - 05-06-2011 alright, thanks, I understand now! I was confused because right now the dyn skulls are sitting on the floor, so I thought those were the ones you meant. Thanks for the help RE: Checking the position of entities - Apjjm - 05-06-2011 When an item gets attached to a sticky area, it should become "static" anyway if you disable the detachable property. It may be worth considering the following approach: Have 3 skulls - which the player can move; in this example named moveSkull_1 through moveSkull_3. Next we create a sticky area, which will have the "attachable body name" feild set to "moveSkull_" - this means any of the skulls can be attached to this area. We also want to make the area call a function when a skull is added to the area - to do so we shall set the "attach function" feild to "cbSkullAttach" - which we shall create next. Duplicate this sticky area until you have enough and position the new areas where you want 'em to go - make sure they are active. Feel free to play about with the other settings, though if you plan on making the skulls detachable you will also have to add a detatch callback for reasons that should become apparent. Now it is time to do the scripting. In your hps file add the following function: Code: //Note: In your onStart() function, you will need to initialise The beauty of this approach, is that you can have an arbitrarily high number of skulls or areas (just change the 3 to whatever). You can also have more skulls than areas and allow any of them to be used - which may be more realistic. You can also make specific skulls for specific areas by simply changing the what name of object the sticky area looks for. But what if you want to have a tonne of skulls and skull areas, or edit the puzzle lots and not really wan't to fuss about changing some numbers in a script? Spoiler below!
Edit: Improved the scripts a little, and added a few more notes. Edit 2: Thanks, Acies RE: Checking the position of entities - dragonlordsd - 05-06-2011 Alright, so when I get the time, I'll have to do a comparison to see which way works better... RE: Checking the position of entities - Acies - 05-06-2011 Apjjm's method is better, since it is "generic" (hope that is the english word for it). My method makes you apply Skull A to Area A, while Appjm's method allows you to apply Skull A to Area A, Area B and Area C. Off-Topic: Apjjm, you really know how to script RE: Checking the position of entities - dragonlordsd - 05-06-2011 Alright, I'll take your word for it. Thanks for all the help guys. Hopefully, I'll be able to at least get a demo up some time this weekend. And yeah, generic is an appropriate term here. |