1. The Melee Mapping Contest #4: 2v2 - Results are out! Step by to congratulate the winners!
    Dismiss Notice
  2. We're hosting the 15th Mini-Mapping Contest with YouTuber Abelhawk! The contestants are to create a custom map that uses the hidden content within Warcraft 3 or is inspired by any of the many secrets within the game.
    Dismiss Notice
  3. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  4. Check out the Staff job openings thread.
    Dismiss Notice

[Solved] Destroying or Hiding Timer Window causes game to crash

Discussion in 'Triggers & Scripts' started by DrunkenDirt, Dec 13, 2018.

  1. DrunkenDirt

    DrunkenDirt

    Joined:
    Jul 12, 2016
    Messages:
    21
    Resources:
    1
    Maps:
    1
    Resources:
    1
    This is a bit of a mess with a lot of potential issues, so I'll try keep it as specific as possible.

    I'm working on a map which begins with all players buying a hero, and a timer counting down to kick players that don't pick a hero within 45 seconds. I have two triggers working on this, one to start the timer and a second to stop it once everyone has picked their heroes, together the triggers look like this:

    Trigger 1: Starting the timer once the game start
    [​IMG]

    Trigger 2: Stopping the timer once everyone has picked their hero (including only the parts related to the timer)
    [​IMG]

    Now, this setup works fine, but I added a way to restart the map once you're done playing. I wanted players to be able to pick new heroes again, so I run the same two triggers shown above. The problem is that this time the game crashes once it reaches the last line shown in trigger 2:
    "Countdown Timer - Destroy TimerWindow_GameSetup"​


    List of things I've already tried that hasn't worked:
    • Creating a brand new timer+timer window variable for the new game, effectively creating an entirely different timer window than the first one.
    • Creating a different trigger to start the timer so the same trigger doesn't start it twice.
    • Creating a different trigger to stop the timer once everyone has bought their hero so the same trigger doesn't fire twice.
    • Moving the crash-causing line to a different part of the trigger or to other triggers that follow in sequence.
    • Changing the setup so that the timer window is never destroyed but instead it's just hidden and once the game restarts the window reappears once it starts ticking again and is again hidden once everyone has picked their heroes.
    • Most combinations of all of the above.
    Additional info that may or may not be of importance:
    • I've tried running these triggers with the crash-causing line both removed entirely and set to not trigger if the game has been reset, in these cases the map work completely fine (aside from the issue that the timer windows stack up at the top of the screen and are never removed, obviously)
    • There are no other triggers in the map that touch this specific timer and timer window.
    • There are other timer windows in the map that work fine after that map has been restarted, which I was able to test while disabling the crash-causing line.
    All in all, this timer window just doesn't seem to want to go away after it has been shown the second time. Both destroying it and hiding it causes the game to crash, I'm starting to think it might be cursed.

    Has anyone encountered this issue before or has any idea what might be causing it?
     
  2. NEL

    NEL

    Joined:
    Mar 6, 2017
    Messages:
    112
    Resources:
    0
    Resources:
    0
    Try this.

    • S
      • Events
        • Time - Elapsed game time is 0.25 seconds
      • Conditions
      • Actions
        • -------- --------------------------------------- --------
        • -------- Start Timer --------
        • Countdown Timer - Start Timer_GameSetup as a One-shot timer that will expire in 45.00 seconds
        • Set Timer_GameSetup = (Last started timer)
        • -------- --------------------------------------- --------
        • -------- Timer Window --------
        • Countdown Timer - Create a timer window for Timer_GameSetup with title Game Starts
        • Set Timer_Window = (Last created timer window)
        • Countdown Timer - Show Timer_Window


    • SA
      • Events
        • Time - Timer_GameSetup expires
      • Conditions
      • Actions
        • Countdown Timer - Pause Timer_GameSetup
        • Countdown Timer - Destroy Timer_Window


    It didn't give me a fatal error once the Timer_GameSetup is expired.
     
  3. DrunkenDirt

    DrunkenDirt

    Joined:
    Jul 12, 2016
    Messages:
    21
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Afraid that didn't work. I added a trigger as you described above and tried both letting the timer run out naturally, and to shorten it to 0 seconds in order to remove it early. In both cases the game still crashed as soon as the timer window was removed.
     
  4. LordDz

    LordDz

    Joined:
    May 11, 2007
    Messages:
    4,308
    Resources:
    0
    Resources:
    0
    Are you sure it's the countdown timer that causes the crash?
    Does a different trigger use the countdown timer?

    If you copy the timer to an empty map, does it still crash?
     
  5. DrunkenDirt

    DrunkenDirt

    Joined:
    Jul 12, 2016
    Messages:
    21
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I'm not sure what the underlying cause of the crash is, but I'm 100% sure that restarting the Timer Window and then attempting to remove it is what causes the crash.

    Only one other trigger in the map uses the timer; The one that triggers once the timer expires, but the only thing that does is running the trigger that contains the crash-causing line in Trigger 2 that I showed originally:
    • Setup Timer Runout
      • Events
        • Time - Timer_GameSetup expires
      • Conditions
      • Actions
        • Trigger - Run Trigger 2 <gen> (ignoring conditions)


    Cutting the triggers out into a blank map makes them function normally, so something else in the map is probably causing the issue, I just have no idea what since no other trigger interact with this Timer Window. Hence why I originally asked if anyone has encountered a problem like this one before and has any idea what might be issue.
     
  6. DrunkenDirt

    DrunkenDirt

    Joined:
    Jul 12, 2016
    Messages:
    21
    Resources:
    1
    Maps:
    1
    Resources:
    1
    I spent a few more hours troubleshooting this bug and I found the solution. At the start of the game I create a hidden multitable that saves information about every player in the game (see the spoiler if interested, but it's nothing remarkable) which is displayed once the game is over to all players.

    • Multiboard Game Over
      • Events
      • Conditions
      • Actions
        • Set Integer_ATemp1 = ((Number of players in PlayerGroup_Alliance) + (Number of players in PlayerGroup_Horde))
        • Multiboard - Create a multiboard with 2 columns and Integer_ATemp1 rows, titled Game Over!
        • Set Multiboard_GameOver = (Last created multiboard)
        • Multiboard - Hide (Last created multiboard)
        • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 0 to Show text and Hide icons
        • Multiboard - Set the display style for (Last created multiboard) item in column 2, row 0 to Hide text and Show icons
        • Player Group - Pick every player in PlayerGroup_Alliance and do (Player Group - Add (Picked player) to PlayerGroup_Temp1)
        • For each (Integer A) from 1 to (Number of players in PlayerGroup_Temp1), do (Actions)
          • Loop - Actions
            • Set Player_Temp1 = (Random player from PlayerGroup_Temp1)
            • Player Group - Remove Player_Temp1 from PlayerGroup_Temp1
            • If (Player_Temp1 Equal to Player 1 (Red)) then do (Set String_Temp1 = |c00ff0000) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 2 (Blue)) then do (Set String_Temp1 = |c000000ff) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 3 (Teal)) then do (Set String_Temp1 = |c0000ffff) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 4 (Purple)) then do (Set String_Temp1 = |c00800080) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 5 (Yellow)) then do (Set String_Temp1 = |c00ffff00) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 6 (Orange)) then do (Set String_Temp1 = |c00ff8000) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 7 (Green)) then do (Set String_Temp1 = |c0000ff00) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 8 (Pink)) then do (Set String_Temp1 = |c00ff00ff) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 10 (Light Blue)) then do (Set String_Temp1 = |CFF7EBFF1) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 11 (Dark Green)) then do (Set String_Temp1 = |CFF106246) else do (Do nothing)
            • Multiboard - Set the text for (Last created multiboard) item in column 1, row Integer_MultiboardGame to (String_Temp1 + (Name of Player_Temp1))
            • Multiboard - Set the width for (Last created multiboard) item in column 1, row Integer_MultiboardGame to 7.00% of the total screen width
            • Multiboard - Set the icon for (Last created multiboard) item in column 2, row Integer_MultiboardGame to ReplaceableTextures\CommandButtons\BTNHumanCaptureFlag.blp
            • Set Integer_MultiboardGame = (Integer_MultiboardGame + 1)
        • Player Group - Pick every player in PlayerGroup_Horde and do (Player Group - Add (Picked player) to PlayerGroup_Temp1)
        • Player Group - Remove (Owner of Unit_Warchief) from PlayerGroup_Temp1
        • For each (Integer A) from 1 to (Number of players in PlayerGroup_Temp1), do (Actions)
          • Loop - Actions
            • Set Player_Temp1 = (Random player from PlayerGroup_Temp1)
            • Player Group - Remove Player_Temp1 from PlayerGroup_Temp1
            • If (Player_Temp1 Equal to Player 1 (Red)) then do (Set String_Temp1 = |c00ff0000) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 2 (Blue)) then do (Set String_Temp1 = |c000000ff) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 3 (Teal)) then do (Set String_Temp1 = |c0000ffff) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 4 (Purple)) then do (Set String_Temp1 = |c00800080) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 5 (Yellow)) then do (Set String_Temp1 = |c00ffff00) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 6 (Orange)) then do (Set String_Temp1 = |c00ff8000) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 7 (Green)) then do (Set String_Temp1 = |c0000ff00) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 8 (Pink)) then do (Set String_Temp1 = |c00ff00ff) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 10 (Light Blue)) then do (Set String_Temp1 = |CFF7EBFF1) else do (Do nothing)
            • If (Player_Temp1 Equal to Player 11 (Dark Green)) then do (Set String_Temp1 = |CFF106246) else do (Do nothing)
            • Multiboard - Set the text for (Last created multiboard) item in column 1, row Integer_MultiboardGame to (String_Temp1 + (Name of Player_Temp1))
            • Multiboard - Set the width for (Last created multiboard) item in column 1, row Integer_MultiboardGame to 7.00% of the total screen width
            • Multiboard - Set the icon for (Last created multiboard) item in column 2, row Integer_MultiboardGame to ReplaceableTextures\CommandButtons\BTNOrcCaptureFlag.blp
            • Set Integer_MultiboardGame = (Integer_MultiboardGame + 1)
        • Set Player_Temp1 = (Owner of Unit_Warchief)
        • If (Player_Temp1 Equal to Player 1 (Red)) then do (Set String_Temp1 = |c00ff0000) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 2 (Blue)) then do (Set String_Temp1 = |c000000ff) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 3 (Teal)) then do (Set String_Temp1 = |c0000ffff) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 4 (Purple)) then do (Set String_Temp1 = |c00800080) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 5 (Yellow)) then do (Set String_Temp1 = |c00ffff00) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 6 (Orange)) then do (Set String_Temp1 = |c00ff8000) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 7 (Green)) then do (Set String_Temp1 = |c0000ff00) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 8 (Pink)) then do (Set String_Temp1 = |c00ff00ff) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 10 (Light Blue)) then do (Set String_Temp1 = |CFF7EBFF1) else do (Do nothing)
        • If (Player_Temp1 Equal to Player 11 (Dark Green)) then do (Set String_Temp1 = |CFF106246) else do (Do nothing)
        • Multiboard - Set the text for (Last created multiboard) item in column 1, row Integer_MultiboardGame to (String_Temp1 + (Name of Player_Temp1))
        • Multiboard - Set the width for (Last created multiboard) item in column 1, row Integer_MultiboardGame to 7.00% of the total screen width
        • Multiboard - Set the icon for (Last created multiboard) item in column 2, row Integer_MultiboardGame to ReplaceableTextures\CommandButtons\BTNOrcBattleStandard.blp

    Later when resetting the map I have a trigger that cleans up all the variables and units and whatnot up, including the action to destroy said Multiboard.

    Don't ask me why, but this action caused the crashing issue that I explained above in the original post. Removing it made the Timer Window triggers work just fine.

    The solution I found was to hide the Multiboard before destroying it, so the actions looked like:
    • Multiboard - Hide Multiboard_GameOver
    • Multiboard - Destroy Multiboard_GameOver


    And now the map works fine, no windows are throwing a hissy fit crashing the game anymore. If I had to guess, I'd assume it has something to do with the latest few patches since I know they changed some things around with the placement of multiboards and timer windows, but your guess is as good as mine.