• 🏆 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!

[Trigger] Damage Area

Status
Not open for further replies.
Level 3
Joined
Jun 15, 2008
Messages
23
Anyone know how to set Damage Area to only hurt enemies? I tried this


Unit Group - Pick every unit in (Units within 400.00 of (Position of Energy[1]) matching ((((Matching unit) belongs to an enemy of (Owner of CastingUnit)) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Unit - Cause CastingUnitKevinSet to damage (Picked unit), dealing (200.00 x (Real((Level of Boom for CastingUnit)))) damage of attack type Spells and damage type Normal)

but it doesnt seem to be working
 
Level 16
Joined
Mar 26, 2004
Messages
569
Anyone know how to set Damage Area to only hurt enemies? I tried this


  • Unit Group - Pick every unit in (Units within 400.00 of (Position of Energy[1]) matching ((((Matching unit) belongs to an enemy of (Owner of CastingUnit)) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Unit - Cause CastingUnitKevinSet to damage (Picked unit), dealing (200.00 x (Real((Level of Boom for CastingUnit)))) damage of attack type Spells and damage type Normal)
but it doesnt seem to be working
I think i encountered the same issue when using matching unit. Make the Unit Group trigger with multiple actions and add a If/Then/Else trigger with your booleans.

  • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Your Unit))) and do (Actions)
    • Loop - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) belongs to an enemy of Your Player) Equal to (==) True
          • ((Picked unit) is alive) Equal to (==) True
        • Then - Actions
          • Unit - Cause (Your Unit) to damage (Picked unit), dealing #Your Value damage of attack type Spells and damage type Normal
        • Else - Actions
 
Level 3
Joined
Jun 15, 2008
Messages
23
hmm i just tried that, didn't work though. Maybe damage target with picked unit is not available.
 
Level 6
Joined
Sep 13, 2008
Messages
261
Simple alternative. Instead of damage area use pick units in area and damage each enemy. like this

  • pickalldamage
    • Events
    • Conditions
    • Actions
      • Unit Group - Add all units of (Units within 512.00 of TempPoint[1]) to TempGrp[1]
      • Unit Group - Pick every unit in TempGrp[1] and do (If (((Picked unit) belongs to an enemy of Player 1 (Red)) Equal to True) then do (Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal) else do (Do nothing))
dont forget to remove leaks by destroying group
 
Level 10
Joined
Jun 16, 2007
Messages
415
Well, maybe you are typing something wrong/using something wrong. Be sure not to mix Picked/Matching Unit up.

Also, use variables and then remove leaks. Your trigger leaks since it doesn't destroy the group...

Basically, go through your trigger and check that (Picked unit) and (Matching Unit) are used at the right places, and make sure that the conditions like that it belongs to an enemy are proper. After that, if it still doesn't work, remove all conditions to see if it damages anyone at all, or if the actions dont work. Then try changing the damage type that is done from spell to something else just to be sure. If none of these work, then post the ENTIRE trigger with all its detail in here.
 
Level 16
Joined
Mar 26, 2004
Messages
569
This worked perfectly fine for me.
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Ability
    • Actions
      • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Triggering unit))) and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (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
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
            • Else - Actions
 
Level 3
Joined
Feb 13, 2008
Messages
65
I would personally use this:

  • Untitled Trigger 001
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to (==) Ability
  • Actions
    • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Triggering unit))) and do (Actions)
      • Loop - Actions
        • Multiple FunctionsIf (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
          • Then - Actions
            • Unit - Set life of (Picked Unit) to ((Life of (Picked unit) - 500).
Note: you can set the "500" to whatever you want.
 
Level 3
Joined
Feb 13, 2008
Messages
65
If you use set life, the player casting the spell won't get the bounty gold nor kill.

You could always add to the trigger a condition that if the unit dies from that trigger a bounty can be rewarded to the triggering unit.

It's just that set life is much more reliable than damage.
 
Level 3
Joined
Jun 15, 2008
Messages
23
Thanks, apparently there are some parts of "damage target" action bugs on some skills events, I would write down my trigger but its pretty big. I tested a simple damage target with "Slow" ability, and the action didnt activate. Then an attack event and it worked fine. Ill probably just use the set life plan since its more reliable.
 
Status
Not open for further replies.
Top