• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Damaging Problem {damage units over time if they are in range}

Status
Not open for further replies.
Try this:
  • loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set tempp1 = (Position of yourunit1)
      • Set tempp2 = (Position of yourunit2)
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • ((Distance between tempp1 and tempp2) Less than 500)
        • Then - Actions
          • Unit Group - Add yourunit2 to PreventGroup
        • Else - Actions
          • Unit Group - remove yourunit2 from PreventGroup
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • (yourunit2 is in PreventGroup) Equal to False
        • Then - Actions
          • Unit - Order Yourunit1 to damage (Picked unit) dealing DAMAGE damage of attack type Magic and damage type Normal
        • Else - Actions
EDIT Editied trigger, since at first it wasn't excatly what you wanted.
 
Level 24
Joined
Oct 12, 2008
Messages
1,783
Like what?

Just add the damaged unit (picked unit etc.) to a Unit Group, Eg. Damaged_Group

Then just use a condition to ignore the units in Damaged_Group.

Lastly clear the group at the end of the ability or whenever you need to reset it.
 
Level 13
Joined
Oct 25, 2009
Messages
995
Sorry,i have 2 unit group,first unit group is picked unit of enemies,if i use 2 group,cause bug?
  • Unit Group - Pick every unit in TS_Group and do (Actions)
    • Loop - Actions
      • Set TS_PickedUnit = (Picked unit)
      • Set TS_PickedUnitPoint = (Position of TS_PickedUnit)
      • Set TS_PickedUnitOffPoint = (TS_PickedUnitPoint offset by -30.00 towards (Facing of TS_PickedUnit) degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is alive) Equal to True
          • (TS_PickedUnit is in TS_Group) Not equal to True
        • Then - Actions
          • Unit Group - Add TS_PickedUnit to TS_Group2
          • Unit - Move TS_PickedUnit instantly to TS_PickedUnitOffPoint, facing TS_Point2
          • Unit - Cause TS_Dummy[TS_IndexLoop] to damage TS_PickedUnit, dealing 250.00 damage of attack type Spells and damage type Death
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TS_PickedUnitPoint)
      • Custom script: call RemoveLocation(udg_TS_PickedUnitOffPoint)
Just like tat
 
Level 13
Joined
Oct 25, 2009
Messages
995
Does the unit group will leaks?
EDIT: Doesn't work
  • Unit Group - Pick every unit in TS_Group and do (Actions)
    • Loop - Actions
      • Set TS_Point4 = (Position of TS_Dummy[TS_IndexLoop])
      • Set TS_PickedUnit = (Picked unit)
      • Set TS_PickedUnitPoint = (Position of TS_PickedUnit)
      • Set TS_PickedUnitOffPoint = (TS_PickedUnitPoint offset by -30.00 towards (Facing of TS_PickedUnit) degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Picked unit) is alive) Equal to True
        • Then - Actions
          • Unit - Move TS_PickedUnit instantly to TS_PickedUnitOffPoint, facing TS_Point2
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
          • Special Effect - Destroy (Last created special effect)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between TS_PickedUnitPoint and TS_Point4) Less than or equal to 200.00
            • Then - Actions
              • Unit Group - Add TS_PickedUnit to TS_Group2
            • Else - Actions
              • Unit Group - Remove TS_PickedUnit from TS_Group2
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TS_PickedUnit is in TS_Group2) Equal to False
            • Then - Actions
              • Unit - Cause TS_Dummy[TS_IndexLoop] to damage TS_PickedUnit, dealing 250.00 damage of attack type Spells and damage type Normal
            • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TS_PickedUnitPoint)
      • Custom script: call RemoveLocation(udg_TS_PickedUnitOffPoint)
      • Custom script: call RemoveLocation(udg_TS_Point4)
 
Your trigger leaks, and you got a lot of unneed actions. I used only half of variables you have created for making this spell work properly. Although I wasn't changing the purpose of spell I think you should change the knockback and target selection for more realistic effect and other miscellaneous stuff.
Better use expiration timers than exploding unit, trust me.

Here is your test map. I haven't removed non-used variables from variable editor, so you can see what I have done to replace them.

This indexing system is old, and inefficient - you should learn dynamic indexing/use hashtables/unit indexer. However, used that indexing to not make you confused with your own spell.
 

Attachments

  • Tauren smash.w3x
    21.8 KB · Views: 26
Status
Not open for further replies.
Top