Mana shield that damages attacking units

sunshinex3

You can change this now in User CP.
Reaction score
7
the damage is based on the level of a passive ability that the casting unit has.

Code:
Mana Shild High Lord
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacked unit) has buff Mana Shield (Tal'darim High Lord)) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Mana Shield (Protoss Tal'darim Highlord) for (Attacked unit)) Equal to 1
            Then - Actions
                Unit - Cause (Attacked unit) to damage (Attacking unit), dealing (1.00 x RakshirReal) damage of attack type Spells and damage type Lightning
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Mana Shield (Protoss Tal'darim Highlord) for (Attacked unit)) Equal to 2
                    Then - Actions
                        Unit - Cause (Attacked unit) to damage (Attacking unit), dealing (2.00 x RakshirReal) damage of attack type Spells and damage type Lightning
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Mana Shield (Protoss Tal'darim Highlord) for (Attacked unit)) Equal to 3
                            Then - Actions
                                Unit - Cause (Attacked unit) to damage (Attacking unit), dealing (3.00 x RakshirReal) damage of attack type Spells and damage type Lightning
                            Else - Actions
                                Do nothing

this works for me. or corse the variable Rakshir Real must be set so that the ability works,

if i set the variable every time the unit was attacked would that create lag?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Your trigger is far from being good at the moment. You have something that looks like this:
if (x == 1) => something * 1
if (x == 2) => something * 2
if (x == 3) => something * 3

which is quite stupid from a mathematical point of view. Why not rather:
something * x

which would look like this:
Code:
Mana Shild High Lord
   Events
       Unit - A unit Is attacked
   Conditions
       ((Attacked unit) has buff Mana Shield (Tal'darim High Lord)) Equal to True
   Actions
       set SOME_INT = (Level of Mana Shield (Protoss Tal'darim Highlord) for (Attacked unit))
       set SOME_REAL = ((to real(SOME_INT)) x RakshirReal)
       Unit - Cause (Attacked unit) to damage (Attacking unit), dealing SOME_REAL damage of attack type Spells and damage type Lightning

By the way: Setting a variable is as cheap an operation as it gets.
Remember that your trigger will also hit attackers who do not finish their attack. A unit might start its attack animation and cancel it before actually dealing any damage. Those units will still get hurt by your ability. This might not be what you intended.
 

sunshinex3

You can change this now in User CP.
Reaction score
7
is their a way for that unit to finish its attack before the ability triggers?
 

Devalut

TH.net Regular
Reaction score
7
Try *Bribes Damage engine
No jass and easy to use!


The map I provided is the system along with the Mana shield trigger i've edited to damage an attacking unit dealing (5 x lvl of mShield) + 15% + 5% per level of the damage dealt by the attacking unit!

The mana shield is currently on Naga hero

*Link to system
https://www.hiveworkshop.com/threads/damage-engine-3-6-1-0.201016/
 

Attachments

  • Damage Engine v3.6.w3x
    47.8 KB · Views: 285
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top