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

Legacy GM My Array system is not working.

E

Emperor88

Guest
currently i am programming a node-run fleet AI into my game. only when i try to send pre-randomized x and y coords the arrays will not have it. i have a totalships variable because the amount of ships can differ per fleet node. ect. this is the code and it is coming up with errors. please explain why! cheers emporer88

for (i=1; i<=totalships; i+=1)
{
ship.xrally = x + xxcoord
ship.yrally = y + yycoord
}
 
E

Emperor88

Guest
also to note totalships has been calculated before and xxcoord and yycoord are the saved arrays of the coords (x and y) that the ships way points are at.

the error says
trying to index a variable which is not an array.
 
G

Gaizokubanou

Guest
You have to specify indexes in array when you read/write off of them. Like this
Code:
ship.xrally = x + xxcoord[@0];
Change the '0' with the index you want. But I would like more context to this code cause that error message should have come from elsewhere.
 
E

Emperor88

Guest
thanks
yea im not sure i setup the xxcoord and yycoord right.
 
E

Emperor88

Guest
got another error different this time. says Execution error- Variable Index [0,1] out of range [1,1] - - 1 xxcoord(100022,1) at gml_obj_NODE_stepNormalEvent_1 (line two) xxcoord = xxcoord + x

well i think i may have a closer look soon :). thanks
 
E

Emperor88

Guest
well i fixed it. and then my game maker broke and refuses to play the game. even with the code disabled
 
Top