Spell that hits all units in radius

Hello,

I’m currently trying to convert the Playable Vyrax mod from Torchlight 2 to Grim Dawn but I’m a bit stuck. I want my dragon to do an attack with its tail that hits all units in X range around my character (not a targeted spell, just you press the button, it uses the animation and does a tailswipe that hits all units within a certain radius around myself). I also want my dragon to breathe fire into a certain direction.

I tried around with countless of templates but didn’t really get any satisfying results yet. The only idea I’ve got left is to inject a lua script into every unit in the entire game that registers and unregisters them, and then do the damage via that global list of units (by asking each of those units for their position, calculating whether they are in range and then have them take damage). However, that seems like a pretty brute force method.

Does anyone have any ideas?

First of all forget about lua. It won’t let you do anything similar as you can’t get the coordinates of objects, all you get are values on which base you can calculate the look direction of the character in the game’s turn matrix.

I’d suggest you to look at Skill_AttackRadius or Ring of Steel as it does the same thing just without your animation. All you have to do is adding the corresponding animation to the player character’s animation table as a special animation with a unique name and then put the same name in Skill Config -> skillSpecialAnimationName in your Skill_AttackRadius dbr.

If you then use the skill, your character should do the tail attack and hit all enemies around you in a certain range.

Wow, thanks a lot! No idea how I overlooked it in my intensive search but it does pretty much exactly what I need! Thanks a lot for this!

Any idea how i can do an AoE claw attack (an attack that only hits a small / medium area in front of my dragon)? My idea would be to use the AttackRadius thing since it appears to have an alternateSourceLocation tag, then have it attach to a dummy object that I create using lua in front of my character. Not sure if that works or if there’s a better alternative though? Also I still need to come up with a solution for breathing fire.

Hm, maybe I misunderstood, but isn’t there

Entity.Get(skeletonTargetID):GetCoords().origin

? It gets me all the coordinates if I know the objectID, so I could use those coordinates to calculate the distance although I’m not sure if that actually lets me damage them?

GetCoords gives you some object that you can use to swap position with an entity but the values you can access through origin are vectors that describe the look direction of the character.

There is no way to read out the actual coordinates of an object via lua.

As for the area thing, you may want to have a look at Skill_AttackWeapon as it allows you to set an angle in which your strike will hit in front of the character in Melee Config -> skillTargetAngle.

hm? But GetCoords doesn’t just return origin, it returns the entire 4x3 matrix indicating both location and orientation?

The problem with that thing is that the range is way too low and for some reason I couldn’t get it any higher :<

I’m currently trying the route of spawning an entity and then have it cast the spell. No idea if that will succeed though.

Look at Skill_AttackProjectileAreaEffect.tpl, used by, for instance, Sigil of Consumption. Set its distanceProfile to either Short or Moderate and make the area effect last one second (skillActiveDuration) with a corresponding pfx to suit your needs. One second will be one instance of damage. The only issue with this is that it’d scale with Cast Speed (if it doesn’t have a cooldown) whereas Skill_AttackWeapon.tpl would scale with Attack Speed.

Regarding breathing fire, Skill_AttackWave.tpl used by Forcewave and many already-existing ‘Breathe Fire’ skills.

Unfortunately Projectile-based skills don’t really seem to do what I want, because the projectile doesn’t pierce walls and the same skill might hit the same unit twice (through multiple projectiles hitting the same unit) or not at all (because the unit sits between projectiles).

However I found a complicated solution! :slight_smile:

I made my animation use CreateEntity to place an entity at an attachment point right in front of my dragon, then I use that entities onInitialUpdate method to spawn a Pet at its world coordinates. In the Pets onInitialUpdate I use the character:Kill() to trigger its Skill Configuration’s dyingSkillName in which I use the Skill_AttackRadius from above. So far it seems to work, no idea if it will work well in Multiplayer though, that one still needs to be tested. And yes, it’s a bit hacky.