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

Why does this trigger lag?

Status
Not open for further replies.
Level 11
Joined
Sep 14, 2009
Messages
284
Hi. I have some triggers in my map that are AoE abilities. Each of these trigger cuase a small annoying lag spike everyime they run but I don't know why.

  • EarthBurstCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Pikmok - Earth Burst
    • Actions
      • Set TempPointA = (Position of (Triggering unit))
      • Set TempGroupA = (Units within 425.00 of TempPointA matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to (==) True) and ((Level of Dummy Unit for (Matching unit)) Not equal to (!=) 1)))
      • Custom script: call RemoveLocation(udg_TempPointA)
      • Set AbilityPhysical = True
      • Unit Group - Pick every unit in TempGroupA and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 35.00 damage of attack type Normal and damage type Normal
      • Set AbilityPhysical = False
      • Custom script: call DestroyGroup(udg_TempGroupA)
While AbilityPhysical is true, anything that deals damage will trigger a floating text trigger that creates a floating text. I don't know if that can have something to do with the lag.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
That trigger doesn't lag.

Post your DamageEvent triggers. You might be recursing.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
That trigger alone should not cause any performance problems (unless you stack 100s of units in that tiny area in which case that alone will cause performance problems).

I agree with Arhowk's reasoning that it is likely the result of an expensive damage response.
 
Level 11
Joined
Sep 14, 2009
Messages
284
That trigger alone should not cause any performance problems (unless you stack 100s of units in that tiny area in which case that alone will cause performance problems).

I agree with Arhowk's reasoning that it is likely the result of an expensive damage response.

I use Bribe's damage detection system:

  • Damage Engine
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
      • Game - UnitIndexEvent becomes Equal to 2.00
    • Conditions
    • Actions
      • -------- Copy the Cheat Death Ability from Object Editor into your map and set the following variable respectively: --------
      • Set DamageBlockingAbility = Cheat Death Ability (+500,000)
      • -------- - --------
      • Set DamageTypeSpell = 1
      • Set DamageTypeDOT = 2
      • Set DamageTypeRanged = 3
      • -------- - --------
      • Custom script: call ExecuteFunc("InitDamageEvent")
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvFilter takes nothing returns boolean
      • -------- - --------
      • -------- The next conditions let you filter out unwanted units. By default, units with Locust will not pass the check. --------
      • -------- - --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
          • Then - Actions
            • Custom script: return true
          • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvRemoveAbilities takes nothing returns nothing
      • Custom script: local real r
      • Custom script: loop
      • Set DmgEvN = (DmgEvN - 1)
      • Custom script: set r = GetWidgetLife(udg_DmgEvStack[udg_DmgEvN])
      • Unit - Remove DamageBlockingAbility from DmgEvStack[DmgEvN]
      • Custom script: call SetWidgetLife(udg_DmgEvStack[udg_DmgEvN], r)
      • Set DmgEvStack[DmgEvN] = No unit
      • Custom script: exitwhen udg_DmgEvN == 0
      • Custom script: endloop
      • Custom script: endfunction
      • Custom script:
      • Custom script: function DmgEvSetVars takes nothing returns nothing
      • Set DamageEventAmount = (Damage taken)
      • Set DamageEventSource = (Damage source)
      • Set DamageEventTarget = (Triggering unit)
      • Custom script: endfunction
      • Custom script:
      • Custom script: function FireDmgEv takes nothing returns nothing
      • Custom script: local boolean b = GetUnitAbilityLevel(udg_DamageEventTarget, udg_DamageBlockingAbility) > 0
      • Custom script: local real life = 0
      • Custom script: local real pain = 0
      • Custom script: if b then
      • Custom script: set life = GetWidgetLife(udg_DamageEventTarget)
      • Unit - Remove DamageBlockingAbility from DamageEventTarget
      • Custom script: call SetWidgetLife(udg_DamageEventTarget, life)
      • Custom script: set pain = GetWidgetLife(udg_DamageEventTarget)
      • Custom script: endif
      • Set DamageEventPrevAmt = DamageEventAmount
      • Set DamageEventExplodesUnit = False
      • Set DamageEventOverride = False
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • DamageEventAmount Equal to (==) 0.00
          • Then - Actions
            • Set DamageEvent = 2.00
          • Else - Actions
            • Set DamageModifierEvent = 1.00
            • Set DamageEvent = 1.00
      • Custom script: if b then
      • Unit - Add DamageBlockingAbility to DamageEventTarget
      • Custom script: call SetWidgetLife(udg_DamageEventTarget, life + GetWidgetLife(udg_DamageEventTarget) - pain)
      • Custom script: endif
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • DamageEventAmount Not equal to (!=) DamageEventPrevAmt
          • Then - Actions
            • Set DmgEvLife = ((Life of DamageEventTarget) + (DamageEventPrevAmt - DamageEventAmount))
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DamageEventAmount Greater than (>) DamageEventPrevAmt
                • Then - Actions
                  • Unit - Set life of DamageEventTarget to (Max(0.41, DmgEvLife))
                  • Custom script: if udg_DmgEvLife <= .405 then
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • DamageEventExplodesUnit Equal to (==) True
                      • Then - Actions
                        • Unit - Make DamageEventTarget Explode on death
                      • Else - Actions
                  • Trigger - Turn off DamageEventTrigger
                  • Custom script: call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, 999, false, false, null, null, null)
                  • Trigger - Turn on DamageEventTrigger
                  • Custom script: endif
                • Else - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Max life of DamageEventTarget) Less than (<) DmgEvLife
                    • Then - Actions
                      • Unit - Add DamageBlockingAbility to DamageEventTarget
                      • Set DmgEvStack[DmgEvN] = DamageEventTarget
                      • Set DmgEvN = (DmgEvN + 1)
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • DmgEvN Equal to (==) 1
                          • Then - Actions
                            • Custom script: call TimerStart(udg_DmgEvTimer, 0, false, function DmgEvRemoveAbilities)
                          • Else - Actions
                    • Else - Actions
                  • Unit - Set life of DamageEventTarget to DmgEvLife
          • Else - Actions
      • Custom script: endfunction
      • Custom script:
      • Custom script: function FireRecursiveDmgEv takes nothing returns nothing
      • Custom script: local real d = udg_DamageEventAmount
      • Custom script: local unit s = udg_DamageEventSource
      • Custom script: local unit t = udg_DamageEventTarget
      • Custom script: local integer ptype = udg_DmgTypPrev
      • Custom script: local boolean explode = udg_DamageEventExplodesUnit
      • Custom script: local boolean override = udg_DamageEventOverride
      • Custom script: local real prev = udg_DamageEventPrevAmt
      • Custom script: call DmgEvSetVars()
      • Custom script: if udg_DamageEventTarget != t or udg_DamageEventSource != s or udg_DamageEventAmount != d or udg_DamageEventType != ptype then
      • Set DamageEvent = 0.00
      • Set DamageModifierEvent = 0.00
      • Custom script: call FireDmgEv()
      • -------- - --------
      • -------- Delete the next three lines to disable the in-game recursion crash warnings --------
      • -------- - --------
      • Custom script: else
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) for 999.00 seconds the text: |cffFF2222ERROR|r: ...
      • -------- - --------
      • Custom script: endif
      • Custom script: set udg_DamageEventOverride = override
      • Custom script: set udg_DamageEventExplodesUnit = explode
      • Custom script: set udg_DamageEventPrevAmt = prev
      • Custom script: set udg_DmgTypPrev = ptype
      • Custom script: set udg_DamageEventAmount = d
      • Custom script: set udg_DamageEventSource = s
      • Custom script: set udg_DamageEventTarget = t
      • Custom script: set s = null
      • Custom script: set t = null
      • Custom script: endfunction
      • Custom script:
      • Custom script: function OnDmgEv takes nothing returns boolean
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • DamageEvent Equal to (==) 0.00
          • Then - Actions
            • Set DmgTypPrev = DamageEventType
            • Custom script: call DmgEvSetVars()
            • Custom script: call FireDmgEv()
            • Set DamageModifierEvent = 0.00
            • Set DamageEvent = 0.00
            • Set DamageEventType = 0
          • Else - Actions
            • Custom script: call FireRecursiveDmgEv()
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function CreateDmgEv takes nothing returns nothing
      • Custom script: set udg_DamageEventTrigger = CreateTrigger()
      • Custom script: call TriggerAddCondition(udg_DamageEventTrigger, Filter(function OnDmgEv))
      • Custom script: endfunction
      • Custom script:
      • Custom script: function SetupDmgEv takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • UnitIndexEvent Equal to (==) 1.00
          • Then - Actions
            • Set TempUnit = UDexUnits[UDex]
            • Custom script: if GetUnitAbilityLevel(udg_TempUnit, 'Aloc') == 0 and DmgEvFilter() then
            • Set UnitDamageRegistered[UDex] = True
            • Trigger - Add to DamageEventTrigger the event (Unit - TempUnit Takes damage)
            • Custom script: endif
          • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • UnitDamageRegistered[UDex] Equal to (==) True
              • Then - Actions
                • Set UnitDamageRegistered[UDex] = False
                • Set DamageEventsWasted = (DamageEventsWasted + 1)
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DamageEventsWasted Equal to (==) 15
                    • Then - Actions
                      • Set DamageEventsWasted = 0
                      • Custom script: call DestroyTrigger(udg_DamageEventTrigger)
                      • Custom script: call CreateDmgEv()
                      • Set UDex = UDexNext[0]
                      • Custom script: loop
                      • Custom script: exitwhen udg_UDex == 0
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • UnitDamageRegistered[UDex] Equal to (==) True
                          • Then - Actions
                            • Trigger - Add to DamageEventTrigger the event (Unit - UDexUnits[UDex] Takes damage)
                          • Else - Actions
                      • Set UDex = UDexNext[UDex]
                      • Custom script: endloop
                      • Custom script: set udg_UDex = pdex
                    • Else - Actions
              • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitDamageEvent takes nothing returns nothing
      • Custom script: call CreateDmgEv()
      • Custom script: call TriggerAddCondition(GetTriggeringTrigger(), Filter(function SetupDmgEv))
      • Set UnitIndexerEnabled = False
      • Custom script: set udg_TempUnit = CreateUnit(Player(15), 'uloc', 0, 0, 0)
      • Set UnitIndexerEnabled = True
      • Unit - Add DamageBlockingAbility to TempUnit
      • Unit - Remove TempUnit from the game
      • Countdown Timer - Start DmgEvTimer as a One-shot timer that will expire in 0.00 seconds
      • Trigger - Run (This trigger) (checking conditions)


Here is the floating text trigger:

  • AbilityPhysical
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • AbilityMagical Equal to (==) False
      • AbilityPhysical Equal to (==) True
      • (DamageEventTarget is alive) Equal to (==) True
      • (Level of Critical Strike for DamageEventSource) Not equal to (!=) 1
      • (Level of Dummy Unit for DamageEventTarget) Not equal to (!=) 1
    • Actions
      • Set AbilityDamageAmount = DamageEventAmount
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Owner of DamageEventSource) Equal to (==) Player 9 (Gray)
            • OptionTogglePhysicalDmg Equal to (==) True
          • Then - Actions
            • Set TempPointA = (Position of DamageEventTarget)
            • Floating Text - Create floating text that reads (String((Integer(AbilityDamageAmount)))) at TempPointA with Z offset (0.00 + (AbilityDamageAmount / 100.00)), using font size (9.50 + (AbilityDamageAmount / 500.00)), color (86.32%, 26.95%, 13.28%), and 0.00% transparency
            • Custom script: call RemoveLocation(udg_TempPointA)
            • Floating Text - Change (Last created floating text): Disable permanence
            • Floating Text - Set the velocity of (Last created floating text) to 200.00 towards (Random real number between 60.00 and 120.00) degrees
            • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
            • Floating Text - Change the fading age of (Last created floating text) to 1.25 seconds
          • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (DamageEventSource belongs to an enemy of Player 9 (Gray)) Equal to (==) True
                • OptionToggleEnemyDisplay Equal to (==) True
              • Then - Actions
                • Set TempPointA = (Position of DamageEventTarget)
                • Floating Text - Create floating text that reads (String((Integer(AbilityDamageAmount)))) at TempPointA with Z offset (0.00 + (AbilityDamageAmount / 100.00)), using font size (9.50 + (AbilityDamageAmount / 500.00)), color (86.32%, 26.95%, 13.28%), and 0.00% transparency
                • Custom script: call RemoveLocation(udg_TempPointA)
                • Floating Text - Change (Last created floating text): Disable permanence
                • Floating Text - Set the velocity of (Last created floating text) to 200.00 towards (Random real number between 60.00 and 120.00) degrees
                • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                • Floating Text - Change the fading age of (Last created floating text) to 1.25 seconds
              • Else - Actions


I have used the same kind of triggers for AoE abilities in different maps without the lag.

EDIT: I tested to remove the Damage Target action from the trigger, and the lag still occurs, so that means it's not the damage that cuases the lag. And since there is no damage dealt, there are no other triggers that run when this trigger runs.

I'm starting to think it might be the base ability that cuases the lag. It's based on War Stomp, and most values are set to 0. I will try edit the values and see if the lag dissapears.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
EDIT: I tested to remove the Damage Target action from the trigger, and the lag still occurs, so that means it's not the damage that cuases the lag. And since there is no damage dealt, there are no other triggers that run when this trigger runs.
Or is there? All ability triggers would run still since you are casting "any" ability.
It's based on War Stomp, and most values are set to 0. I will try edit the values and see if the lag dissapears.
Avoid abilities like War Stomp as the terrain deformations are not deterministic (any GetLocationZ will desync) and are notorious for causing other issues. Try using some other instant cast ability.
 
Level 11
Joined
Sep 14, 2009
Messages
284
Or is there? All ability triggers would run still since you are casting "any" ability.

No. Since the other related triggers are triggered by damage events, not unit casting events.

Avoid abilities like War Stomp as the terrain deformations are not deterministic (any GetLocationZ will desync) and are notorious for causing other issues. Try using some other instant cast ability.

Yes, I changed the abilities to the channel ability instead of War stomp and the lag dissapeared. Weird, becuase even tho I set all terrain values in War Stomp to 0 the lag was still there. o_O

Anyways SOLVED.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
you're lagging when your making handles? you might have a bigger problem in ur map o_O
 
Avoid abilities like War Stomp as the terrain deformations are not deterministic (any GetLocationZ will desync) and are notorious for causing other issues. Try using some other instant cast ability.
GetLocationZ is never deterministic anyway, due to walkable destructables (GetLocationZ on walkable destructables depends on the render state of said destructable). Any implementation that uses GetLocationZ for anything else but visual stuff is foolish.
 
Status
Not open for further replies.
Top