• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Why does this trigger deal damage to allies and the casters when near enemies?

Status
Not open for further replies.
Level 2
Joined
Jun 1, 2017
Messages
25
^title

  • Stomp
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to STOMP
    • Actions
      • Set CompanionPoint = (Position of Companion_Test)
      • Set BMloc = (Position of (Triggering unit))
      • Set CompantionNearby = (Units within 500.00 of CompanionPoint matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and (((Matching unit) is alive) Equal to True)))
      • Set BMNearby = (Units within 500.00 of BMloc matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and (((Matching unit) is alive) Equal to True)))
      • Unit Group - Pick every unit in BMNearby and do (Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 500.00 at BMloc, dealing ((Real((Strength of (Triggering unit) (Include bonuses)))) x 3.00) damage of attack type Spells and damage type Normal)
      • Unit Group - Pick every unit in CompantionNearby and do (Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 500.00 at CompanionPoint, dealing ((Real((Strength of (Triggering unit) (Include bonuses)))) x 3.00) damage of attack type Spells and damage type Normal)
      • Special Effect - Create a special effect at CompanionPoint using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
      • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
      • Custom script: call RemoveLocation(udg_BMloc)
      • Custom script: call RemoveLocation(udg_CompanionPoint)
      • Custom script: call DestroyGroup(udg_CompantionNearby)
      • Custom script: call DestroyGroup(udg_BMNearby)
  • [trigger/]
 
Level 13
Joined
Oct 12, 2016
Messages
769
You should use an if/then/else statement to sort what units in the unit group get damaged.
For example:
  • Sample Actions
    • Events
    • Conditions
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempGroup = (Units within 250.00 of TempPoint)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
              • ((Unit-type of (Picked unit)) is A flying unit) Equal to False
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_TempPoint)
It's better to set the unit group to "units in range" and damage them individually since it's easier to control the targets affected in the trigger, as you see here.
Doing damage in a circle is indiscriminate.
Note the "250.00" range is a radius, therefore making it a circle with a diameter of 500.00 around the point.
 
Last edited:
Status
Not open for further replies.
Top