messy, I know.
PHP Code:
//NPC made by *calani
//#CLIENTSIDE
function onCreated() init();
function init() {
// object data: { image, {x,y}, {dx,dy}, {moveable, mass} }
// index pointers
x=1; // x
y=2; // y
image=0; // image
coords=1; // xy
delta=2; // dxy
extra=3; // other data
this.objectscount=5;
setarray(this.objects,this.objectscount);
// ranges added in for ease while debugging
this.range.xy={{-5,5},{-60,60}};
this.range.dxy={{-3,3},{-3,3}};
this.range.mass={1,500};
for(i=0;i<this.objectscount;i++) {
this.objects[i][coords][x] = random(this.range.xy[x][1],this.range.xy[x][2]);
this.objects[i][coords][y] = random(this.range.xy[y][1],this.range.xy[y][2]);
this.objects[i][delta][x] = random(this.range.dxy[x][1],this.range.dxy[x][2]);
this.objects[i][delta][y] = random(this.range.dxy[y][1],this.range.dxy[y][2]);
this.objects[i][extra][1] = int(random(0,2)); // bool
this.objects[i][extra][2] = random(this.range.mass[1],this.range.mass[2]);
/*
this.string=i @ ": {"@this.objects[image]@", {"@this.objects[i][coords][x]@","@this.objects[i][coords][y]@"}, {"@this.objects[i][delta][x]@","@this.objects[i][delta][y]@"}, {"@this.objects[i][extra][x]@","@this.objects[i][extra][y]@"}}";
// player.chat=this.string;
triggeraction(0,0,serverside,"*gravitytest","tonc","*gravitytest: " @ this.string);
*/
sleep .05;
}
}