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

Crash caused by Triggers

Status
Not open for further replies.
Level 19
Joined
Aug 16, 2007
Messages
881
Well, feels like I'm creating a thread/day, haha, but this one is really important.

The map I'm working at is crashing INSTANTLY with absolutely no error message, at all. Just like that...

I know this must be caused by one (or more) of my triggers and now I wonder what exactly could cause a crash like this?

I know one of them, an infinite loop, but is there any more things? I'm using a lot of loops in my map, but they are GUI-loops and they should be pretty safe, right, because they're just looping through min > max...

Another thing is that the map always crashes after about 12 minutes of gameplay...

So, now I really need all help you've got!

100427LongUnderline.jpg


The Error


I've found the error causing the crash in my map. The thing is... I don't understand the crash and I can't find the crash reason.

I found the error by disabling and enabling triggers and test the map many times and I found out that my duel system is the crash reason. BUT, the duel system has never caused any crashes before... Well, the map runs without a crash more than 20 minutes when I've disabled the Duel system, but if it's activated the map crashes at 11:55 - 12:05.

A fun thing though: I don't even think the trigger will run once, because the event is to run every 720 seconds (12 minutes) but I've got a delay until the trigger will be activated by 120 seconds. If this is a bug caused by wc3 or something I don't know.

Well, I hope you can find something in the triggers (or any optimize solutions):




  • Duel New System
    • Events
      • Time - Every 720.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) for 10.00 seconds the text: |cff008080Game|r: |...
      • Countdown Timer - Start DuelTimer as a One-shot timer that will expire in 180.00 seconds
      • Set DuelTimer = (Last started timer)
      • Countdown Timer - Create a timer window for DuelTimer with title Duel Ends:
      • Set DuelTimerWindow = (Last created timer window)
      • Countdown Timer - Show DuelTimerWindow
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Integer A) Not equal to 6
                  • (Integer A) Not equal to 12
            • Then - Actions
              • Set FDR_RespawnTimer[(Integer A)] = 0
              • Set HeroIsDead[(Integer A)] = False
              • Set TempPoint[0] = ((Player((Integer A))) start location)
              • Hero - Instantly revive Hero[(Integer A)] at TempPoint[0], Show revival graphics
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of Hero[(Integer A)]) Equal to Death Dragon
                • Then - Actions
                  • Animation - Change Hero[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                  • Animation - Change Hero[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with (31.00 x (Real((Level of Ghost Evasion for Hero[(Integer A)]))))% transparency
                • Else - Actions
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Set Duel_StopRegeneration[(Integer A)] = (Life of Hero[(Integer A)])
            • Else - Actions
      • -------- ---- --------
      • Unit - Pause all units
      • -------- ---- --------
      • Trigger - Run CheckHero1 <gen> (checking conditions)
      • -------- ---- --------
      • Trigger - Run CheckHero2 <gen> (checking conditions)
      • -------- ---- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • dd_duellinghero[1] Not equal to No unit
              • dd_duellinghero[2] Not equal to No unit
        • Then - Actions
          • Game - Display to (All players) for 10.00 seconds the text: |cff008080Game|r: |...
          • Set WhatDuelArea = (Random integer number between 1 and 2)
          • Set Duel_Active = True
          • Trigger - Turn off SpawnUnitsSystemNEW <gen>
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WhatDuelArea Equal to 1
            • Then - Actions
              • Set TempPoint[0] = (Center of Team1DuellSpawn <gen>)
            • Else - Actions
              • Set TempPoint[0] = (Center of Team1DuellSpawn2 <gen>)
          • Unit - Move dd_duellinghero[1] instantly to TempPoint[0]
          • Custom script: call RemoveLocation(udg_TempPoint[0])
          • -------- - - - --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WhatDuelArea Equal to 1
            • Then - Actions
              • Set TempPoint[0] = (Center of Team2DuellSpawn <gen>)
            • Else - Actions
              • Set TempPoint[0] = (Center of Team2DuellSpawn2 <gen>)
          • Unit - Move dd_duellinghero[2] instantly to TempPoint[0]
          • -------- SET CAMERA --------
          • For each (Integer A) from 1 to 12, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (Integer A) Not equal to 6
                      • (Integer A) Not equal to 12
                • Then - Actions
                  • Camera - Pan camera for (Player((Integer A))) to TempPoint[0] over 0.00 seconds
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint[0])
          • -------- - - - --------
          • Trigger - Turn on DontLeaveDuelArea <gen>
          • Trigger - Turn on DuelSystemStopRegeneration <gen>
          • Wait 3.00 seconds
          • For each (Integer A) from 1 to 2, do (Actions)
            • Loop - Actions
              • Unit - Remove All buffs from dd_duellinghero[(Integer A)]
              • Unit - Unpause dd_duellinghero[(Integer A)]
              • Unit - Set life of dd_duellinghero[(Integer A)] to 100.00%
              • Unit - Set mana of dd_duellinghero[(Integer A)] to 100.00%
              • Unit - Reset ability cooldowns for dd_duellinghero[(Integer A)]
          • Game - Display to (All players) for 10.00 seconds the text: |cff008080Game|r: |...
        • Else - Actions
          • Game - Display to (All players) for 10.00 seconds the text: |cff008080Game|r: |...
          • Countdown Timer - Destroy DuelTimerWindow
          • Countdown Timer - Pause DuelTimer
          • Set Duel_Active = False
          • Trigger - Turn on SpawnUnitsSystemNEW <gen>
          • Trigger - Turn off DontLeaveDuelArea <gen>
          • -------- ---- --------
          • Unit - Unpause all units
          • -------- ---- --------
          • For each (Integer A) from 1 to 2, do (Actions)
            • Loop - Actions
              • Unit - Move dd_duellinghero[(Integer A)] instantly to dd_duellheropointbefore[(Integer A)]
          • Custom script: call RemoveLocation(udg_dd_duellheropointbefore[1])
          • Custom script: call RemoveLocation(udg_dd_duellheropointbefore[2])
          • Custom script: set udg_dd_duellinghero[1] = null
          • Custom script: set udg_dd_duellinghero[2] = null
      • Trigger - Run PathingBlockersFix AND LightningFix <gen> (checking conditions)



  • DuelSystemStopRegeneration
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Integer[50]) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer[50] Not equal to 6
              • Integer[50] Not equal to 12
              • dd_duellinghero[1] Not equal to Hero[Integer[50]]
              • dd_duellinghero[2] Not equal to Hero[Integer[50]]
            • Then - Actions
              • Unit - Set life of Hero[Integer[50]] to Duel_StopRegeneration[Integer[50]]
            • Else - Actions

  • PathingBlockersFix AND LightningFix
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Duel_Active Equal to True
        • Then - Actions
          • Destructible - Pick every destructible in DuellArea1 <gen> and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked destructible) is alive) Equal to False
                • Then - Actions
                  • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation
                • Else - Actions
          • Destructible - Pick every destructible in DuellArea2 <gen> and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked destructible) is alive) Equal to False
                • Then - Actions
                  • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WhatDuelArea Equal to 1
            • Then - Actions
              • Set TempPoint[0] = (Center of DuelLightning1 <gen>)
              • Set TempPoint[1] = (Center of DuelLightning2 <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[1] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning2 <gen>)
              • Set TempPoint[1] = (Center of DuelLightning3 <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[2] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning3 <gen>)
              • Set TempPoint[1] = (Center of DuelLightning4 <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[3] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning4 <gen>)
              • Set TempPoint[1] = (Center of DuelLightning5 <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[4] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning5 <gen>)
              • Set TempPoint[1] = (Center of DuelLightning6 <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[5] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning6 <gen>)
              • Set TempPoint[1] = (Center of DuelLightning1 <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[6] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
            • Else - Actions
              • Set TempPoint[0] = (Center of DuelLightning1 Copy <gen>)
              • Set TempPoint[1] = (Center of DuelLightning2 Copy <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[1] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning2 Copy <gen>)
              • Set TempPoint[1] = (Center of DuelLightning3 Copy <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[2] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning3 Copy <gen>)
              • Set TempPoint[1] = (Center of DuelLightning4 Copy <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[3] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning4 Copy <gen>)
              • Set TempPoint[1] = (Center of DuelLightning5 Copy <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[4] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning5 Copy <gen>)
              • Set TempPoint[1] = (Center of DuelLightning6 Copy <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[5] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
              • -------- - - - --------
              • Set TempPoint[0] = (Center of DuelLightning6 Copy <gen>)
              • Set TempPoint[1] = (Center of DuelLightning1 Copy <gen>)
              • Lightning - Create a Finger of Death lightning effect from source TempPoint[0] to target TempPoint[1]
              • Set DuelAreaLightning[6] = (Last created lightning effect)
              • Custom script: call RemoveLocation(udg_TempPoint[0])
              • Custom script: call RemoveLocation(udg_TempPoint[1])
        • Else - Actions
          • Destructible - Pick every destructible in DuellArea1 <gen> and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked destructible) is alive) Equal to True
                • Then - Actions
                  • Destructible - Kill (Picked destructible)
                • Else - Actions
          • Destructible - Pick every destructible in DuellArea2 <gen> and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked destructible) is alive) Equal to True
                • Then - Actions
                  • Destructible - Kill (Picked destructible)
                • Else - Actions
          • For each (Integer ISS) from 1 to 6, do (Actions)
            • Loop - Actions
              • Lightning - Destroy DuelAreaLightning[ISS]



  • CheckHero1
    • Events
    • Conditions
    • Actions
      • Set Integer[0] = (Random integer number between 1 and 5)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • dd_duellinghero[1] Equal to No unit
        • Then - Actions
          • Trigger - Run (This trigger) (checking conditions)
        • Else - Actions
          • Set dd_duellinghero[1] = Hero[Integer[0]]
          • Set dd_duellheropointbefore[1] = (Position of Hero[Integer[0]])



  • CheckHero2
    • Events
    • Conditions
    • Actions
      • Set Integer[0] = (Random integer number between 7 and 11)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • dd_duellinghero[2] Equal to No unit
        • Then - Actions
          • Trigger - Run (This trigger) (checking conditions)
        • Else - Actions
          • Set dd_duellinghero[2] = Hero[Integer[0]]
          • Set dd_duellheropointbefore[2] = (Position of Hero[Integer[0]])



  • DuelTimerEnds
    • Events
      • Time - DuelTimer expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy DuelTimerWindow
      • Countdown Timer - Pause DuelTimer
      • Game - Display to (All players) for 10.00 seconds the text: |cff008080Game|r: |...
      • Set Duel_Active = False
      • Unit - Move dd_duellinghero[1] instantly to dd_duellheropointbefore[1]
      • Unit - Move dd_duellinghero[2] instantly to dd_duellheropointbefore[2]
      • Custom script: call RemoveLocation(udg_dd_duellheropointbefore[1])
      • Custom script: call RemoveLocation(udg_dd_duellheropointbefore[2])
      • Custom script: set udg_dd_duellinghero[1] = null
      • Custom script: set udg_dd_duellinghero[2] = null
      • Trigger - Turn on SpawnUnitsSystemNEW <gen>
      • Trigger - Turn off DontLeaveDuelArea <gen>
      • Trigger - Turn off DuelSystemStopRegeneration <gen>
      • Trigger - Run PathingBlockersFix AND LightningFix <gen> (checking conditions)
      • Unit - Unpause all units



  • WinTheDuel
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to dd_duellinghero[1]
          • (Triggering unit) Equal to dd_duellinghero[2]
    • Actions
      • Set Duel_Active = False
      • Game - Display to (All players) for 10.00 seconds the text: (|cff008080Game|r: + (Color[(Player number of (Owner of (Killing unit)))] + (PlayerName[(Player number of (Owner of (Killing unit)))] + |cffFF8000won the duell!|r (|cffffcc00+200 gold|r (|cffffcc00+100 gold/teammate|r)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to dd_duellinghero[1]
        • Then - Actions
          • For each (Integer A) from 7 to 11, do (Actions)
            • Loop - Actions
              • Player - Add 100 to (Player((Integer A))) Current gold
          • Player - Add 100 to (Owner of (Killing unit)) Current gold
          • Unit - Move dd_duellinghero[2] instantly to dd_duellheropointbefore[2]
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to dd_duellinghero[2]
        • Then - Actions
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Player - Add 100 to (Player((Integer A))) Current gold
          • Player - Add 100 to (Owner of (Killing unit)) Current gold
          • Unit - Move dd_duellinghero[1] instantly to dd_duellheropointbefore[1]
        • Else - Actions
      • Custom script: call RemoveLocation(udg_dd_duellheropointbefore[1])
      • Custom script: call RemoveLocation(udg_dd_duellheropointbefore[2])
      • Custom script: set udg_dd_duellinghero[1] = null
      • Custom script: set udg_dd_duellinghero[2] = null
      • Countdown Timer - Pause DuelTimer
      • Countdown Timer - Destroy DuelTimerWindow
      • -------- // Unpause all Units --------
      • Trigger - Turn on SpawnUnitsSystemNEW <gen>
      • Trigger - Turn off DontLeaveDuelArea <gen>
      • Trigger - Turn off DuelSystemStopRegeneration <gen>
      • Trigger - Run PathingBlockersFix AND LightningFix <gen> (checking conditions)
      • Unit - Unpause all units




 
Last edited:
Level 13
Joined
Feb 18, 2009
Messages
1,381
Should i go all the way to Heroes of War and test it? Or are you adding it to this thread?
 
Level 9
Joined
Dec 6, 2007
Messages
233
I had a map crash on me for re-assigning a unit's hashtable variable without clearing the child hashtables of the previously-assigned-handle
 
Level 9
Joined
Dec 6, 2007
Messages
233
yeah, i think the hashtable freaks out when you try to assign 2 things to one spot. After fixing that problem, i always remember to clear childs!
 
Level 9
Joined
Dec 6, 2007
Messages
233
you should only need to initialize them once. I think we've had a failure to communicate, let me explain

  • Set lev
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Summoned unit)) Equal to Leviathan (1)
          • (Unit-type of (Summoned unit)) Equal to Leviathan (2)
          • (Unit-type of (Summoned unit)) Equal to Leviathan (3)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Summoning unit) is in Active_Leviathan_Group) Equal to False
        • Then - Actions
          • -------- if there isn't a leviathan out already, set everything up for the recently spawned one. --------
          • Unit Group - Add (Summoning unit) to Active_Leviathan_Group
          • Hashtable - Save Handle Of(Summoned unit) as Leviathan_Reference of (Key (Summoning unit)) in Leviathan_Hash
          • Hashtable - Save Handle Of(Summoning unit) as Leviathan_Unit of (Key (Summoned unit)) in Leviathan_Hash
          • Set Temp_Loc_1 = ((Position of (Summoning unit)) offset by 500.00 towards 0.00 degrees)
          • Unit - Move (Summoned unit) instantly to Temp_Loc_1
          • Unit Group - Add (Summoned unit) to Leviathan_Unit_Group
          • -------- applys the correct cannon based on ability level --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Leviathan for (Summoning unit)) Equal to 3
            • Then - Actions
              • Unit - Create 1 Leviathan Cannon (3) for (Owner of (Triggering unit)) at Temp_Loc_1 facing Default building facing degrees
              • Hashtable - Save Handle Of(Last created unit) as Leviathan_Cannon of (Key (Summoned unit)) in Leviathan_Hash
            • Else - Actions
              • Unit - Create 1 Leviathan Cannon (1) for (Owner of (Triggering unit)) at Temp_Loc_1 facing Default building facing degrees
              • Hashtable - Save Handle Of(Last created unit) as Leviathan_Cannon of (Key (Summoned unit)) in Leviathan_Hash
        • Else - Actions
          • -------- if there IS a leviathan out, remove the last one, tear everything down for it, then set everything up for the new one --------
          • Unit - Remove (Load Leviathan_Reference of (Key (Summoning unit)) in Leviathan_Hash) from the game
          • Unit - Kill (Load Leviathan_Cannon of (Key (Load Leviathan_Reference of (Key (Summoning unit)) in Leviathan_Hash)) in Leviathan_Hash)
          • Unit Group - Remove (Load Leviathan_Reference of (Key (Summoning unit)) in Leviathan_Hash) from Leviathan_Unit_Group
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Load Leviathan_Unit of (Key (Triggering unit)) in Leviathan_Hash) is in Compound_Group) Equal to True
            • Then - Actions
              • Lightning - Destroy (Load Bonus_Lightning1 of (Key (Load Leviathan_Unit of (Key (Triggering unit)) in Leviathan_Hash)) in Compound_Hash)
              • Lightning - Destroy (Load Bonus_Lightning2 of (Key (Load Leviathan_Unit of (Key (Triggering unit)) in Leviathan_Hash)) in Compound_Hash)
            • Else - Actions
          • Hashtable - Save Handle Of(Summoned unit) as Leviathan_Reference of (Key (Summoning unit)) in Leviathan_Hash
          • Hashtable - Save Handle Of(Summoning unit) as Leviathan_Unit of (Key (Summoned unit)) in Leviathan_Hash
          • Set Temp_Loc_1 = ((Position of (Summoning unit)) offset by 500.00 towards 0.00 degrees)
          • Unit - Move (Summoned unit) instantly to Temp_Loc_1
          • Unit Group - Add (Summoned unit) to Leviathan_Unit_Group
          • -------- applys the correct cannon based on ability level --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Leviathan for (Summoning unit)) Equal to 3
            • Then - Actions
              • Unit - Create 1 Leviathan Cannon (3) for (Owner of (Triggering unit)) at Temp_Loc_1 facing Default building facing degrees
              • Hashtable - Save Handle Of(Last created unit) as Leviathan_Cannon of (Key (Summoned unit)) in Leviathan_Hash
            • Else - Actions
              • Unit - Create 1 Leviathan Cannon (1) for (Owner of (Triggering unit)) at Temp_Loc_1 facing Default building facing degrees
              • Hashtable - Save Handle Of(Last created unit) as Leviathan_Cannon of (Key (Summoned unit)) in Leviathan_Hash
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
      • Trigger - Turn on Leviathan movement <gen>

^that's one of the triggers in my hero contest submission. As you can see, when a leviathan is spawned, it adds it to a unit group and assigns a bunch of hashtable values. If you look, you'll see that the handle of the leviathan is saved as "Leviathan_Reference" of the hero. My issue was that a leviathan would die, the childs would still be there, and I would spawn another one. The new one would be assigned to "Leviathan_Reference", BUT WAIT (*gasp*), there's already a unit there! Now your trying to assign two things to one spot, the trigger takes a crap over it, and warcraft closes without warning.

THE FIX???

  • Leviathan Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Leviathan (2)
          • (Unit-type of (Triggering unit)) Equal to Leviathan (3)
          • (Unit-type of (Triggering unit)) Equal to Leviathan (1)
    • Actions
      • Unit Group - Remove (Load Leviathan_Unit of (Key (Triggering unit)) in Leviathan_Hash) from Active_Leviathan_Group
      • Unit Group - Remove (Triggering unit) from Leviathan_Unit_Group
      • Unit - Remove (Load Leviathan_Cannon of (Key (Triggering unit)) in Leviathan_Hash) from the game
      • -------- destroys lightning --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Load Leviathan_Unit of (Key (Triggering unit)) in Leviathan_Hash) is in Compound_Group) Equal to True
        • Then - Actions
          • Lightning - Destroy (Load Bonus_Lightning1 of (Key (Load Leviathan_Unit of (Key (Triggering unit)) in Leviathan_Hash)) in Compound_Hash)
          • Lightning - Destroy (Load Bonus_Lightning2 of (Key (Load Leviathan_Unit of (Key (Triggering unit)) in Leviathan_Hash)) in Compound_Hash)
          • Unit Group - Remove (Load Leviathan_Unit of (Key (Triggering unit)) in Leviathan_Hash) from Active_Lightning_Group
        • Else - Actions
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Leviathan_Hash

^Right at the bottom:
  • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Leviathan_Hash
^that line of code fixed the deadly crash!!!
 
Level 19
Joined
Aug 16, 2007
Messages
881
No, now I think you missunderstood me. I said, I ONLY initialize the hashtable hashtable ONCE with stuffs and then I won't add more things to it. I can show you the trigger if you want to, there I initializes it.


  • PreCreate Heroes for a Player
    • Events
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set GM_tCH_Hashtable = (Last created hashtable)
      • -------- -------------------------------- --------
      • For each (Integer ForLoopInteger[20]) from 1 to MaxHeroes, do (Actions)
        • Loop - Actions
          • Set GM_tCH_HeroList[ForLoopInteger[20]] = RandomHero[ForLoopInteger[20]]
          • Set GM_tCH_HeroChosen[ForLoopInteger[20]] = False
      • -------- -------------------------------- --------
      • Set ForLoopInteger[1] = 1
      • Custom script: loop
      • Set p = (Player(ForLoopInteger[1]))
      • Set i = ForLoopInteger[1]
      • -------- -------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • i Not equal to 6
              • i Not equal to 12
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (p controller) Equal to User
              • (p slot status) Equal to Is playing
            • Then - Actions
              • Set ForLoopInteger[2] = 0
              • Custom script: loop
              • Set Integer[0] = (Random integer number between 1 and MaxHeroes)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GM_tCH_HeroChosen[Integer[0]] Equal to False
                • Then - Actions
                  • Set GM_tCH_HeroChosen[Integer[0]] = True
                  • Custom script: set udg_UnitType = (udg_GM_tCH_HeroList[udg_Integer[0]])
                  • Hashtable - Save UnitType as ForLoopInteger[2] of i in GM_tCH_Hashtable
                  • -------- Debug Text --------
                  • Game - Display to (All players) the text: (|cffff0000 + ((String(i)) + (|r + (String(UnitType)))))
                  • Set ForLoopInteger[2] = (ForLoopInteger[2] + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ForLoopInteger[2] Greater than or equal to 4
                    • Then - Actions
                      • Set ForLoopInteger[1] = (ForLoopInteger[1] + 1)
                    • Else - Actions
                • Else - Actions
              • Custom script: exitwhen (udg_ForLoopInteger[2] >= 4)
              • Custom script: endloop
            • Else - Actions
              • Set ForLoopInteger[1] = (ForLoopInteger[1] + 1)
        • Else - Actions
          • Set ForLoopInteger[1] = (ForLoopInteger[1] + 1)
      • -------- -------------------------------- --------
      • Custom script: exitwhen (udg_ForLoopInteger[1] > 12)
      • Custom script: endloop
      • -------- -------------------------------- --------
      • Custom script: call DestroyTrigger(gg_trg_PreCreate_Heroes_for_a_Player)


This is the only time I save things to the hashtable... But I never clears it. So I'll try to clear it when I've used it, but I don't really have time to test it today, I'll do it in the weekend. :)

EDIT: (Data in this hashtable shall and won't ever overwrite eachother to cause a crash)
 
Level 9
Joined
Dec 6, 2007
Messages
233
If that's your only trigger involving hashtables, i see no reason that hashtables are to blame for your crash. That's the only real major crash i've ever experienced and fixed, so i'm no good past this. Good luck!

Still clear it though, an expert may correct me if i'm wrong, but it still *MAYBE* might make your map faster.
 
Level 19
Joined
Aug 16, 2007
Messages
881
Yepp, I thought that too, but who knows... It might cause a weird crash anyway, but I doubt it.

And yeah, I think you're correct, it will free up some memory by clearing it (to make the map run faster) but, it's a very small thing that you would not notice it.

Anyway, I'll take a look at it, I hope it won't take years for me to find the error... Thanks for your help +rep

I still need more crash-reasons that may crash the map! :)
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
I'm here to solve all the problems:

don't post asking for help with your map when you don't even give us any details. We're not going to compile a list of the thousands of things that can crash your map, you have to give us some insight. Post any trigger that may event at the 12-minute mark or post the map. Living in fear of someone copying the work that you're building without pay anyway doesn't make any sense to me.

Edit: the reason you should post your map is because if you have memory leaks (those cause crashes) we wouldn't know the extent of the damage without looking at several of your seemingly-unrelated triggers.
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
When you are assigning new value to hashtable over the old one, it should simply overwrite the value, not crash.

You can create infinite loops in GUI, too (actually, you can't create infinite loop with a for loop, there is limited number of operations), just invoke the event the trigger responds to inside the trigger (like in damage detection, make a unit cause damage to some other unit, and it will launch the same trigger again).
Also crashes can come from wrong camera setting (one of my maps crashed when I changed camera bounds, but only for player that were looking south, it worked for others), or Interface setting (If you changed something in Game Interface, that has %d, %s,... in it, it may display wrong (I once changed the "Level %d" to "%d" for upgrades, and it crashed the game when you upgraded a related upgrade and clicked on any unit that uses it), or just plain wrong actions ( like creating a unit with non-existing unit type, increasing attribute for non-hero (unit with inventory (item usage enabled) picks up a tome), destroying (All players) group...., )

Just try somehow narrowing down what could cause it and upload it here. (If you worry about the map, then upload just the triggers, delete the rest)
 
Level 13
Joined
May 11, 2008
Messages
1,198
i've yet to learn about hashtables...but almost everything i've learned in editing has been from example.

it might or might not be the best example, i don't know since i don't know hashtables...but obviously the hero died before the map crashed so it's better than your code....check out his(spencenator's) hero submission in the 3rd hero contest at the hive here.

he uses hashtables in that map, so that might be a good example of proper use of it.
 
Level 19
Joined
Aug 16, 2007
Messages
881
I'm here to solve all the problems:

don't post asking for help with your map when you don't even give us any details. We're not going to compile a list of the thousands of things that can crash your map, you have to give us some insight. Post any trigger that may event at the 12-minute mark or post the map. Living in fear of someone copying the work that you're building without pay anyway doesn't make any sense to me.

Edit: the reason you should post your map is because if you have memory leaks (those cause crashes) we wouldn't know the extent of the damage without looking at several of your seemingly-unrelated triggers.

When you are assigning new value to hashtable over the old one, it should simply overwrite the value, not crash.

You can create infinite loops in GUI, too (actually, you can't create infinite loop with a for loop, there is limited number of operations), just invoke the event the trigger responds to inside the trigger (like in damage detection, make a unit cause damage to some other unit, and it will launch the same trigger again).
Also crashes can come from wrong camera setting (one of my maps crashed when I changed camera bounds, but only for player that were looking south, it worked for others), or Interface setting (If you changed something in Game Interface, that has %d, %s,... in it, it may display wrong (I once changed the "Level %d" to "%d" for upgrades, and it crashed the game when you upgraded a related upgrade and clicked on any unit that uses it), or just plain wrong actions ( like creating a unit with non-existing unit type, increasing attribute for non-hero (unit with inventory (item usage enabled) picks up a tome), destroying (All players) group...., )

Just try somehow narrowing down what could cause it and upload it here. (If you worry about the map, then upload just the triggers, delete the rest)

I've found the error, but the error make no sense for me... So I hope you guys can help me out now. I'll post the triggers at the my first post so you can read them there. I'll also explain the problem there. (I'll just have to edit my first post first, it will take a few minutes)

Thanks
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
The problem are "CheckHero 1" and 2
  • CheckHero2
  • Events
  • Conditions
  • Actions
  • Set Integer[0] = (Random integer number between 7 and 11)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • dd_duellinghero[2] Equal to No unit
    • Then - Actions
      • Trigger - Run (This trigger) (checking conditions)
    • Else - Actions
      • Set dd_duellinghero[2] = Hero[Integer[0]]
      • Set dd_duellheropointbefore[2] = (Position of Hero[Integer[0]])
If dd_duellinghero[2] is null, the trigger will be stuck in endless loop. You should add the Set dd_duellinghero[2] = Hero[Integer[0]] before the "Trigger - Run"
 
Level 19
Joined
Aug 16, 2007
Messages
881
The problem are "CheckHero 1" and 2
  • CheckHero2
  • Events
  • Conditions
  • Actions
  • Set Integer[0] = (Random integer number between 7 and 11)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • dd_duellinghero[2] Equal to No unit
    • Then - Actions
      • Trigger - Run (This trigger) (checking conditions)
    • Else - Actions
      • Set dd_duellinghero[2] = Hero[Integer[0]]
      • Set dd_duellheropointbefore[2] = (Position of Hero[Integer[0]])
If dd_duellinghero[2] is null, the trigger will be stuck in endless loop. You should add the Set dd_duellinghero[2] = Hero[Integer[0]] before the "Trigger - Run"

Okey, I'll try this out. But when I play the map 1 vs 1 it will still crash and then a player from both teams should be picked... Is there any other way to do this random player pick?
 
Level 12
Joined
Apr 15, 2008
Messages
1,063
Either create two groups, one for each side, and use standard random pick, or improve the trigger you used:
  • Random Pick
    • Actions
      • For (Integer B) from 0 to 1
        • Set Integer[0] = (Random integer number between 1 and 5)
        • For (Integer A) from 1 to 5
          • Loop - Actions
            • If - then else
              • If - conditions
                • Hero[ ( Integer[0] + (Integer A) mod 5 ) + ( (Integer B) * 5 ) ] not equal to No Unit
              • Then - actions
                • set dd_duelinghero[( 1 + (Integer B) )] = Hero[ ( Integer[0] + (Integer A) mod 5 ) ]
This is a version for both teams, not just one
 
Level 19
Joined
Aug 16, 2007
Messages
881
Either create two groups, one for each side, and use standard random pick, or improve the trigger you used:
  • Random Pick
    • Actions
      • For (Integer B) from 0 to 1
        • Set Integer[0] = (Random integer number between 1 and 5)
        • For (Integer A) from 1 to 5
          • Loop - Actions
            • If - then else
              • If - conditions
                • Hero[ ( Integer[0] + (Integer A) mod 5 ) + ( (Integer B) * 5 ) ] not equal to No Unit
              • Then - actions
                • set dd_duelinghero[( 1 + (Integer B) )] = Hero[ ( Integer[0] + (Integer A) mod 5 ) ]
This is a version for both teams, not just one

Thanks I'll try this out ASAP! +rep (couldn't rep you :/)
 
Status
Not open for further replies.
Top