PHP Code:
function onMovementFinished()
{
temp.newx = vecx(this.dir) * this.walkspeed;
temp.newy = vecy(this.dir) * this.walkspeed;
this.runcounter--;
if (this.runcounter > 0)
{
setcharani("walk", NULL);
temp.testx = this.x + temp.newx + 1.5 + vecx(this.dir);
temp.testy = this.y + temp.newy + 2.0 + vecy(this.dir);
if (onwall(temp.testx, temp.testy))
{
this.dir = (dir + 2) % 4;
this.runcounter = int(random(0, 60));
this.onMovementFinished();
}
else
{
dist = (temp.newx ^ 2 + temp.newy ^ 2) ^ 0.5;
move(temp.newx, temp.newy, dist / 16, 8);
}
}
else
{
this.runcounter = int(random(10, 40));
setcharani("idle", NULL);
this.dir = (dir + 1 + int(random(0, 2)) * 2) % 4;
this.onMovementFinished();
}
if (this.runcounter <= 0)
{
this.runcounter = 20;
}
}
The movement on this is very.. well, the gani is wierd. Unsure why, I tried messing with it. If someone could help, much appreciated.
P.S. Yeah, I basically rescripted offline movement to GS2 with move(). And yeah, anyone could use this script for there own server.. assuming it worked correctly =[.