• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Push :: Execution Error - Variable Index

DaSH

Member
im getting an this error in my code:
-
ERROR in
action number 1
of Step Event0
for object obj_spawner:

Push :: Execution Error - Variable Index [3] out of range [3] - -1.remaining(100073,3)
at gml_Object_obj_spawner_Step_0 (line 19) - if (remaining[current_wave] <= 0)
############################################################################################
gml_Object_obj_spawner_Step_0 (line 19) -

the line of code the error is on is:
if (remaining[current_wave] <= 0)


i can put more code if its needed i just dont really understand the error.
 
Looks like you're reading from an entry that doesn't exist. If you create, say, three entries (0,1,2) but you set current_wave to 3, you'll be out of range.
 

chamaeleon

Member
Variable Index [3]: You are trying to access index 3 in an array
out of range [3]:The size of your array is 3. Arrays start at 0, so 0, 1, and 2 (for a count of 3 elements in the array) are valid indices. 3 is not.
 
Top