Instant kill if HP below X%

Kibaranger

New Member
Reaction score
0
Can someone help me with a spell that deal damage over time and will kill the target instantly if its HP below X% ? (like AA's Ice Blast in dota)
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
You would have to detect the unit that placed the buff on the target, then periodically deal damage to units with the buff. If the unit with the buff has less than X/100 of its max HP, then cause the unit that placed the buff to deal sufficient damage to kill it.
 

Dirac

22710180
Reaction score
147
AA's spell is triggered the way Kaerf above me says, just base the spell off acid bomb and start from there
 

Kibaranger

New Member
Reaction score
0
PHP:
Giga Thundershock
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Giga Thundershock 
    Actions
        Set ShockCaster = (Casting unit)
        Set ShockTarget = (Target unit of ability being cast)
        Trigger - Turn on Giga Thundershock Check <gen>

PHP:
Giga Thundershock Check
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (ShockTarget has buff Giga Thundershock ) Equal to True
            Then - Actions
                Unit - Cause ShockCaster to damage ShockTarget, dealing (25 + (25 x (Real((Level of Giga Thundershock  for ShockCaster))))) damage of attack type Spells and damage type Magic
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Percentage life of ShockTarget) Less than or equal to 35.00
                    Then - Actions
                        Unit - Cause ShockCaster to damage ShockTarget, dealing 100000000.00 damage of attack type Chaos and damage type Normal
                    Else - Actions
            Else - Actions
                Trigger - Turn off (This trigger)
                Custom script:   set udg_ShockCaster = null
                Custom script:   set udg_ShockTarget = null

The trigger I made work oddly. The first cast -> spell work, second cast -> spell not work -> third cast -> spell work and go on.

I don't know what is the real problem here ? Can you help me ?
 

Dirac

22710180
Reaction score
147
are you trying to use the spell again before the buff is over? this will cause trouble since your spell is not MUI and cant happen more than once at the time
 

Kibaranger

New Member
Reaction score
0
I didn't. Even now the spell don't work on the first cast and then the second cast it work. I will try to make it MUI and see what happen.

Can you made a sample trigger for me to compare? That'd be a great help. Thanks in advance.

Here is my MUI remake attempt:

PHP:
Giga Thundershock
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Giga Thundershock 
    Actions
        Set ShockCaster[(Player number of (Owner of (Triggering unit)))] = (Casting unit)
        Set ShockTarget[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
        Trigger - Turn on Giga Thundershock Check <gen>

PHP:
Giga Thundershock Check
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (ShockTarget[(Player number of (Owner of (Triggering unit)))] has buff Giga Thundershock ) Equal to True
            Then - Actions
                Unit - Cause ShockCaster[(Player number of (Owner of (Triggering unit)))] to damage ShockTarget[(Player number of (Owner of (Triggering unit)))], dealing (25.00 + (25.00 x (Real((Level of Giga Thundershock  for ShockCaster[(Player number of (Owner of (Triggering unit)))]))))) damage of attack type Spells and damage type Magic
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Percentage life of ShockTarget[(Player number of (Owner of (Triggering unit)))]) Less than or equal to 20.00
                    Then - Actions
                        Unit - Cause ShockCaster[(Player number of (Owner of (Triggering unit)))] to damage ShockTarget[(Player number of (Owner of (Triggering unit)))], dealing 10000000.00 damage of attack type Chaos and damage type Enhanced
                    Else - Actions
            Else - Actions
                Trigger - Turn off (This trigger)
                Custom script:   set udg_ShockCaster[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = null
                Custom script:   set udg_ShockTarget[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = null

And it did not work :(
 

tommerbob

Minecraft. :D
Reaction score
110
Well to make it MUI (targets only)), you would use a Unit Group. On spell cast, add the target to a unit group. Then in your periodic trigger, Pick every unit in your unit group, and do the actions that you would normally do, referencing (Picked unit). It would look something like this:

Trigger:
  • Events
    • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Giga Thundershock
    • Actions
      • Set ShockCaster = (Triggering unit)
      • Unit Group - Add (Target unit of ability being cast) to ShockGroup
      • Countdown Timer - Start ShockTimer as a Repeating timer that will expire in 1.00 seconds


Trigger:
  • Events
    • Countdown Timer - ShockTimer expires
    • Conditions
    • Actions
      • Pick every unit in ShockGroup and Do Actions
        • Loop - Actions
          • Set ShockTarget = (Picked unit)
          • If (all conditions are true) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ShockTarget has buff Shock) equal to true
            • Then - Actions
              • If (all conditions are true) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Percentage life of ShockTarget) less than or equal to 35.00
                • Then - Actions
                  • Unit - Cause ShockCaster to damage ShockTarget dealing 10000000.00 damage of damage type Chaos and attack type Universal
                  • Unit Group - Remove ShockTarget from ShockGroup
                • Else - Actions
                  • Unit - Cause ShockCaster to damage ShockTarget dealing (25 + (25 x (Real((Level of Giga Thundershock for ShockCaster))))) damage of attack type Spell and damage type Normal
              • Else - Actions
                • Unit Group - Remove ShockTarget from ShockGroup
            • If (all conditions are true) then do (Then actions) else do (else actions)
              • If - Conditions
                • (Number of units in ShockGroup) less than or equal to 0
              • Then - Actions
                • Countdown Timer - Pause ShockTimer
              • Else - Actions


I used a Timer Event instead of a periodic because timers are just better.
 

Dirac

22710180
Reaction score
147
The easy way to make it MUI is this:

Every 1 seconds of game time

Pick every unit in playable map area matching (unit has buff Giga Thundershock equal to true) and do actions
set life of unit to (life of unit - damageequationgoeshere)
if unit life is below 35%
kill unit
then
else

Of course clear all the leaks and stuff, if you want it coded in vJass i got the spare time, just ask me
 
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