Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Ship/Attachtoobj Problem... (https://forums.graalonline.com/forums/showthread.php?t=79788)

wild8900 05-21-2008 07:37 AM

Ship/Attachtoobj Problem...
 
For some reason this script attaches the player but it warps them around and weirds up the positions on other peoples clients... what am I doing wrong?
PHP Code:

if(playertouchsme&&!playerattached){
  
playerx=x+7.5;
  
playery=y+9;
  
attachplayertoobj 0,id;
  
timeout=0.05;
}

//#CLIENTSIDE
function onCreated(){
  
drawunderplayer();
  
setshape2(1838, {
    
00,00,00,22,22,22,22,22,22,22,22,22,22,22,22,00,00,00,
    
00,00,00,22,22,00,00,00,00,00,00,00,00,22,22,00,00,00,
    
00,00,00,22,22,00,00,00,00,00,00,00,00,22,22,00,00,00,
    
00,00,22,22,22,00,00,00,00,00,00,00,00,22,22,22,00,00,
    
00,22,22,22,22,00,00,22,22,22,22,00,00,22,22,22,22,00,
    
22,22,00,22,22,22,22,22,22,22,22,00,00,22,22,00,22,22,
    
22,22,00,22,22,22,22,22,22,22,22,00,00,22,22,00,22,22,
    
22,22,00,22,22,22,22,22,22,22,22,00,00,22,22,00,22,22,
    
22,22,00,22,22,22,22,22,22,22,22,00,00,22,22,00,22,22,
    
22,22,00,22,22,22,22,22,22,22,22,00,00,22,22,00,22,22,
    
22,22,00,00,00,00,00,00,00,00,00,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,00,00,00,00,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,22,22,22,22,00,00,00,00,00,22,22,
    
00,00,00,00,00,00,00,22,22,22,22,00,00,00,00,00,00,00,
    
00,00,00,00,00,00,00,22,22,22,22,00,00,00,00,00,00,00,
    
22,22,00,00,00,00,00,22,22,22,22,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,00,00,00,00,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,00,00,00,00,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,00,00,00,00,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,00,00,00,00,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,00,00,00,00,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,00,00,00,00,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,22,22,22,22,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,22,22,22,22,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,22,22,22,22,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,22,22,22,22,00,00,00,00,00,22,22,
    
22,22,00,00,00,00,00,22,00,00,22,00,00,00,00,00,22,22,
    
22,22,22,00,00,00,00,22,00,00,22,00,00,00,00,22,22,22,
    
22,22,22,22,00,00,00,22,00,00,22,00,00,00,22,22,22,22,
    
22,22,22,22,22,00,00,00,00,00,00,00,00,22,22,22,22,22,
    
00,22,22,22,22,22,00,00,00,00,00,00,22,22,22,22,22,00,
    
00,00,22,22,22,22,22,00,00,00,00,22,00,22,22,22,00,00,
    
00,00,00,22,22,22,22,22,00,00,22,00,00,22,22,00,00,00,
    
00,00,00,00,22,22,22,22,22,22,22,22,22,22,00,00,00,00,
    
00,00,00,00,00,22,22,22,22,22,22,22,22,00,00,00,00,00,
    
00,00,00,00,00,00,22,22,22,22,22,22,00,00,00,00,00,00,
    
00,00,00,00,00,00,00,22,22,22,22,00,00,00,00,00,00,00,
    
00,00,00,00,00,00,00,00,22,22,00,00,00,00,00,00,00,00,
      });
}
function 
onTimeout(){
  if (
keydown(6)){
    
detachplayer;
    
player.x=x-4;
    
player.y=y-4;
    
setplayerprop #c,You left the boat.;
  
}
  
setTimer(0.05);



Tigairius 05-21-2008 07:39 AM

You're mixing GS1 with GS2!
setplayerprop #c,You left the boat.;
player.chat = "You left the boat.";

detachplayer;
detachplayer();

but in all honesty, I'm going to need some other details, does it only happens when it changes levels or what?

wild8900 05-21-2008 07:45 AM

When I touch the boat it warps the player a few times then centers at the point I tell it to but for some reason other players don't see the updated position or something. I think it fixes if you update level but Im not sure.

Tigairius 05-21-2008 07:58 AM

I think that's just one of the bugs with attachplayer, it's a bit buggy like that. Try putting attachplayertoobj before player.x/player.y changes in the serverside part of the script.

wild8900 05-21-2008 08:15 AM

Seems to work but when I reconnect or someone else does it acts the same way...

Tigairius 05-21-2008 08:17 AM

You might need to detach the player upon reconnection.

Ziro_of_the_Turks 05-21-2008 07:58 PM

I wanna ride some boats that aren't on GK :(

Or hell, I wanna ride anything on any non-GK server that attaches more than 1 player to the object (that means no 1-player vehicles)

Here's the fun part- Graal is now big enough that I have to ask... Does anyone know where I can find something like this availible to play with? Any open-server with something like that? :(

Tigairius 05-21-2008 08:04 PM

I have a floating island on N-Pulse that sometimes has up to 20 people on it.

Ziro_of_the_Turks 05-21-2008 08:56 PM

Show me. plox.

cbk1994 05-21-2008 10:08 PM

I made a floating elevator for Utopia ...

But yes, attach before changing x/y and deattach at login.

wild8900 05-22-2008 07:43 AM

Do both functions have to be clientsided or serversided? It still doesnt work...
At first it looks like it works but when you reconnect it messes up the positions of others on your screen...

cbk1994 05-22-2008 10:35 PM

I would use serverside attach. But, does this even exist? I've only used attach one time.

wild8900 05-23-2008 05:18 AM

It is serversided... but what about detach?

cbk1994 05-23-2008 05:30 AM

Definitely serverside or it won't update on the server.

wild8900 05-23-2008 09:47 AM

both are serversided...


All times are GMT +2. The time now is 02:47 PM.

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