Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   move() on serverside, npc stops x.x (https://forums.graalonline.com/forums/showthread.php?t=78419)

Inverness 01-21-2008 06:47 AM

move() on serverside, npc stops x.x
 
Okay, so I have an irritating problem. I put together a script to control movement for npc characters from an array of coordinates and options etc. and basically when its on a gmap and it crosses to another level the movement of the npc stops at the level border. When the next movement begins a few seconds later the npc appears instantly where its supposed to have been and continues from there into its next movement.

GMap is installed correctly and everything, movement is being done on serverside while the character appearance and everything are clientside. I have no idea why its happening. Can anyone help?

I doubt posting the script will help but I will do it if nobody can relate.

canwarp() and canwarp2() had no effect, and the script is in a level npc on a gmap.

Angel_Light 01-21-2008 06:50 AM

I suggest making it's on movement system, move() is bugged on serverside. Try maybe using npc.setLevel(); Although I believe setLevel is only for player objects?

Inverness 01-21-2008 06:52 AM

Well if its bugged on serverside it needs to be un-bugged.
-____________-
Until then movement paths will have to be limited to in-level :(

Angel_Light 01-21-2008 06:55 AM

Maybe stupid but have you tried that whole Modulu thing or whatever it is called. (%64)

Admins 01-21-2008 11:28 AM

It should normally work fine

Inverness 01-21-2008 10:13 PM

I get the same behavior with my ship NPC on Val Dev, when crossing levels the ship and the lamp npcs that move with the ship all stop at the border and reappear where they're supposed to be when the next move() is started.

Tigairius 01-22-2008 09:36 PM

I've had this probably with serverside move() several times too.

Dan 01-22-2008 09:40 PM

I've had the same problem, though maybe this can help (since it did for me);

PHP Code:

temp.dx this.path[this.pathpos][1] - this.x;
temp.dy this.path[this.pathpos][2] - this.y;
temp.dist = (dx dy 2) ^ 0.5;
if (
abs(temp.dist) <= 0.5) {
  
this.+= temp.dx;
  
this.+= temp.dy;
  
setPathPos(this.pathpos 1);
  
dropPresent(); // Chooses wether to drop or not drop a gift
  
setCharAni("zone2_idle","");
}
else {
  if (
temp.dist temp.speed) {
    
temp.dx *= temp.speed temp.dist;
    
temp.dy *= temp.speed temp.dist;
    
temp.dist temp.speed;
  }
  else {
    
timegap max(0.1,temp.dist temp.speed);
  }
  
move(temp.dx,temp.dy,timegap,16);


(use 'setTimer(timegap);')
(source; my Santa script for Zone)

Inverness 01-22-2008 11:29 PM

Quote:

Originally Posted by Dan (Post 1371248)
I've had the same problem, though maybe this can help (since it did for me);

PHP Code:

temp.dx this.path[this.pathpos][1] - this.x;
temp.dy this.path[this.pathpos][2] - this.y;
temp.dist = (dx dy 2) ^ 0.5;
if (
abs(temp.dist) <= 0.5) {
  
this.+= temp.dx;
  
this.+= temp.dy;
  
setPathPos(this.pathpos 1);
  
dropPresent(); // Chooses wether to drop or not drop a gift
  
setCharAni("zone2_idle","");
}
else {
  if (
temp.dist temp.speed) {
    
temp.dx *= temp.speed temp.dist;
    
temp.dy *= temp.speed temp.dist;
    
temp.dist temp.speed;
  }
  else {
    
timegap max(0.1,temp.dist temp.speed);
  }
  
move(temp.dx,temp.dy,timegap,16);


(use 'setTimer(timegap);')
(source; my Santa script for Zone)

So how is that fixing the problem?

cbk1994 01-23-2008 01:11 AM

Quote:

Originally Posted by Inverness (Post 1371271)
So how is that fixing the problem?

From what I can see it moves it every timegap a certain amount, versus moving a large amount at once?

Switch 01-23-2008 01:18 AM

Quote:

Originally Posted by Angel_Light (Post 1370905)
Try maybe using npc.setLevel(); Although I believe setLevel is only for player objects?

Yes, it is.

coreys 01-23-2008 01:22 AM

Well if it's tiny distances, like say .2 tiles Invers problem wouldn't be noticeable, but that's a lot more CPU usage.

Inverness 01-23-2008 01:39 AM

I'd rather not have to go to the trouble of detecting level boarders and such to repeat the move() so it looks correct. I'd love if Stefan could take a look into this problem.

And I want a bugfix, not a workaround :(

DustyPorViva 01-25-2008 01:35 AM

Well just testing it I've had the same problem. canwarp/2() have no effect... except canwarp2() I believe makes the NPC 'jump' in an odd way. Either way, definitely bugged.

Admins 02-06-2008 12:41 AM

Fixed, will upload new npcservers tomorrow.
On level border it's sending an update of x/y which is effectively stopping the npc the same way "x=x;" is doing. I've added sending a correct new move after crossing the level border, seems to work fine (tested with platforms on Zone Jump'n'run map).

Inverness 02-06-2008 03:03 AM

Hurray for Stefan :D

Tigairius 02-06-2008 04:11 AM

Quote:

Originally Posted by Stefan (Post 1373783)
Fixed, will upload new npcservers tomorrow.
On level border it's sending an update of x/y which is effectively stopping the npc the same way "x=x;" is doing. I've added sending a correct new move after crossing the level border, seems to work fine (tested with platforms on Zone Jump'n'run map).

Awesome.

Admins 02-07-2008 01:02 AM

Ok uploaded the new gserver and npcserver.

Knightmare1 02-07-2008 02:07 AM

awsome!!! (and PS check my PM i sent you.. its urgent.. if you can come to my server (final resort) so we can talk further)

zokemon 02-07-2008 06:45 AM

Quote:

Originally Posted by Knightmare1 (Post 1373940)
and PS check my PM i sent you.. its urgent.. if you can come to my server (final resort) so we can talk further

That's never gonna happen :D.

Dan 02-07-2008 08:34 AM

Quote:

Originally Posted by zokemon (Post 1373957)
That's never gonna happen :D.

Seconded :P
Nice update @ Stefan btw.

Crow 02-07-2008 01:00 PM

Quote:

Originally Posted by Knightmare1 (Post 1373940)
awsome!!! (and PS check my PM i sent you.. its urgent.. if you can come to my server (final resort) so we can talk further)

Not a good move. He already said he fixed it and uploaded the new gservers and npc servers. He wont come here again probably, so he wont read that.

cbk1994 02-07-2008 04:35 PM

Quote:

Originally Posted by zokemon (Post 1373957)
That's never gonna happen :D.

So true.

Dan 02-07-2008 04:36 PM

Quote:

Originally Posted by Crow (Post 1373974)
Not a good move().

Lol

Crow 02-07-2008 05:40 PM

Quote:

Originally Posted by Dan (Post 1373986)
Lol

I thought about doing that ;P


All times are GMT +2. The time now is 11:22 AM.

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