1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Bad trigger?

Discussion in 'Triggers & Scripts' started by [K40$]-Spectre, Oct 6, 2019.

Tags:
  1. [K40$]-Spectre

    [K40$]-Spectre

    Joined:
    Aug 19, 2007
    Messages:
    1,346
    Resources:
    9
    Maps:
    9
    Resources:
    9
    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: Oct 7, 2019
  2. FeelsGoodMan

    FeelsGoodMan

    Joined:
    Dec 13, 2018
    Messages:
    463
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Please post your trigger in [ trigger ] [ /trigger ] tags.
     
  3. Devalut

    Devalut

    Joined:
    Feb 9, 2009
    Messages:
    794
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Here's a shot in the dark, check your map boundaries, if you have any units touching the edge it may cause a crash if you view them in game.
     
  4. Warseeker

    Warseeker

    Joined:
    Feb 18, 2014
    Messages:
    2,521
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Try turning off your triggers one by one. You'll probably identify which one is causing the crash.
     
  5. Cespie

    Cespie

    Joined:
    May 21, 2019
    Messages:
    344
    Resources:
    0
    Resources:
    0
    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: Oct 9, 2019
  6. [K40$]-Spectre

    [K40$]-Spectre

    Joined:
    Aug 19, 2007
    Messages:
    1,346
    Resources:
    9
    Maps:
    9
    Resources:
    9
    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.