Frictional Games Forum (read-only)
Connect Area to Entity - 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: Connect Area to Entity (/thread-9756.html)

Pages: 1 2


RE: Connect Area to Entity - palistov - 08-14-2011

Try this: Create multiple areas across the section of the map in which the monster can be. In each area create an inactive ragdoll. Use GetEntitiesCollide() to check if the monster is in each area upon death (for loops will do that trick nicely) and then set the appropriate ragdoll active. That's the only solution I can think of.


RE: Connect Area to Entity - Tanshaydar - 08-14-2011

Instead of creating an inactive ragdoll, CreateEntityAtArea() can be used I think. But either way, ragdoll's facing direction is not given.


RE: Connect Area to Entity - palistov - 08-14-2011

Yeah but that'll freeze up the screen for a second, Tanshaydar.


RE: Connect Area to Entity - Tanshaydar - 08-14-2011

Not if the entity is not reached first time. If there is an active or inactive entity in the map, it's already cached. At least, this is how I experienced. I'm not keen to use CreateEntityAtArea for my own reasons.


RE: Connect Area to Entity - Phoroneus - 08-15-2011

I tried a similar approach to yours before, palistov, in order to implement a hypothermia mechanic for an old project (that was until I figured out other means of implementing the mechanic via scripts), and while it technically worked, it was really ugly and inefficient.


RE: Connect Area to Entity - Apjjm - 08-15-2011

You could build a dynamic collision triggered position tracking system with respect to a static object off the map acting as the origin, with the aim of following the monster around, then upon whatever event attaching to the origin using the position of the enemy (relative to the origin). I was planning on building a system like this a while back to track the players position, but I never got around to it.
The general idea was to pick a cube size which is equal to the diameter of the target body, then use Attaching to the origin to remove and create cubes as necessary based on the collisions to track the target. Subdivision can then be used when you need a more precise answer using the cube position mean as a starting point.

Getting the rotation of the enemy is a problem with this system, though, also Attached props do not have physics enabled or collisions.


RE: Connect Area to Entity - Your Computer - 08-15-2011

(08-14-2011, 10:33 PM)Phoroneus Wrote: Bad news. While I've got the code working properly, enemies do not count as props, so nothing can be attached to them.
This may touch on what Apjjm wrote, but depending on how the monster is killed, you could probably pull it off. If you're killing the monster with a weapon, like a sword, then you should be able to attach the ragdoll to the weapon and hopefully RemoveAttachedPropFromProp() does nothing more than the description of the function.



RE: Connect Area to Entity - Phoroneus - 08-15-2011

(08-15-2011, 02:46 AM)Your Computer Wrote:
(08-14-2011, 10:33 PM)Phoroneus Wrote: Bad news. While I've got the code working properly, enemies do not count as props, so nothing can be attached to them.
This may touch on what Apjjm wrote, but depending on how the monster is killed, you could probably pull it off. If you're killing the monster with a weapon, like a sword, then you should be able to attach the ragdoll to the weapon and hopefully RemoveAttachedPropFromProp() does nothing more than the description of the function.

This does work. The only thing left to do is sort out the facing. I could try to get it to recognize physics (e.g. momentum of the monster) but I've spent enough time on this for one day, I think.
I stand corrected: the AttachPropToProp doesn't make the object appear as I thought. The success was caused inadvertently by having an inactive ragdoll entity in my test map. Back to the drawing board, I suppose. Tongue