I mostly do it because my waitframe functions tend to get more and more arguments as I work on a boss. Every time the number of arguments changes I have to change every instance of those functions, so it's faster to just cram most of them in an array.
So for a boss with laser attacks I might have something like this:
Code:
int laserX[32]; //Laser X position
int laserY[32]; //Laser Y position
int laserA[32]; //Laser angle
int laserW[32]; //Laser width
int laserT[32]; //Laser timer
int vars[16] = {laserX, laserY, laserA, laserW, laserT};
void Example_Waitframe(ffc this, npc ghost, int vars){
Example_UpdateLasers(this, ghost, vars);
Ghost_Waitframe(this, ghost, true, true);
}
void Example_UpdateLasers(ffc this, npc ghost, int vars){
int laserX = vars[0];
int laserY = vars[1];
int laserA = vars[2];
int laserW = vars[3];
int laserT = vars[4];
for(int i=0; i<SizeOfArray(laserX); i++){
//pretend this is actually doing something
}
}
I see no use in doing this with global arrays so no worries there. And echoing what Grayswandir said, I learned to do this from looking at some of Saffith's scripts. I LEARNED IT FROM YOU, DAD! I LEARNED IT FROM WATCHING YOU!