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

Strange Error

Status
Not open for further replies.
Level 3
Joined
Aug 22, 2010
Messages
34
I had a trigger working fine. I added a line or two, and now every time it's executed red error text appears on the left.
  • Next Level
    • Events
      • Player - Player 15 Supplies Used changes
      • Player - Player 14 Supplies Used changes
    • Local Variables
      • Wave Income = 0 <Integer>
    • Conditions
      • And
        • Conditions
          • (Player 15 Supplies Used) == 0
          • (Player 14 Supplies Used) == 0
    • Actions
      • ------- Timer for next wave
      • UI - Clear All Messages for (All players)
      • Timer - Start WaveTimer as a One Shot timer that will expire in 10.0 Game Time seconds
      • Timer - Create a timer window for (Last started timer), with the title (Combine ("Level ", (Combine ((Text(WaveNumber)), " in...")))), using Remaining time (initially Visible)
      • Variable - Set TimerWindow = (Last created timer window)
      • Timer - Show TimerWindow for (All players)
      • UI - Display (Combine ("Congratulations on surviving level ", (Combine ((Text((WaveNumber - 1))), ".")))) for (All players) to Directive area
      • ------- Income = 2x level
      • Variable - Set Wave Income = ((WaveNumber - 1) * 2)
      • Player Group - Pick each player in (All players) and do (Actions)
        • Actions
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • PlayerAlive[(Picked player)] == true
            • Then
              • Player - Modify player (Picked player) Minerals: Add Wave Income
              • UI - Display (Combine ("You have recieved ", (Combine ((Text(Wave Income)), " minerals for surviving this wave.")))) for Group[(Picked player)] to Subtitle area
            • Else
      • General - Wait 0.7 Game Time seconds
      • Sound - Play Round_Completed (1) for (All players) (at 200.0% volume, skip the first 0.0 seconds)
I added the Pick every player part and it goes nuts. PlayerAlive is an array of booleans max #4 Wave# is the current wave.

The error message I get says something along the lines of

"Trigger error in "gt_Next_Level_func" error occured in starting Starcraft 2. Please try again.e_arrayindexoverflow"

It does this every time the attacker's food becomes zero, but the trigger runs normally. Minerals are given, resources given is displayed and it goes to the next level.

Wondering if I should worry about this or ignore it for now?
 
Level 1
Joined
Feb 24, 2010
Messages
62
Both Player 14 and 15 (which I assume are the attackers) are also in the player group 'All Players', which means they'll also be in the 'Pick each Player in...'. However, if your variable 'PlayerAlive' only has a maximum array of say 12 and not 15, and the trigger comes to either player 14 or 15, the array overflows (as it's not there) and you'll get an error. So you can either A. set the maximum of the array to 15 or B. make a variable for the player group which includes all players, but not player 14 and 15.

Just what I think. :3
 
Both Player 14 and 15 (which I assume are the attackers) are also in the player group 'All Players', which means they'll also be in the 'Pick each Player in...'. However, if your variable 'PlayerAlive' only has a maximum array of say 12 and not 15, and the trigger comes to either player 14 or 15, the array overflows (as it's not there) and you'll get an error. So you can either A. set the maximum of the array to 15 or B. make a variable for the player group which includes all players, but not player 14 and 15.

Just what I think. :3
16
You forget that arrays work like this. X[9] can go up to X[8]. Arrays start from 0, and add up, with max the defined value -1.
 
Level 3
Joined
Aug 22, 2010
Messages
34
Thanks for the help. The answer to this actually hit me in the morning when I woke up.

I was like, duh. +1's for all.
 
Status
Not open for further replies.
Top