Thread: move()
View Single Post
  #8  
Old 05-29-2007, 12:33 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by Angel_Light View Post
I made a move() tutorial awhile back, I'll upload it when I find it, it's in another move() thread I believe.

Found it. It was for making a baddy move but it may help, here you go.

move(x,y,time,options);

x = move how far from current position horizontally

y = move how far from current position vertically

time = time it takes to get from starting point to ending point

options = cachtype(0,1,2) blockcheck(4) eventwhendone(8) applydir(16)

blockcheck = test to see if the tile is blocking or not
eventwhendone = stops moving after one movement. other wise the NPC
will move forever in that direction.
applydir = if the the char current gani has 4 dir it will apply it when it moves


Here's a NPC I use for a townsfolk randomly move

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
onTimeOut();
}

function 
onTimeOut() {
  
temp.rx random(-3,3);
  
temp.ry random(-3,3);
  
temp.r  random(3,5);
  
temp.rr random(0,5);
  
setcharani("walk",NULL);
  
move(rx,ry,r,4+8+16);
  
sleep(r);
  
setcharani("idle",NULL);
  
setTimer(rr);

I have more stuff in the script of course but there is the movement part. Also remember the movement is still in the Quadrant IV (Grid Wise)
uhm.., option 8 allows the function onMovementFinished() which is what I am using
__________________
- Zidane / Zidaya
Reply With Quote