Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-18-2012, 04:11 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Warping players (Bug?)

I don't know if this is a bug or if I'm doing this wrong, but it worked a few weeks ago using this method and it's not working now. I'm basically trying to "summon" a player by sending my level, x and y to the serverside, then warping the player to the said co-ordinates. For some reason, if I'm on a gmap, it will warp the player far to the right of my co-ordinates.

This is the summon trigger.
PHP Code:
case "summon":
  
with(findplayer(params[1])) {
    
temp.slevel params[2];
    
temp.sx params[3];
    
temp.sy params[4];        
    
player.setlevel2(temp.slevel,temp.sx,temp.sy);
  }
break; 
and this is what I'm sending to the server.
PHP Code:
triggerserver("gui",name,"summon",wc_TextList1.selected.text,player.level,player.x,player.y); 
wc_TextList1.selected.text being a players account name.

Any ideas?
__________________
Reply With Quote
  #2  
Old 02-18-2012, 04:18 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by Emera View Post
I don't know if this is a bug or if I'm doing this wrong, but it worked a few weeks ago using this method and it's not working now. I'm basically trying to "summon" a player by sending my level, x and y to the serverside, then warping the player to the said co-ordinates. For some reason, if I'm on a gmap, it will warp the player far to the right of my co-ordinates.

This is the summon trigger.
PHP Code:
case "summon":
  
with(findplayer(params[1])) {
    
temp.slevel params[2];
    
temp.sx params[3];
    
temp.sy params[4];        
    
player.setlevel2(temp.slevel,temp.sx,temp.sy);
  }
break; 
and this is what I'm sending to the server.
PHP Code:
triggerserver("gui",name,"summon",wc_TextList1.selected.text,player.level,player.x,player.y); 
wc_TextList1.selected.text being a players account name.

Any ideas?

It's because clientside player.level is the singular level, whereas serverside player.level would be the map object, while player.x and player.y is relevant to your map coordinates.
You don't really need to be passing level and coordinates for a basic summon though, you could just do:

PHP Code:
case "summon":
  
temp.pl findplayer(params[1]);
  if(
temp.pl == NULL){
    return;
  }
  
temp.pl.setlevel2(player.level.nameplayer.xplayer.y);
break; 
Reply With Quote
  #3  
Old 02-18-2012, 04:18 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by ffcmike View Post
It's because clientside player.level is the singular level, whereas serverside player.level would be the map object, while player.x and player.y is relevant to your map coordinates.
You don't really need to be passing level and coordinates for a basic summon though, you could just do:

PHP Code:
case "summon":
  
temp.pl findplayer(params[1]);
  if(
temp.pl == NULL){
    return;
  }
  
temp.pl.setlevel2(player.level.nameplayer.xplayer.y);
break; 
Thank you so much <3
__________________
Reply With Quote
  #4  
Old 02-18-2012, 04:19 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
I don't think you need "player.setlevel2".. Shouldn't that be "setlevel2()" since you already focused on the player?
Reply With Quote
  #5  
Old 02-18-2012, 05:10 AM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by scriptless View Post
I don't think you need "player.setlevel2".. Shouldn't that be "setlevel2()" since you already focused on the player?
It's not needed but I think it's good practice.
__________________
Reply With Quote
  #6  
Old 02-18-2012, 05:57 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by Emera View Post
It's not needed but I think it's good practice.
Why? My mind is going "player.player.blah"... lol
Reply With Quote
  #7  
Old 02-18-2012, 07:10 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by scriptless View Post
Why? My mind is going "player.player.blah"... lol
Because it makes it clear what object is being acted upon.

You don't have to use player.level in a script—you could just use level. But then it's not clear what level you're working with. The NPC's level or the player's level?

It just makes it easier to understand.
__________________
Reply With Quote
  #8  
Old 02-18-2012, 07:35 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by cbk1994 View Post
Because it makes it clear what object is being acted upon.

You don't have to use player.level in a script—you could just use level. But then it's not clear what level you're working with. The NPC's level or the player's level?

It just makes it easier to understand.
So it's just for a person reading it to look easier? why not //player after it? Just curious is there any advantages?
Reply With Quote
Reply


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 02:45 AM.


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