• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Damaging units in area not working

Status
Not open for further replies.
Level 5
Joined
Aug 18, 2013
Messages
85
  • Unit Group - Pick every unit in (Units within 100.00 of (Position of Paladin 0000 <gen>) and do (Unit - Cause (Triggering unit) to damage (Triggering unit), dealing 500.00 damage of attack type Hero and damage type Normal)
What am I doing wrong?
 
Level 25
Joined
Sep 26, 2009
Messages
2,409
First of all, range 100.00 is really small - it's actually the distance between two melee units attacking one another (at least most of the time).
What you need to change is the damage action, where you swap second (Triggering unit) for (Picked unit): "Cause (Triggering unit) to damage (Picked unit) ...."
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
  • Unit Group - Pick every unit in (Units within 100.00 of (Position of Paladin 0000 <gen>) and do (Unit - Cause (Triggering unit) to damage (Triggering unit), dealing 500.00 damage of attack type Hero and damage type Normal)
What am I doing wrong?

What's going on: You're picking every unit within melee range of the Paladin, and ordering the triggering unit to damage themselves. Picking the unit is redundant.

What you want to do: Pick every unit within XX range of the Paladin, and order the a unit to damage the picked unit.
  • Unit Group - Pick every unit in (Units within XX of (Position of Paladin 0000 <gen>) and do (Unit - Cause (Some unit) to damage (Picked unit), dealing 500.00 damage of attack type Hero and damage type Normal)
Remeber: Ordering a unit to damage another unit does not interrupt whatever they are currently doing.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
And also you should match the condition. Without putting the conditions there, your paladin will damage everyone around him including himself.

Good point! Did not think about that :) it should be something like this then (brownie points for making it leakless (;):
  • Actions
    • Set TempAoE = 100
    • Set TempLoc = (Position of Paladin 0000 <gen>))
    • Set TempGroup = (Units within TempAoE of TempLoc matching (((Matching Unit) belongs to an enemy of (Owner of Paladin 0000 <gen>))) Equal to True))
    • Unit Group - Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • Unit - Cause (Some unit) to damage (Picked unit), dealing 500.00 damage of attack type Hero and damage type Normal
    • Custom script: call RemoveLocation (udg_TempLoc)
    • Custom script: call DestroyGroup (udg_TempGroup)
All you have to do is change the conditions to your needs.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
These are the usual filters:
Unit is not dead. (Yet :DDD)
Unit is not a structure.
Unit is an enemy.

  • Actions
    • Set TempUnit[0] = (Triggering unit)
    • Set TempPlayer[0] = (Owner of TempUnit[0])
    • Set TempLocation[0] = (Position of TempUnit[0])
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 512.00 of TempLocation[0]) and do (Actions)
      • Loop - Actions
        • Set TempUnit[1] = (Picked unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (TempUnit[1] is A structure) Equal to False
            • (TempUnit[1] is dead) Equal to False
            • (TempUnit[1] belongs to an enemy of TempPlayer[0]) Equal to True
          • Then - Actions
            • Unit - Cause TempUnit[0] to damage TempUnit[1], dealing 500.00 damage of attack type Hero and damage type Normal
          • Else - Actions
    • Custom script: call RemoveLocation(udg_TempLocation[0])
 
Status
Not open for further replies.
Top