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

About Unit Group Leak

Status
Not open for further replies.
Level 6
Joined
Jan 27, 2007
Messages
208
Just a simple question from me.
  • Unit Group - Remove all units from (Some UnitGroup)
Is that trigger remove Unit Group leak? Because i have a trigger that if i destroy the group, that trigger wont work well (bugged).

Thanks for help.
 
Level 5
Joined
Jul 14, 2008
Messages
121
You could use that:

  • Trigger 1
    • Events
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in ([which group]) and do (Actions)
        • Loop - Actions
or that:

  • Trigger 2
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (which group) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to [which group]
      • Custom script: call DestroyGroup([which group])
Any of those will remove group leaks.
 
Level 6
Joined
Jan 27, 2007
Messages
208
em...Here
  • Ultimate Slash
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ultimate Slash [Warrior]
    • Actions
      • Set temp_CasterPoint = (Position of (Triggering unit))
      • Set temp_Point = (Target point of ability being cast)
      • Set UltimateSlashAngle = (Angle from temp_CasterPoint to temp_Point)
      • Set UltimateSlashDistance = 16.00
      • Set UltimateSlashTime = 1.00
      • Set UltimateSlashCaster = (Triggering unit)
      • Hashtable - Save UltimateSlashAngle as 0 of (Key (Triggering unit)) in UltimateSlashTable
      • Hashtable - Save UltimateSlashDistance as 1 of (Key (Triggering unit)) in UltimateSlashTable
      • Hashtable - Save UltimateSlashTime as 2 of (Key (Triggering unit)) in UltimateSlashTable
      • Hashtable - Save Handle OfUltimateSlashCaster as 3 of (Key (Triggering unit)) in UltimateSlashTable
      • Unit Group - Add (Triggering unit) to UltimateSlashGroup
      • Custom script: call RemoveLocation(udg_temp_Point)
      • Custom script: call RemoveLocation(udg_temp_CasterPoint)
  • Activate Ultimate Slash
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UltimateSlashGroup and do (Actions)
        • Loop - Actions
          • Set UltimateSlashAngle = (Load 0 of (Key (Picked unit)) from UltimateSlashTable)
          • Set UltimateSlashDistance = (Load 1 of (Key (Picked unit)) from UltimateSlashTable)
          • Set UltimateSlashTime = (Load 2 of (Key (Picked unit)) from UltimateSlashTable)
          • Set UltimateSlashCaster = (Load 3 of (Key (Picked unit)) in UltimateSlashTable)
          • Set UltimateSlashCasterPoint[(Player number of (Owner of (Picked unit)))] = (Position of UltimateSlashCaster)
          • Set UltimateSlashUnitGroup[(Player number of (Owner of (Picked unit)))] = (Units within 125.00 of UltimateSlashCasterPoint[(Player number of (Owner of (Picked unit)))] matching ((((Matching unit) belongs to an enemy of (Owner of UltimateSlashCaster)) Equal to True) and (((Matching unit) is in UltimateSlashDamaged[(Player number of
          • Unit Group - Pick every unit in UltimateSlashUnitGroup[(Player number of (Owner of UltimateSlashCaster))] and do (Actions)
            • Loop - Actions
              • Unit - Cause UltimateSlashCaster to damage (Picked unit), dealing (Real(((Strength of UltimateSlashCaster (Include bonuses)) x 5))) damage of attack type Hero and damage type Normal
              • Unit Group - Add (Picked unit) to UltimateSlashDamaged[(Player number of (Owner of UltimateSlashCaster))]
          • Custom script: call DestroyGroup(udg_UltimateSlashUnitGroup[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
          • Custom script: call RemoveLocation(udg_UltimateSlashCasterPoint[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UltimateSlashTime Greater than 0.00
            • Then - Actions
              • Set UltimateSlashPoint[(Player number of (Owner of (Picked unit)))] = (Position of (Picked unit))
              • Unit - Move (Picked unit) instantly to (UltimateSlashPoint[(Player number of (Owner of (Picked unit)))] offset by UltimateSlashDistance towards UltimateSlashAngle degrees)
              • Unit - Turn collision for (Picked unit) Off
              • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\Polymorph\PolyMorphDoneGround.mdl
              • Special Effect - Destroy (Last created special effect)
              • Hashtable - Save (UltimateSlashTime - 0.04) as 2 of (Key (Picked unit)) in UltimateSlashTable
              • Custom script: call RemoveLocation(udg_UltimateSlashPoint[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
            • Else - Actions
              • Unit - Turn collision for (Picked unit) On
              • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • Unit Group - Remove all units from UltimateSlashDamaged[(Player number of (Owner of UltimateSlashCaster))]
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in UltimateSlashTable
              • Unit Group - Remove (Picked unit) from UltimateSlashGroup
              • Custom script: call RemoveLocation(udg_UltimateSlashPoint[GetConvertedPlayerId(GetOwningPlayer(GetEnumUnit()))])
:|
 
Level 5
Joined
Jul 14, 2008
Messages
121
Ah, I would love to help you, but I don't know hashtable yet... So the triggers are just very confusing to me right now.

Edit: I found the error, Destroy group at the end of the loop.
 
Level 5
Joined
Jul 14, 2008
Messages
121
The problem is that you keep using picked unit after destroying group, not sure but might be it. Maybe you could try using a variable for picked unit.
 
Status
Not open for further replies.
Top