• 🏆 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] Bad trigger?

Status
Not open for further replies.
Level 17
Joined
Aug 19, 2007
Messages
1,380
Howdy, I wanted to create a simple expansion mod for warcraft 3 maps but after x amount of time (usually after 15 or 30 minutes or such) the game crashes and I get a memory error. I think it has to do something with my triggers that mostly involve giving AI orders when they have enough resources as an easy way to let them train/upgrade to custom units & buildings. Luckily nothing too complex, but probably badly clicked together. It had been years that I created warcraft 3 maps so my own memory is a bit cloudy especially with triggers, I do remember that memory leaks need to be prevented so I used the guide on world-editor-tutorials to try to remove them.

Does anyone know what is wrong with the triggers below?:

  • ai towers
    • Events
      • Time - Every 450.00 seconds of game time
    • Conditions
    • Actions
      • Set tempPlayerGroup = (All players matching (((Matching player) controller) Equal to Computer))
      • Player Group - Pick every player in tempPlayerGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) Current gold) Greater than 300
              • ((Picked player) Current lumber) Greater than 200
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Human
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Set tempUnitGroup = (Units owned by (Picked player) of type Guard Tower)
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Advanced Guard Tower
                      • Custom script: call DestroyGroup (udg_tempUnitGroup)
                    • Else - Actions
                      • Set tempUnitGroup = (Units owned by (Picked player) of type Arcane Tower)
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Advanced Arcane Tower
                      • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Orc
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Set tempUnitGroup = (Units owned by (Picked player) of type Watch Tower)
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Advanced Watch Tower
                      • Custom script: call DestroyGroup (udg_tempUnitGroup)
                    • Else - Actions
                      • Set tempUnitGroup = (Units owned by (Picked player) of type Orc Burrow)
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Advanced Orc Burrow
                      • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Undead
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Set tempUnitGroup = (Units owned by (Picked player) of type Spirit Tower)
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Advanced Spirit Tower
                      • Custom script: call DestroyGroup (udg_tempUnitGroup)
                    • Else - Actions
                      • Set tempUnitGroup = (Units owned by (Picked player) of type Nerubian Tower)
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Advanced Nerubian Tower
                      • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Night Elf
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Ancient Protector)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Advanced Ancient Protector
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
            • Else - Actions
      • Custom script: call DestroyForce( udg_tempPlayerGroup)

  • ai heroes
    • Events
      • Time - Every 461.00 seconds of game time
    • Conditions
    • Actions
      • Set tempPlayerGroup = (All players matching (((Matching player) controller) Equal to Computer))
      • Player Group - Pick every player in tempPlayerGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) Current gold) Greater than 500
              • ((Picked player) Current lumber) Greater than 250
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Human
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Altar of Kings)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Lord Garithos
                    • Else - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Sylvanas Windrunner
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Orc
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Altar of Storms)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Gul'dan
                    • Else - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Thrall
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Undead
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Altar of Darkness)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Balnazzar
                    • Else - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Kil'jaeden
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Night Elf
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Altar of Elders)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Malfurion
                    • Else - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Ghost
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
            • Else - Actions
      • Custom script: call DestroyForce( udg_tempPlayerGroup)

  • ai units
    • Events
      • Time - Every 217.00 seconds of game time
    • Conditions
    • Actions
      • Set tempPlayerGroup = (All players matching (((Matching player) controller) Equal to Computer))
      • Player Group - Pick every player in tempPlayerGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) Current gold) Greater than 260
              • ((Picked player) Current lumber) Greater than 130
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Human
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Barracks)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Longbow Archer
                    • Else - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Captain
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Workshop)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Magical Battleship
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Arcane Sanctum)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Hydromancer
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Orc
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Barracks)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Forest Troll Trapper
                    • Else - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Forest Troll Warlord
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Beastiary)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Orc Beastmaster
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Spirit Lodge)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Raging Warlock
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Undead
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Crypt)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Zombie
                    • Else - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Skeletal Orc Enforcer
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Sacrificial Pit)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Sludge Monstrosity
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Temple of the Damned)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Wraith W
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Picked player)) Equal to Night Elf
                • Then - Actions
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Ancient of War)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Random integer number between 1 and 10) Less than or equal to 5
                    • Then - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Sentry
                    • Else - Actions
                      • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Moonwood Archer
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Ancient of Wind)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Wildkin
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                  • Set tempUnitGroup = (Units owned by (Picked player) of type Chimaera Roost)
                  • Unit - Order (Random unit from tempUnitGroup) to train/upgrade to a Hydra
                  • Custom script: call DestroyGroup (udg_tempUnitGroup)
                • Else - Actions
            • Else - Actions
      • Custom script: call DestroyForce( udg_tempPlayerGroup)

  • ai upgrades
    • Events
      • Time - Every 999.00 seconds of game time
    • Conditions
    • Actions
      • Set tempPlayerGroup = (All players matching (((Matching player) controller) Equal to Computer))
      • Player Group - Pick every player in tempPlayerGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) Current gold) Greater than 500
              • ((Picked player) Current lumber) Greater than 300
            • Then - Actions
              • Set tempUnitGroup = (Units owned by (Picked player) matching (((Unit-type of (Matching unit)) Equal to Castle) or (((Unit-type of (Matching unit)) Equal to Fortress) or (((Unit-type of (Matching unit)) Equal to Black Citadel) or ((Unit-type of (Matching unit)) Equal to Tree of E
              • Unit - Order (Random unit from tempUnitGroup) to research Stockades
              • Custom script: call DestroyGroup (udg_tempUnitGroup)
            • Else - Actions
      • Custom script: call DestroyForce( udg_tempPlayerGroup)

  • Shop fix
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Artifact Vault
          • (Unit-type of (Triggering unit)) Equal to Artivact Lounge
          • (Unit-type of (Triggering unit)) Equal to Tomb of Artifacts
          • (Unit-type of (Triggering unit)) Equal to Artifact Wonders
    • Actions
      • Game - Display to (All players) the text: arcane vault upgrad...
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Remove (Triggering unit) from the game
      • Unit - Create 1 (Unit-type of (Triggering unit)) for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation (udg_TempPoint)
 
Last edited:
Level 8
Joined
May 21, 2019
Messages
435
Howdy, I wanted to create a simple expansion mod for warcraft 3 maps but after x amount of time (usually after 15 or 30 minutes or such) the game crashes and I get a memory error. I think it has to do something with my triggers that mostly involve giving AI orders when they have enough resources as an easy way to let them train/upgrade to custom units & buildings. Luckily nothing too complex, but probably badly clicked together. It had been years that I created warcraft 3 maps so my own memory is a bit cloudy especially with triggers, I do remember that memory leaks need to be prevented so I used the guide on world-editor-tutorials to try to remove them.

Does anyone know what is wrong with the triggers below?:

I took a quick look mysef, and the only thing I noticed was that you're using the "units of type" action, which leaks a little bit of memory that can't be cleaned. However, with how far apart your periodic events are, I'd be very surprised if that was causing the memory to crash at 15-30 minutes.
 
Last edited:
Level 17
Joined
Aug 19, 2007
Messages
1,380
Thanks all for replying. I replaced the code tags with trigger. Tnx Cespie for scanning the code. I just noticed that the game crashed when I train a custom unit from the sacrificial pit so I am guessing the crashes earlier are related to the AI Undead cpu's trying to train that unit. I duckduckgo'd and found this thread [Crash] - List of WarCraft III Crashes where it indeed is mentioned as a bug.
 
Status
Not open for further replies.
Top