Download

Strange glitch with patrol point array

So I’ve been setting up a new game, and while making patrol points for one of the enemies, I’ve had a strange problem where the character is moving to the world origin at 0,0,0, and it seems to act like it is one of the elements in the array of patrol points, though it isn’t. The screenshots below are the only ones that deal with the creation and movement to said patrol points, but I can’t seem to find a reason why he keeps returning to the origin. If anyone has any ideas as to why this might be happening, I’d be very grateful, it’s got me bashing my head against the keyboard looking for answers. The screenshot of the two vectors is a print string of the 2 patrol points I placed in the level, and clearly shows that the origin is NOT one of the points I added.

A quick look and I see:

len.JPG

That’s going to run off the end of the array. You need to have a -1 in there…

Well, that fixed it. I thought the length node coming off an array would follow the same rules as the array index, i.e. start counting from 0. Thank you very much sir, your complimentary cookie bouquet will arrive soon or not at all.