Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   getx gety? (https://forums.graalonline.com/forums/showthread.php?t=74391)

Angel_Light 06-04-2007 10:06 PM

getx gety?
 
Hello, I have a movement system going "Serverside" I'm using move() and all is fine. But of course it moves the NPC but not the actual x y coor of the NPC. IS there way so it moves the x y coor?

I found a work around using
PHP Code:

this.+= temp.newx

which the movement can go -5 to 5 in all 4 dir I have thise set to temp.rx
PHP Code:

temp.rx int(randome(-5,5)); 

so to get temp.newx I use
PHP Code:

temp.newx this.temp.rx

but if something blocks the way the NPC stays but when I add the this.x and all it moves the NPC to the location that is block. Any Idea's on how to fix. Can I detect the current x y when the move() is blocked?

-Much Thanks
Mr. Ωmega

Angel_Light 06-06-2007 04:27 AM

*bump*

Rapidwolve 06-06-2007 08:43 PM

Well first of all, random is spelt wrong.

Admins 06-06-2007 09:15 PM

On Kingdoms we move monsters with move() but check for blocking tiles manually before calling move(). You can use the parameters to let move() stop at walls.

Angel_Light 06-06-2007 09:47 PM

it's spelt fine in the script, Stefan, I do have the block checks in there but I have to have the this.x += temp.newx or else the baddy just keeps moving from the original positions, __-__ just figured the problem i had temp.x instead of temp.newx in the tiletype check haha, thanks guys :P

EDIT : grr... well it doesnt walk if the newx and newy are blocking but if the player walks in front and stops the baddy it still screws up. Here's a part of the script

PHP Code:

function onTimeOut() {
  
temp.rx   int(random(-55));
  
temp.ry   int(random(-55));
  
temp.rs   random(05);
  
temp.rt   random(07);
  
temp.newx this.temp.rx;
  
temp.newy this.temp.ry;

if (
tiletypetemp.newxtemp.newy] != 22 && tiletypetemp.newxtemp.newy] != 11) {
    
move(temp.rxtemp.rytemp.rs16);
    
setcharani"nir_baddy_walk"this.baddy.nickthis.baddy.hpthis.baddy.fullhpthis.baddy.aggressor);
  }

  else 
    
setTimer(temp.rt);

  
sleep(temp.rs);
  
setcharani"nir_baddy_idle"this.baddy.nickthis.baddy.hpthis.baddy.fullhpthis.baddy.aggressor);
 
  
this.+= temp.rx;
  
this.+= temp.ry;

  
setTimer(temp.rt);



Angel_Light 06-07-2007 10:40 PM

*smack*

Angel_Light 06-09-2007 08:49 PM

*bump*


All times are GMT +2. The time now is 07:01 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.