Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   help with attachplayertoobj (https://forums.graalonline.com/forums/showthread.php?t=57001)

Evil_Trunks 01-11-2005 02:41 AM

help with attachplayertoobj
 
I need help with getting this to work right

when attached to an NPC moving around on the gmap, it seems to mess up a lot

it will often cross levels, and not update on my client that it has moved past the edge of the current level on the gmap

also, say i am standing right on the top left corner of the NPC, when the npc moves around a little i may end up way off the NPC in the bottom right

it's very strange

simple script like this is used

PHP Code:

if (playerchats) {
  if (
strequals(#c,attach)) attachplayertoobj 0,id;
  
if (startswith(move,#c)) {
      
tokenize #c;
      
move strtofloat(#t(1)) - x,strtofloat(#t(2)) - y,5,0;
  
}


any ideas? kingdoms has it working very well from what I hear at least

Slash-P2P 01-11-2005 05:04 AM

Quote:

Originally Posted by Evil_Trunks
I need help with getting this to work right

when attached to an NPC moving around on the gmap, it seems to mess up a lot

it will often cross levels, and not update on my client that it has moved past the edge of the current level on the gmap

also, say i am standing right on the top left corner of the NPC, when the npc moves around a little i may end up way off the NPC in the bottom right

it's very strange

simple script like this is used

PHP Code:

if (playerchats) {
  if (
strequals(#c,attach)) attachplayertoobj 0,id;
  
if (startswith(move,#c)) {
      
tokenize #c;
      
move strtofloat(#t(1)) - x,strtofloat(#t(2)) - y,5,0;
  
}


any ideas? kingdoms has it working very well from what I hear atleast

Use setshape/setshape2 and make a non blocking square or something. You should be able to stay attached and walk around. You can also freeze the player or disable the movement to fix your jumping around problem.

Evil_Trunks 01-11-2005 05:11 AM

there is an image set for this NPC, and yes I can walk around

my problems are switching levels on the gmap, and remaining connected/in the right location after switching levels in general

edit: disabling movement would not help, no one is moving while doing these tests

Slash-P2P 01-12-2005 04:29 AM

Quote:

Originally Posted by Evil_Trunks
there is an image set for this NPC, and yes I can walk around

my problems are switching levels on the gmap, and remaining connected/in the right location after switching levels in general

edit: disabling movement would not help, no one is moving while doing these tests

did you try canwarp; or canwarp2;?

Evil_Trunks 01-12-2005 05:04 AM

i'll try both of those

maybe it will switch levels more smoothly on the gmap

TB3 01-12-2005 06:27 PM

You need to have a //#CLIENTSIDE
setshape 2 and
also i have the same problems so try using smallter interverals of the move command because for some reason even on a gmap data doesnt get sent correctly when crossing level boundaries O_o but using small interverals of the move command updates its x/y /movement better.
Also to prevent getting thrown outside of the x/y boundaries of the npc use something clientside to keep the players x and y inside of the boundaries of that object as it moves.

Evil_Trunks 01-12-2005 09:54 PM

Thanks for the reply TB3

Quote:

Originally Posted by TB3
so try using smallter interverals of the move command because for some reason even on a gmap data doesnt get sent correctly when crossing level boundaries O_o but using small interverals of the move command updates its x/y /movement better.

This is more of a workaround than an actual solution, no? The only difference is that with smaller movements, the server will update the client with the new position faster when it changes levels since it tells the client where the NPC is when a move command is issued. Right now I think there are problems with updating the NPC position clientside.

The thing with having to keep a clientside script making sure the player doesn't get thrown off, that's a sort of workaround too but not as bad.

Skyld 01-12-2005 10:58 PM

I think Stefan's new precision location system will probably fix that. That'll become active when 2.3 is released.

TB3 01-12-2005 11:31 PM

Quote:

Originally Posted by Evil_Trunks
Thanks for the reply TB3


This is more of a workaround than an actual solution, no? The only difference is that with smaller movements, the server will update the client with the new position faster when it changes levels since it tells the client where the NPC is when a move command is issued. Right now I think there are problems with updating the NPC position clientside.

The thing with having to keep a clientside script making sure the player doesn't get thrown off, that's a sort of workaround too but not as bad.

Well its rather both because there isnt any other way to do it unless you want to loop a
x+=.5;
or something XD
and god knows thats not going to go over smoothly.


All times are GMT +2. The time now is 08:24 PM.

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