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

Leak issues

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Why is this trigger causing extreme lag, such as the game eventually crashing after several uses.

  • Ice Shard Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Shard
    • Actions
      • Set VariableSet IceShard_Point = (Position of (Target unit of ability being cast))
      • Set VariableSet Iceshard_Group = (Units within 1000.00 of (Position of (Target unit of ability being cast)).)
      • Unit Group - Pick every unit in Iceshard_Group and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Ice Shard Caster for (Owner of (Triggering unit)) at IceShard_Point facing Default building facing degrees
          • Set VariableSet IceShard_Dummy = (Last created unit)
          • Unit - Add a 0.50 second Generic expiration timer to IceShard_Dummy
          • Unit - Set level of Ice Shard (Dummy) for IceShard_Dummy to (Level of Ice Shard for (Triggering unit))
          • Unit - Order IceShard_Dummy to Human Mountain King - Storm Bolt (Picked unit)
      • Custom script: call DestroyGroup (udg_Iceshard_Group)
      • Custom script: call RemoveLocation (udg_IceShard_Point)
 
Level 7
Joined
Feb 23, 2020
Messages
253
I have an initial hunch. Should this only work on enemies?

Wrap your unit group loop actions in an if/then block that checks if the picked unit is an enemy of the triggering unit before running all of the ability's effects.
Well it does only work on enemies since the dummy ability itself can only target enemies, but maybe that's different from the trigger?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,559
You also don't need to create a new Dummy for each picked unit. 1 Dummy can cast Storm Bolt on each of the picked units.

  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set VariableSet Point = (Position of (Target unit of ability being cast))
      • -------- --------
      • Unit - Create 1 Dummy for (Triggering player) at Point facing Default building facing degrees
      • Set VariableSet Dummy = (Last created unit)
      • Unit - Add Storm Bolt to Dummy
      • Unit - Set level of Storm Bolt for Dummy to (Level of (Ability being cast) for (Triggering unit))
      • Unit - Add a 0.50 second Generic expiration timer to Dummy
      • -------- --------
      • Set VariableSet Group = (Units within 1000.00 of Point.)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Triggering player).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is invulnerable) Equal to False
            • Then - Actions
              • Unit - Order Dummy to Human Mountain King - Storm Bolt (Picked unit)
            • Else - Actions
      • -------- --------
      • -------- Clean up leaks --------
Just make sure your Dummy unit has it's Movement Type set to None, Speed Base set to 0, and Art - Animation - Cast Backswing / Cast Point set to 0.00.

If that doesn't fix the lag then you're probably creating some kind of infinite loop in another trigger. Do you have triggers that use "A unit is issued an order", "a unit casts an ability", "A unit enters the map", etc... that could be going off in response to the actions of the Dummy? Or it could be what Planetary said about the Reforged issues, that's probably more likely.
 
Last edited:
Level 14
Joined
Feb 7, 2020
Messages
387
Well it does only work on enemies since the dummy ability itself can only target enemies, but maybe that's different from the trigger?
I don't know if this is an issue introduced by Reforged or if it's always been an issue, but I've found that trying to run functions that deal with incompatible interactions (e.g. trying to issue an enemy-only string order on allies) tends to cause frame dips and can lead to freezes depending on the function.

It's been a few weeks so I don't recall the details, but I had a similar ability that looped through units to do stuff and I forgot to wrap it in an enemy check. It would hang the game for 1-2 seconds every cast.
 
Status
Not open for further replies.
Top