Thread: Damn move()
View Single Post
  #6  
Old 01-22-2007, 04:35 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
It's still stuck on the walk gani even when it's supposed to be idling.

onMovementFinished doesn't appear to be called, even with 8+16

EDIT: Fixed. This works.

NPC Code:

function onCreated()
{
this.showCharacter();

this.curPlayer = findPlayer("Raeiphon");
this.onTimeout();
}
function onTimeout()
{
temp.movex = this.curPlayer.x - x; // x needed to travel to player
temp.movey = this.curPlayer.y - y; // y needed to travel to player
dir = getdir(temp.movex, temp.movey);

if (player.dir == 1) { this.desx = 1.7; this.desy = 1; }
if (player.dir == 0) { this.desx = -1.7; this.desy = 1; }
if (player.dir == 2) { this.desx = 1.7; this.desy = -1.7; }
if (player.dir == 3) { this.desx = -1.7; this.desy = -1.7; }
if (this.curPlayer.x+this.desx!=x) {
this.ani = "walk";
move((temp.movex + this.desx), (temp.movey + this.desy), 1, 8+16);
} else {
this.ani = "idle";
setTimer(.05);
}
}
function onPlayerChats() {
if (player.chat="dismiss") {
destroy();
}
}
function onMovementFinished()
{
this.ani = "idle";
setTimer(.05);

__________________

I hope for nothing. I fear nothing. I am free.

Last edited by Raeiphon; 01-22-2007 at 04:46 AM..
Reply With Quote