• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Trigger spell, dealing AoE health dmg

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2010
Messages
344
Trigger spell, dealing AoE health dmg [Solved]

Hi guys,

I try to make a spell gather 20% of allies health in the area into 1 variable integer, and deal that amount to each enemy unit surrounding the caster whilst the allies are healed (the caster is not healed, but takes damage equal to 20% of current health).

But the trigger I've made doesn't seem to work properly.. I think I get the issue, but I just don't know how to arrange it.
Btw, it doesn't need to be MUI, since it's instant - I try to avoid that system. ^^
I've made it so far:

  • Vital Ritual
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blood Boiler (Vital Ritual)
    • Actions
      • Set BloodBoiler_VR_IntegerDmg = 0
      • Set BloodBoiler_VR_Caster = No unit
      • Set BloodBoiler_VR_Target = No unit
      • Set BloodBoiler_VR_Ally = No unit
      • Set BloodBoiler_VR_Caster = (Triggering unit)
      • Set BloodBoiler_VR_Point = (Position of BloodBoiler_VR_Caster)
      • Unit - Cause BloodBoiler_VR_Caster to damage BloodBoiler_VR_Caster, dealing (0.20 x (Max life of BloodBoiler_VR_Caster)) damage of attack type Spells and damage type Normal
      • Unit Group - Pick every unit in (Units within 800.00 of BloodBoiler_VR_Point) and do (Actions)
        • Loop - Actions
          • Set BloodBoiler_VR_Target = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (BloodBoiler_VR_Target is A structure) Not equal to True
              • (BloodBoiler_VR_Target is Magic Immune) Not equal to True
              • (BloodBoiler_VR_Target is dead) Not equal to True
              • (BloodBoiler_VR_Target belongs to an ally of (Owner of BloodBoiler_VR_Caster)) Equal to True
              • BloodBoiler_VR_Target Not equal to BloodBoiler_VR_Caster
            • Then - Actions
              • Set BloodBoiler_VR_IntegerDmg = (BloodBoiler_VR_IntegerDmg + ((Integer(0.20)) x (Integer((Max life of BloodBoiler_VR_Target)))))
              • Unit - Set life of BloodBoiler_VR_Target to ((Life of BloodBoiler_VR_Target) + (0.20 x (Life of BloodBoiler_VR_Target)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (BloodBoiler_VR_Target is A structure) Not equal to True
                  • (BloodBoiler_VR_Target is Magic Immune) Not equal to True
                  • (BloodBoiler_VR_Target is dead) Not equal to True
                  • (BloodBoiler_VR_Target belongs to an enemy of (Owner of BloodBoiler_VR_Caster)) Equal to True
                  • BloodBoiler_VR_Target Not equal to BloodBoiler_VR_Caster
                • Then - Actions
                  • Special Effect - Create a special effect at (Position of BloodBoiler_VR_Target) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                  • Unit - Cause BloodBoiler_VR_Caster to damage BloodBoiler_VR_Target, dealing (Real(BloodBoiler_VR_IntegerDmg)) damage of attack type Spells and damage type Normal
                  • Game - Display to (All players) the text: (String(BloodBoiler_VR_IntegerDmg))
                • Else - Actions
            • Else - Actions
Thank you for dropping by! :)
 
Last edited:
Level 10
Joined
Apr 4, 2010
Messages
509
Instead of picking units in an area, create a group, then pick the units in that group.
  • Set BloodBoiler_VR_TempGroup = Units within 800.00 of BloodBoiler_VR_Point
  • Unit Group - Pick every unit in BloodBoilder_VR_TempGroup

  • ((Integer(0.20)) x (Integer((Max life of BloodBoiler_VR_Target)))))
This doesn't need to be converted to Integer, otherwise, the 0.20 will round down to 0. Integers are flat numbers with no decimal points, used for levels, counting units, etc.

Your If/Then/Else conditions are repeated. You should just do it like this.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (BloodBoiler_VR_Target is A structure) Not equal to True
      • (BloodBoiler_VR_Target is Magic Immune) Not equal to True
      • (BloodBoiler_VR_Target is dead) Not equal to True
      • BloodBoiler_VR_Target Not equal to BloodBoiler_VR_Caster
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (BloodBoiler_VR_Target belongs to an enemy of (Owner of BloodBoiler_VR_Caster)) Equal to True
        • Then - Actions
          • Set BloodBoiler_VR_IntegerDmg = (BloodBoiler_VR_IntegerDmg + ((Integer(0.20)) x (Integer((Max life of BloodBoiler_VR_Target)))))
          • Special Effect - Create a special effect at (Position of BloodBoiler_VR_Target) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
          • Unit - Cause BloodBoiler_VR_Caster to damage BloodBoiler_VR_Target, dealing (Real(BloodBoiler_VR_IntegerDmg)) damage of attack type Spells and damage type Normal
          • Game - Display to (All players) the text: (String(BloodBoiler_VR_IntegerDmg))
        • Else - Actions
          • Unit - Set life of BloodBoiler_VR_Target to ((Life of BloodBoiler_VR_Target) + (0.20 x (Life of BloodBoiler_VR_Target)))

You should destroy your special effect straight after creating it, this will still show the special effect, if you don't destroy it, it's permanent.
  • Special Effect - Destroy (Last created special effect)

  • Set BloodBoiler_VR_Caster = No unit
  • Set BloodBoiler_VR_Target = No unit
  • Set BloodBoiler_VR_Ally = No unit
You don't need to this. Setting a variable replaces the old one.

  • Custom script: call RemoveLocation (udg_BloodBoiler_VR_Point)
  • Custom script: call DestroyGroup(udg_BloodBoiler_VR_TempGroup)
You need these to clear the leaks.
 
Level 8
Joined
Jun 13, 2010
Messages
344
  • ((Integer(0.20)) x (Integer((Max life of BloodBoiler_VR_Target)))))
This doesn't need to be converted to Integer, otherwise, the 0.20 will round down to 0. Integers are flat numbers with no decimal points, used for levels, counting units, etc.

How do you then save the amount of health from all nearby allies and deal it upon nearby enemies?
I have made it like you adviced, but it still does not damage enemies.

  • Vital Ritual
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blood Boiler (Vital Ritual)
    • Actions
      • Set BloodBoiler_VR_IntegerDmg = 0
      • Set BloodBoiler_VR_Caster = No unit
      • Set BloodBoiler_VR_Target = No unit
      • Set BloodBoiler_VR_Ally = No unit
      • Set BloodBoiler_VR_Caster = (Triggering unit)
      • Set BloodBoiler_VR_Point = (Position of BloodBoiler_VR_Caster)
      • Unit - Cause BloodBoiler_VR_Caster to damage BloodBoiler_VR_Caster, dealing (0.20 x (Max life of BloodBoiler_VR_Caster)) damage of attack type Spells and damage type Normal
      • Unit Group - Pick every unit in (Units within 800.00 of BloodBoiler_VR_Point) and do (Actions)
        • Loop - Actions
          • Set BloodBoiler_VR_Target = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (BloodBoiler_VR_Target is A structure) Not equal to True
              • (BloodBoiler_VR_Target is Magic Immune) Not equal to True
              • (BloodBoiler_VR_Target is dead) Not equal to True
              • BloodBoiler_VR_Target Not equal to BloodBoiler_VR_Caster
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (BloodBoiler_VR_Target belongs to an ally of (Owner of BloodBoiler_VR_Caster)) Equal to True
                • Then - Actions
                  • Set BloodBoiler_VR_IntegerDmg = (BloodBoiler_VR_IntegerDmg + ((Integer(0.20)) x (Integer((Max life of BloodBoiler_VR_Target)))))
                  • Special Effect - Create a special effect at (Position of BloodBoiler_VR_Target) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Set life of BloodBoiler_VR_Target to ((Life of BloodBoiler_VR_Target) + (0.20 x (Life of BloodBoiler_VR_Target)))
                • Else - Actions
                  • Special Effect - Create a special effect at (Position of BloodBoiler_VR_Target) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause BloodBoiler_VR_Caster to damage BloodBoiler_VR_Target, dealing (Real(BloodBoiler_VR_IntegerDmg)) damage of attack type Spells and damage type Normal
            • Else - Actions
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
You haven't done what DEE-BOO advised though.. And the new trigger is pretty much the same.

add this before the Unit Group line.
  • Set bj_wantDestroyGroup = true

use the BloodBoiler_VR_Point instead of (Position of BloodBoiler_VR_Target) and remove the variable at the very end of trigger

How do you then save the amount of health from all nearby allies and deal it upon nearby enemies?
Well, dang it. I don't remember how to do it.
 
Level 10
Joined
Apr 4, 2010
Messages
509
Here is my version
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set Caster = (Casting unit)
      • Set Point = (Position of (Caster))
      • Set Group[1] = (Units within 500.00 of Point)
      • Set Group[2] = (Units within 500.00 of Point)
      • Set Damage = 0.00
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in Group[(Integer A)] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((Picked unit) is A structure) Equal to True
                      • ((Picked unit) is Magic Immune) Equal to True
                      • ((Picked unit) is dead) Equal to True
                      • (Picked unit) Equal to Caster
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from Group[1]
                  • Unit Group - Remove (Picked unit) from Group[2]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an enemy of (Owner of Caster)) Equal to True
                    • Then - Actions
                      • Unit Group - Remove (Picked unit) from Group[2]
                      • Set Damage = (Damage + (0.20 x (Life of (Picked unit))))
                    • Else - Actions
                      • Unit Group - Remove (Picked unit) from Group[1]
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in Group[(Integer A)] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer A) Equal to 1
                • Then - Actions
                  • Unit - Cause Caster to damage (Picked unit), dealing Damage damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ((Life of (Picked unit)) x 0.20))
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
                  • Special Effect - Destroy (Last created special effect)
      • Unit - Cause Caster to damage Caster, dealing ((Max life of Caster) x 0.20) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation (udg_Point)
      • Custom script: call DestroyGroup (udg_Group[1])
      • Custom script: call DestroyGroup (udg_Group[2])
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Here is my version
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set Caster = (Casting unit)
      • Set Point = (Position of (Caster))
      • Set Group[1] = (Units within 500.00 of Point)
      • Set Group[2] = (Units within 500.00 of Point)
      • Set Damage = 0.00
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in Group[(Integer A)] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((Picked unit) is A structure) Equal to True
                      • ((Picked unit) is Magic Immune) Equal to True
                      • ((Picked unit) is dead) Equal to True
                      • (Picked unit) Equal to Caster
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from Group[1]
                  • Unit Group - Remove (Picked unit) from Group[2]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) belongs to an enemy of (Owner of Caster)) Equal to True
                    • Then - Actions
                      • Unit Group - Remove (Picked unit) from Group[2]
                      • Set Damage = (Damage + (0.20 x (Life of (Picked unit))))
                    • Else - Actions
                      • Unit Group - Remove (Picked unit) from Group[1]
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in Group[(Integer A)] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer A) Equal to 1
                • Then - Actions
                  • Unit - Cause Caster to damage (Picked unit), dealing Damage damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + ((Life of (Picked unit)) x 0.20))
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
                  • Special Effect - Destroy (Last created special effect)
      • Unit - Cause Caster to damage Caster, dealing ((Max life of Caster) x 0.20) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation (udg_Point)
      • Custom script: call DestroyGroup (udg_Group[1])
      • Custom script: call DestroyGroup (udg_Group[2])

That's extremely convuluted :3

  • Vitual Ritual
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blood Boiler (Vital Ritual)
    • Actions
      • Set caster = (Triggering unit)
      • Set player = (Owner of caster)
      • Set tempLoc = (Position of caster)
      • Set tempReal = ((Max life of caster) x 0.20)
      • Unit - Cause caster to damage caster, dealing tempReal damage of attack type Spells and damage type Normal
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 512.00 of tempLoc) and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempUnit Not equal to caster
              • (tempUnit is A structure) Equal to False
              • (tempUnit is alive) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (tempUnit is Magic Immune) Equal to False
                      • (tempUnit belongs to an enemy of player) Equal to True
            • Then - Actions
              • Unit Group - Add tempUnit to damageOrHeal
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (tempUnit belongs to an ally of player) Equal to True
                • Then - Actions
                  • Set tempReal = (tempReal + ((Max life of tempUnit) x 0.20))
                • Else - Actions
                  • -------- tempUnit is an enemy, do not store 20% of their max HP as damage --------
            • Else - Actions
              • -------- tempUnit did not meet filter, do not add them to damageOrHeal group --------
      • Unit Group - Pick every unit in damageOrHeal and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (tempUnit belongs to an ally of player) Equal to True
            • Then - Actions
              • Unit - Set life of tempUnit to ((Life of tempUnit) + ((Life of tempUnit) x 0.20))
            • Else - Actions
              • Unit - Cause caster to damage tempUnit, dealing tempReal damage of attack type Spells and damage type Normal
          • Special Effect - Create a special effect attached to the origin of tempUnit using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit Group - Remove tempUnit from damageOrHeal
      • Custom script: call RemoveLocation(udg_tempLoc)
 
Last edited:
Level 10
Joined
Apr 4, 2010
Messages
509
@KILLCIDE
Derp :| I didn't read his spell description properly. I thought that allies are healed for 20% of their current hp and enemies are damaged for 20% of their hp as a collective.
EDIT:
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set Caster = (Casting unit)
      • Set Point = (Position of Caster)
      • Set Group = (Units within 500.00 of Point)
      • Set Damage = 0.00
      • Unit - Cause Caster to damage Caster, dealing ((Max life of Caster) x 0.20) damage of attack type Spells and damage type Normal
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is A structure) Equal to True
                  • ((Picked unit) is Magic Immune) Equal to True
                  • ((Picked unit) is dead) Equal to True
                  • (Picked unit) Equal to Caster
                  • (Owner of (Picked unit)) Equal to Neutral Passive
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Group
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an ally of (Owner of Caster)) Equal to True
                • Then - Actions
                  • Set Damage = (Damage + (0.20 x (Life of (Picked unit))))
                • Else - Actions
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an ally of (Owner of Caster)) Equal to True
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + Damage)
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Unit - Cause Caster to damage (Picked unit), dealing Damage damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
              • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_Point)
      • Custom script: call DestroyGroup (udg_Group)
 
Status
Not open for further replies.
Top