Colliding Unit Group

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
Hey there, folks !
I've got problems over here, you see this trigger:
  • Untitled Trigger 001
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CasterGroup and do (Actions)
        • Loop - Actions
          • Set Picked = (Picked unit)
          • Set PickedLoc = (Position of Picked)
          • Set MoveLoc = (PickedLoc offset by 25.00 towards (Facing of (Picked unit)) degrees)
          • Unit - Move (Picked unit) instantly to MoveLoc
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 150.00 of MoveLoc matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is in DamagedGroup) Equal to True
                • Then - Actions
                • Else - Actions
                  • Unit - Cause Picked to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
                  • Unit Group - Add (Picked unit) to DamagedGroup
          • Custom script: call RemoveLocation(udg_PickedLoc)
          • Custom script: call RemoveLocation(udg_MoveLoc)
As you can see by name of this trigger, you can tell that is just an example
This trigger will picks up any enemy unit by 150 AOE and damages that unit ONCE per cast
Let's say 2 unit cast at 1 unit at the same time (well, kinda like 0.30 seconds interval), Unit A will of course damage once that unit (that unit is in DamagedGroup), but how do Unit B wants to damage that unit if that unit is still in the group ?
If I immediately remove that unit from that group after damaging it, the next 0.03 second will damage that unit again, causing like 3~5 times of damage to that enemy unit before 150 goes away out of range
So, how do I know for each unit, differs from other, and successfully damages that unit 1 time per cast ?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Untitled Trigger 013
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • *Some ability condition*
    • Actions
      • Custom script: set bj_lastCreatedGroup = CreateGroup()
      • Hashtable - Save Handle Of(Last created unit group) as (Key group) of (Key (Triggering unit)) in hash
  • Untitled Trigger 014
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CasterGroup and do (Actions)
        • Loop - Actions
          • Set u = (Picked unit)
          • Set group = (Load (Key group) of (Key (Picked unit)) in hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (u is alive) Equal to True
            • Then - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within 512.00 of (Center of (Playable map area)) matching (((Triggering unit) is A structure) Equal to True)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is in group) Equal to False
                    • Then - Actions
                      • Unit - Cause u to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
                      • Unit Group - Add (Picked unit) to group
                    • Else - Actions
            • Else - Actions
              • Custom script: call DestroyGroup(udg_group)
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hash
              • Unit Group - Remove u from CasterGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (CasterGroup is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Status
Not open for further replies.
Top