Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-11-2005, 02:41 AM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
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
__________________

Reply With Quote
  #2  
Old 01-11-2005, 05:04 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
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.
Reply With Quote
  #3  
Old 01-11-2005, 05:11 AM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
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
__________________


Last edited by Evil_Trunks; 01-11-2005 at 06:41 AM..
Reply With Quote
  #4  
Old 01-12-2005, 04:29 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
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;?
Reply With Quote
  #5  
Old 01-12-2005, 05:04 AM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
i'll try both of those

maybe it will switch levels more smoothly on the gmap
__________________

Reply With Quote
  #6  
Old 01-12-2005, 06:27 PM
TB3 TB3 is offline
Registered User
TB3's Avatar
Join Date: May 2001
Location: US of A State of VA
Posts: 658
TB3 is on a distinguished road
Send a message via Yahoo to TB3
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.
__________________

To the sun of your age, I arise
Reply With Quote
  #7  
Old 01-12-2005, 09:54 PM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
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.
__________________

Reply With Quote
  #8  
Old 01-12-2005, 10:58 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
I think Stefan's new precision location system will probably fix that. That'll become active when 2.3 is released.
__________________
Skyld
Reply With Quote
  #9  
Old 01-12-2005, 11:31 PM
TB3 TB3 is offline
Registered User
TB3's Avatar
Join Date: May 2001
Location: US of A State of VA
Posts: 658
TB3 is on a distinguished road
Send a message via Yahoo to TB3
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.
__________________

To the sun of your age, I arise
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:33 PM.


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