Presense Aura

Level 3
Dec 9, 2009
[solved] Presense Aura

Hey. I need help making a skill. This is the description:

Presense Aura:

The hero gains power from nearby units. For every unit within 1000 AoE he gains damage.

Level 1: 2 bonus damage per unit
Level 2: 3 bonus damage per unit
Level 3: 4 bonus damage per unit
Level 4: 5 bonus damage per unit

I need the triggers to make this work. I would use GUI triggers, but since it's for a ranged unit, it would be rather weird for the damage to take place before the missile has even hit the attacked unit. I need help scripting this in JASS. Could someone help me please?
Last edited:
Level 18
Jan 21, 2006
I could definitely help you out. There are many systems out there that give the user the ability to add/remove damage by the simple call of one function in JASS.

I have made one of these such systems, though it only compiles properly if you use an up-to-date version of Jass NewGen Pack, because it uses the external Object Merger to create abilities. Anyways, here's the link:

Now you'll just have to focus on the nearby units. In order to "talk to" units within a 1000 AoE radius you are going to need to use the function GroupEnumUnitsInRange. Now, its going to look a little something like this:

    integer N

function CountNearby takes nothing returns nothing
    set N = N + 1
set N = 0 
call GroupEnumUnitsInRange( someGroupVar, x, y, 1000, function CountNearby )
// Now the global variable "N" refers to the amount of units within a 1000 AoE radius.

// To keep things simple, I'm just going to add 1 damage per nearby unit. Looks like so:
call UnitModifyAttackDamage( yourCasterVar, N )

There is still a problem here, however, and that is that you're going to need to update the modified damage every small duration so that if the amount of nearby units fluctuates, the ability anticipates the change.

What this means is that a timer will have to constantly update the damage modifier. Also, since the system I directed you to saves a unit's bonus damage (stack-able modifiers), are going to need to somehow reference the "change in nearby units", which will tell you how much damage needs to be added or subtracted.

Another example:
set N = 0 
call GroupEnumUnitsInRange( someGroupVar, x, y, 1000, function CountNearby ) // from before
call UnitModifyAttackDamage( yourCasterVar, N-prevCountVar ) // notice the subtraction for unit-fluctuation

set prevCountVar = N