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

Trigger lags hard after fixing memory leak

Status
Not open for further replies.
Level 11
Joined
Jul 17, 2013
Messages
544
Hello, some weks ago i showed you on this forum my trigger and asked how to fix memory leak in it, you showed my way how to fix i fixed it. but the problem is that every time those triggers are wroking game lags hard and is unplayable time of this trigger must not be greater than 2 seconds.
  • navy
    • Events
      • Time - Every 0.99 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of TempUnit) Equal to TradePort
            • Then - Actions
              • Set TempPoint = (Position of TempUnit)
              • Set TempGroup2 = (Units within 360.00 of TempPoint)
              • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                • Loop - Actions
                  • Set TempUnit2 = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of TempUnit) Not equal to (Owner of TempUnit2)
                      • (TempUnit belongs to an ally of (Owner of TempUnit2)) Equal to True
                      • (Unit-type of TempUnit2) Equal to MerchantShip
                    • Then - Actions
                      • Player - Add 600 to (Owner of TempUnit) Current gold
                      • Unit - Remove TempUnit from the game
                    • Else - Actions
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Custom script: call DestroyGroup(udg_TempGroup2)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
  • land
    • Events
      • Time - Every 0.99 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of TempUnit) Equal to TradeCenter
            • Then - Actions
              • Set TempPoint = (Position of TempUnit)
              • Set TempGroup2 = (Units within 360.00 of TempPoint)
              • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                • Loop - Actions
                  • Set TempUnit2 = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of TempUnit) Not equal to (Owner of TempUnit2)
                      • (TempUnit belongs to an ally of (Owner of TempUnit2)) Equal to True
                      • (Unit-type of TempUnit2) Equal to Convoy with money
                    • Then - Actions
                      • Player - Add 500 to (Owner of TempUnit) Current gold
                      • Unit - Remove TempUnit from the game
                    • Else - Actions
              • Custom script: call RemoveLocation(udg_TempPoint)
              • Custom script: call DestroyGroup(udg_TempGroup2)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)



Trigger named navy is supossed to work like this
Unit merchant goes to trade port of another player and gives 500 gold to owner of trade port. and will work only if owner of merchant and owner of trade port are allies

Trigger named land is supossed to work like this
Unit convoy with money goes to trade center of another player and gives 500 gold to owner of trade port. and will work only if owner of merchant and owner of trade port are allies

Please help :( do you know way to fix it without memory leak and lags? if u know other way to do this than this trigger u can post it
 
Level 11
Joined
Jul 17, 2013
Messages
544
there is old version of trigger Does this tigger leak? if yes then how do i fix its at frist post by me in that thread and in last seems like way of fixing memory leak completly fucked up my trigger :( its not working like i want shipyard gets removed and boat stays here is there another way to do it or u know how to fix it? or maybe give boat some spell and if it uses on shipyard boats get removed and +500 g is given to owner of shipyard? but idk how to do it any ideas
 
Status
Not open for further replies.
Top