Triggered ability similar to 'Thorns Aura'

dashival

New Member
Reaction score
11
I'm trying to make an ability that is castable on a target enemy unit, and will make that enemy receive a percent damage from on the attacks he makes, sort of like Thorns Aura. I made an ability based on Frost Armor, and it is targetable on enemies. Armor given is 0, the buff is the frost armor buff with different text. I made a trigger that detects when a unit is attacked, and if the attacker has the buff, deal damage to it depending on how much he attacked for.

My question is, can I detect the amount of damage an Attacking Unit inflicts? Or is there some other way to do this spell?
 

Sim

Forum Administrator
Staff member
Reaction score
534
You will need to add to another trigger the event "Unit - A unit takes damage" with (Attacking unit) being your unit with the buff. Next, you just use the function "Event Response - Damage Taken" but beware though as it is a Real number, not an integer.

EDIT : You can run this trigger everytime a unit enters the map.

Code:
Enter N Thorn
  Events
    Unit - A unit enters (Entire map)
  Conditions
  Actions
    Trigger - Add to Thorn Damage <gen> the event (Unit - (Entering unit) takes damage)

And for units already in the map at the beginning :

Code:
Already there N Thorn
  Events
    Map Initialization
  Conditions
  Actions
    Set Leak_UnitGroup = ((Units in (Entire map)) Matching (((Matching unit) Unit-type) Not Equal to YOUR_HERO)
    Unit Group - Pick every units in Leak_UnitGroup and do actions
      Loop - Actions
        Trigger - Add to Thorn Damage <gen> the event (Unit - (Picked unit) takes damage)
    Custom script:   call DestroyGroup(udg_Leak_UnitGroup)

And the real trigger...

Code:
Thorn Damage
  Events
  Conditions
    Dunno if (Attacking unit) applies here... Since it is a damage event.... Anyways try checking if the unit-type of the attacking unit is your hero, 
and if not just create a new trigger that checks [b]everytime[/b] a unit is attacked and if the (attacking unit)'s unit-type is your hero, then set that hero into a variable and use it in this trigger.
  Actions
    Set Damage_Taken = (Damage taken)
    Unit - Cause (Attacking unit) to damage (Triggering unit), dealing Damage_Taken damage of attack type Hero and damage type Normal

That is just a basic view of the trigger. You must modify it according to your map and skills... and stuff.

Have a nice day ! :D
 

dashival

New Member
Reaction score
11
Would this work, by itself? (I just realized that the life will be set extremely low, but does this work?)
Code:
trap
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has buff Frost Armor) Equal to True
    Actions
        Unit - Set life of (Attacking unit) to ((Damage taken) x 0.10)
 

Sim

Forum Administrator
Staff member
Reaction score
534
dashival said:
Would this work, by itself? (I just realized that the life will be set extremely low, but does this work?)
Code:
trap
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has buff Frost Armor) Equal to True
    Actions
        [B]Unit - Set life of (Attacking unit) to ((Damage taken) x 0.10)[/B]

(Damage Taken) ONLY WORKS with the "Takes Damage" event. But that event can only be "added" to other triggers, like I did above.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top