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

[Solved] Could these triggers be causing stuttering or Leakage?

Status
Not open for further replies.
Level 10
Joined
Sep 25, 2013
Messages
521
Im using a damage detection system and I'm wondering if having too many damage detection triggers could be causing stuttering which my map has been experiencing lately.

  • Animal Attacked
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • PDD_damageType Equal to PDD_PHYSICAL
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of PDD_target) Equal to Boar |cffff0000(500 Food)|r (Neutral)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (PDD_target is in SlaughteredAnimals) Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Life of PDD_target) Greater than 450.00
                • Then - Actions
                  • Set tempPoint = (Position of PDD_target)
                  • Set tempPoint2 = (Position of PDD_source)
                  • Set tempPoint3 = (tempPoint offset by (Random real number between 50.00 and 100.00) towards (Angle from tempPoint2 to tempPoint) degrees)
                  • Unit - Order PDD_target to Move To tempPoint3
                  • Custom script: call RemoveLocation(udg_tempPoint)
                  • Custom script: call RemoveLocation(udg_tempPoint2)
                  • Custom script: call RemoveLocation(udg_tempPoint3)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Life of PDD_target) Less than or equal to 450.00
                    • Then - Actions
                      • Unit Group - Add PDD_target to SlaughteredAnimals
                      • Unit - Set PDD_target movement speed to 0.00
                      • Animation - Play PDD_target's death animation
                      • Animation - Change PDD_target's vertex coloring to (100.00%, 25.00%, 25.00%) with 0.00% transparency
                      • Unit - Set life of PDD_target to 100.00%
                      • Animation - Play PDD_target's death animation
                    • Else - Actions
            • Else - Actions
              • Set PDD_amount = 2.00
              • Player - Add 2 to (Owner of PDD_source) Current gold
              • Special Effect - Create a special effect attached to the weapon,left of PDD_source using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set tempPoint = (Position of PDD_target)
              • Set tempUnitGroup = (Units within 1000.00 of tempPoint)
              • Unit Group - Pick every unit in tempUnitGroup and do (Actions)
                • Loop - Actions
                  • Set PickedUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Unit-type of PickedUnit) Equal to Boar |cffff0000(500 Food)|r (Neutral)
                          • (Unit-type of PickedUnit) Equal to Deer |cffff0000(300 Food)|r (Neutral)
                    • Then - Actions
                    • Else - Actions
                      • Unit Group - Remove PickedUnit from tempUnitGroup
              • Custom script: call RemoveLocation(udg_tempPoint)
              • Set tempPoint = (Position of (Random unit from tempUnitGroup))
              • Unit - Order PDD_source to Attack-Move To tempPoint
              • Custom script: call RemoveLocation(udg_tempPoint)
              • Custom script: call DestroyGroup (udg_tempUnitGroup)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of PDD_target) Equal to Deer |cffff0000(300 Food)|r (Neutral)
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (PDD_target is in SlaughteredAnimals) Equal to False
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Life of PDD_target) Greater than 250.00
                    • Then - Actions
                      • Set tempPoint = (Position of PDD_target)
                      • Set tempPoint2 = (Position of PDD_source)
                      • Set tempPoint3 = (tempPoint offset by (Random real number between 50.00 and 100.00) towards (Angle from tempPoint2 to tempPoint) degrees)
                      • Unit - Order PDD_target to Move To tempPoint3
                      • Custom script: call RemoveLocation(udg_tempPoint)
                      • Custom script: call RemoveLocation(udg_tempPoint2)
                      • Custom script: call RemoveLocation(udg_tempPoint3)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Life of PDD_target) Less than or equal to 250.00
                        • Then - Actions
                          • Unit Group - Add PDD_target to SlaughteredAnimals
                          • Unit - Set PDD_target movement speed to 0.00
                          • Animation - Play PDD_target's death animation
                          • Animation - Change PDD_target's vertex coloring to (100.00%, 25.00%, 25.00%) with 0.00% transparency
                          • Unit - Set life of PDD_target to 100.00%
                          • Animation - Play PDD_target's death animation
                        • Else - Actions
                • Else - Actions
                  • Set PDD_amount = 2.00
                  • Player - Add 2 to (Owner of PDD_source) Current gold
                  • Special Effect - Create a special effect attached to the weapon,left of PDD_source using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Set tempPoint = (Position of PDD_target)
                  • Set tempUnitGroup = (Units within 1000.00 of tempPoint)
                  • Unit Group - Pick every unit in tempUnitGroup and do (Actions)
                    • Loop - Actions
                      • Set PickedUnit = (Picked unit)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Or - Any (Conditions) are true
                            • Conditions
                              • (Unit-type of PickedUnit) Equal to Boar |cffff0000(500 Food)|r (Neutral)
                              • (Unit-type of PickedUnit) Equal to Deer |cffff0000(300 Food)|r (Neutral)
                        • Then - Actions
                        • Else - Actions
                          • Unit Group - Remove PickedUnit from tempUnitGroup
                  • Custom script: call RemoveLocation(udg_tempPoint)
                  • Set tempPoint = (Position of (Random unit from tempUnitGroup))
                  • Unit - Order PDD_source to Attack-Move To tempPoint
                  • Custom script: call RemoveLocation(udg_tempPoint)
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
            • Else - Actions
  • Iron Hills Automaton Damage Source
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • PDD_damageType Equal to PDD_PHYSICAL
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of PDD_source) Equal to Iron Hills Automaton |cffffff00(Weak vs. Siege/Spells)|r
          • (Unit-type of PDD_source) Equal to Iron Hills Automaton |cffffff00(Weak vs. Siege/Spells)|r (Dwarven Architects)
    • Actions
      • Set tempPoint = (Position of PDD_source)
      • Set tempUnitGroup = (Units within 1000.00 of tempPoint)
      • Unit Group - Pick every unit in tempUnitGroup and do (Actions)
        • Loop - Actions
          • Set PickedUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of PickedUnit) Equal to Iron Hills Automaton |cffffff00(Weak vs. Siege/Spells)|r
                  • (Unit-type of PickedUnit) Equal to Iron Hills Automaton |cffffff00(Weak vs. Siege/Spells)|r (Dwarven Architects)
            • Then - Actions
              • Unit - Set mana of PickedUnit to 0.00%
            • Else - Actions
      • Custom script: call RemoveLocation (udg_tempPoint)
      • Custom script: call DestroyGroup (udg_tempUnitGroup)
  • Anti Siege vs Mechanical
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • PDD_damageType Equal to PDD_PHYSICAL
      • Or - Any (Conditions) are true
        • Conditions
          • (PDD_source has buff Siege ) Equal to True
          • (PDD_source has buff Arrow Cannon ) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (PDD_target has buff Siege ) Equal to True
        • Then - Actions
          • Set PDD_amount = (PDD_amount x 2.00)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (PDD_target has buff Ship ) Equal to True
            • Then - Actions
              • Set PDD_amount = (PDD_amount x 5.00)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (PDD_target has buff Cast Iron Plating (Automatons)) Equal to True
                • Then - Actions
                  • Set PDD_amount = (PDD_amount x 4.00)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (PDD_target has buff Granite Foundations ) Equal to True
                    • Then - Actions
                      • Set PDD_amount = (PDD_amount x 0.75)
                    • Else - Actions
Also, could floating text be an issue? I destroy it afterwards though

  • Harvest Farm
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Harvest (Level 1)(Farm)
          • (Ability being cast) Equal to Harvest (Level 2)(Farm)
          • (Ability being cast) Equal to Harvest (Level 3)(Farm)
          • (Ability being cast) Equal to Harvest (Level 4)(Farm)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Harvest (Level 1)(Farm)
        • Then - Actions
          • Set tempPoint = (Position of (Triggering unit))
          • Player - Add 20 to (Owner of (Triggering unit)) Current gold
          • Special Effect - Create a special effect at tempPoint using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect at tempPoint using UI\Feedback\GoldCredit\GoldCredit.mdl
          • Special Effect - Destroy (Last created special effect)
          • Floating Text - Create floating text that reads +20 at tempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 15.00%, 15.00%), and 0.00% transparency
          • Set tempFloatingText = (Last created floating text)
          • Floating Text - Set the velocity of tempFloatingText to 64.00 towards 90.00 degrees
          • Floating Text - Change tempFloatingText: Disable permanence
          • Floating Text - Change the lifespan of tempFloatingText to 3.00 seconds
          • Floating Text - Change the fading age of tempFloatingText to 0.01 seconds
          • Custom script: call RemoveLocation (udg_tempPoint)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Harvest (Level 2)(Farm)
            • Then - Actions
              • Set tempPoint = (Position of (Triggering unit))
              • Player - Add 23 to (Owner of (Triggering unit)) Current gold
              • Special Effect - Create a special effect at tempPoint using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect at tempPoint using UI\Feedback\GoldCredit\GoldCredit.mdl
              • Special Effect - Destroy (Last created special effect)
              • Floating Text - Create floating text that reads +23 at tempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 15.00%, 15.00%), and 0.00% transparency
              • Set tempFloatingText = (Last created floating text)
              • Floating Text - Set the velocity of tempFloatingText to 64.00 towards 90.00 degrees
              • Floating Text - Change tempFloatingText: Disable permanence
              • Floating Text - Change the lifespan of tempFloatingText to 3.00 seconds
              • Floating Text - Change the fading age of tempFloatingText to 0.01 seconds
              • Custom script: call RemoveLocation (udg_tempPoint)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ability being cast) Equal to Harvest (Level 3)(Farm)
                • Then - Actions
                  • Set tempPoint = (Position of (Triggering unit))
                  • Player - Add 26 to (Owner of (Triggering unit)) Current gold
                  • Special Effect - Create a special effect at tempPoint using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Special Effect - Create a special effect at tempPoint using UI\Feedback\GoldCredit\GoldCredit.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Floating Text - Create floating text that reads +26 at tempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 15.00%, 15.00%), and 0.00% transparency
                  • Set tempFloatingText = (Last created floating text)
                  • Floating Text - Set the velocity of tempFloatingText to 64.00 towards 90.00 degrees
                  • Floating Text - Change tempFloatingText: Disable permanence
                  • Floating Text - Change the lifespan of tempFloatingText to 3.00 seconds
                  • Floating Text - Change the fading age of tempFloatingText to 0.01 seconds
                  • Custom script: call RemoveLocation (udg_tempPoint)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Ability being cast) Equal to Harvest (Level 4)(Farm)
                    • Then - Actions
                      • Set tempPoint = (Position of (Triggering unit))
                      • Player - Add 29 to (Owner of (Triggering unit)) Current gold
                      • Special Effect - Create a special effect at tempPoint using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Special Effect - Create a special effect at tempPoint using UI\Feedback\GoldCredit\GoldCredit.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Floating Text - Create floating text that reads +29 at tempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 15.00%, 15.00%), and 0.00% transparency
                      • Set tempFloatingText = (Last created floating text)
                      • Floating Text - Set the velocity of tempFloatingText to 64.00 towards 90.00 degrees
                      • Floating Text - Change tempFloatingText: Disable permanence
                      • Floating Text - Change the lifespan of tempFloatingText to 3.00 seconds
                      • Floating Text - Change the fading age of tempFloatingText to 0.01 seconds
                      • Custom script: call RemoveLocation (udg_tempPoint)
                    • Else - Actions
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
I took a quick look into the triggers. It seems that you remove your leaks, but having tons of points and groups created in a damage trigger could cause lags, especially if damage comes in very low intervals. I'd suggest you to get rid of the points and use xy coordinates via custom script.
 
Level 10
Joined
Sep 25, 2013
Messages
521
I took a quick look into the triggers. It seems that you remove your leaks, but having tons of points and groups created in a damage trigger could cause lags, especially if damage comes in very low intervals. I'd suggest you to get rid of the points and use xy coordinates via custom script.

Thank you! I appreciate the triggers you did for my map a while ago too, they have been very excellent. I'll look up how to do this and if I get stuck I'll ask.

And thanks Marcos_M, I'll try just having unit groups that are created at initialization and then adding and removing units as i need to. +rep
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
ah i remember ;D

its a bit problematic because GUI functions have no input for coordinates

  • Custom script: local unit u = YOUR_UNIT
  • Custom script: local real x = GetUnitX(u)
  • Custom script: local real y = GetUnitY(u)
  • ...
  • Custom script: call SetUnitX(newX)
  • Custom script: call SetUnitY(newY)
  • Custom script: set u = null
this is just an example.
 
Level 10
Joined
Sep 25, 2013
Messages
521
I have a question about this. I know nothing about jass or the really anything outside of basic GUI. So, when you are setting local unit u = YOUR_UNIT, is YOUR_UNIT just the triggering unit or target of ability unit or whatever? Do i need to set a variable for the triggering unit before the custom script? Lol, in other words, i don't know crap.
 
Level 10
Joined
Sep 25, 2013
Messages
521
OHHHHH!!!! I get it! I knew that was placeholder lol, but I didn't know if it had to refer to a variable i already created or if it could just refer to the triggering unit. I dont think I can set u = null on any of the damage detection triggers as it might destroy the system. Not sure. I'll try and see
 
Level 8
Joined
Jan 28, 2016
Messages
486
This won't fix your problem (it's not exactly relevant to the topic either I guess) but you can optimise your Harvest Farm trigger considerably with a loop. Assuming that each ability can be merged into one and you simple add levels to that single ability, you can use the trigger below.

  • Harvest Farm
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Harvest Farm
    • Actions
      • For each (Integer LoopInteger) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Ability being cast) for (Triggering unit)) Equal to LoopInteger
            • Then - Actions
              • Set TempPoint = (Position of (Triggering unit))
              • Set TempInteger = (17 + (3 x LoopInteger))
              • Player - Add TempInteger to (Owner of (Triggering unit)) Current gold
              • Special Effect - Create a special effect at TempPoint using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Special Effect - Create a special effect at TempPoint using UI\Feedback\GoldCredit\GoldCredit.mdl
              • Special Effect - Destroy (Last created special effect)
              • Floating Text - Create floating text that reads (String(TempInteger)) at TempPoint with Z offset 0.00, using font size 10.00, color (100.00%, 15.00%, 15.00%), and 0.00% transparency
              • Set TempFloatingTag = (Last created floating text)
              • Floating Text - Set the velocity of TempFloatingTag to 64.00 towards 90.00 degrees
              • Floating Text - Change TempFloatingTag: Disable permanence
              • Floating Text - Change the lifespan of TempFloatingTagto 3.00 seconds
              • Floating Text - Change the fading age of TempFloatingTag to 0.01 seconds
              • Custom script: call RemoveLocation( TempPoint )
            • Else - Actions
 
Level 10
Joined
Sep 25, 2013
Messages
521
This won't fix your problem (it's not exactly relevant to the topic either I guess) but you can optimise your Harvest Farm trigger considerably with a loop. Assuming that each ability can be merged into one and you simple add levels to that single ability, you can use the trigger below.

You know, I never used integer loops cause I'm a noob, but I see now how it could be used. Thank you for the optimizing my trigger! The only reason I have it split up into seperate abilities for each level is because the farms are created by upgrading a circle of power. For some reason, when you research the next tier of farming, farms built (upgraded from the circles of power) after the research do not receive the bonus. The upgrade originally just increased the level of Harvest farm for farms. But since that wasn't working i just tried making disable the old level and enable the new level each time. I'm going to try it again though because I will do anything to optimize! lol +rep
 
Status
Not open for further replies.
Top