I created a passive ability that has 12% chance of creating a shield that absorbs X damage everytime the hero is attacked.
In other words:
The hero has 12% chance of creating the Elemental Shield everytime is attacked.
The elemental shield lasts 8 seconds, and can absorb up to 225 damage in level 4.
The ability is not multi instanceable, but I really don't care about that.
These are my triggers (probably having a lot of leaks, I'll fix that when I obtain they to work at least):
Variables:
Random: integer variable, self explanatory
ShieldUnit: unit variable, it purpose is for keeping the unit for the third trigger.
ShieldHP: the hit points that the elemental shield can absorb.
Notes:
It can't retrigger itself when active, has a 8 seconds cooldown and 8 seconds duration.
The inner fire thing is for showing the buff in the status bar, and taking care of the duration of the shield throug this.
Well... the problem is that this does not work. It doesn't absorb the damage, and sometimes even heals the hero when it's damaged :nuts:
Any help will be highly appreciated
(sorry for the grammatical errors, I'm not from a english-speaking country)
In other words:
The hero has 12% chance of creating the Elemental Shield everytime is attacked.
The elemental shield lasts 8 seconds, and can absorb up to 225 damage in level 4.
The ability is not multi instanceable, but I really don't care about that.
These are my triggers (probably having a lot of leaks, I'll fix that when I obtain they to work at least):
Code:
ShieldLearns
Events
Unit - A unit Learns a skill
Conditions
(Learned Hero Skill) Equal to Elemental Shield
Actions
Set ShieldUnit = (Learning Hero)
Trigger - Add to ShieldUnitTakesDamage <gen> the event (Unit - ShieldUnit Takes damage)
Code:
ShieldCasting
Events
Unit - A unit Is attacked
Conditions
(Level of Elemental Shield for (Attacked unit)) Not equal to 0
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(ShieldUnitTakesDamage <gen> is on) Equal to False
Then - Actions
Set Random = (Random integer number between 1 and 100)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Random Less than or equal to 12
Then - Actions
Set L = (Position of (Attacked unit))
Unit - Create 1 Dummycaster for (Owner of (Attacked unit)) at L facing Default building facing degrees
Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_L)
Unit - Order (Last created unit) to Human Priest - Inner Fire (Attacked unit)
Set ShieldHP = (25.00 + ((Real((Level of Elemental Shield for (Attacked unit)))) x 50.00))
Trigger - Turn on ShieldUnitTakesDamage <gen>
Trigger - Turn off (This trigger)
Wait until (((Attacked unit) has buff Elemental Shield ) Equal to False), checking every 0.25 seconds
Trigger - Turn on (This trigger)
Trigger - Turn off ShieldUnitTakesDamage <gen>
Else - Actions
Do nothing
Else - Actions
Do nothing
Code:
ShieldUnitTakesDamage [U][B](initially off)[/B][/U]
Events
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Damage taken) Greater than ShieldHP
Then - Actions
Unit - Set life of ShieldUnit to (((Life of ShieldUnit) + (Damage taken)) - ((Damage taken) - ShieldHP))
Unit - Remove Elemental Shield buff from ShieldUnit
Else - Actions
Set ShieldHP = (ShieldHP - (Damage taken))
Unit - Set life of ShieldUnit to ((Life of ShieldUnit) + (Damage taken))
Variables:
Random: integer variable, self explanatory
ShieldUnit: unit variable, it purpose is for keeping the unit for the third trigger.
ShieldHP: the hit points that the elemental shield can absorb.
Notes:
It can't retrigger itself when active, has a 8 seconds cooldown and 8 seconds duration.
The inner fire thing is for showing the buff in the status bar, and taking care of the duration of the shield throug this.
Well... the problem is that this does not work. It doesn't absorb the damage, and sometimes even heals the hero when it's damaged :nuts:
Any help will be highly appreciated
(sorry for the grammatical errors, I'm not from a english-speaking country)