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 06-26-2013, 05:26 AM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
The best solution would be to stick that function into any class joined to the player. Then you can just do...

PHP Code:
temp.pl findPlayer2(this.plAcc);
echo(
temp.pl.getPreciseLevelName()); 
Alternatively if you don't want to mess with the player class, you can do it like this (but it's a bit sloppier, and it's a handy function to have in the player class anyway):

PHP Code:
function onCreated() {
  
temp.pl findPlayer2(this.plAcc);
  echo(
this.getPreciseLevelName(temp.pl));
}

function 
getPreciseLevelName(temp.pl) {
  if (
temp.pl.level.name.ends(".gmap")) {
    return 
temp.pl.level.getmappartfile(temp.pl.xtemp.pl.y);
  }
  
  return 
temp.pl.level.name;

Sorry, I wasn't clarifying myself. I meant the x and y coordinates of the level part.
Reply With Quote
  #2  
Old 06-26-2013, 05:31 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 baseman101 View Post
Sorry, I wasn't clarifying myself. I meant the x and y coordinates of the level part.
Just take the player's x and y mod 64 (the width/height of a level):

PHP Code:
temp.temp.pl.64;
temp.temp.pl.64
% is the modulo operator (the remainder of division).

This will give you the player's x/y relative to the top-left of their current level, rather than the top-left of the entire GMAP.
__________________
Reply With Quote
  #3  
Old 06-26-2013, 05:32 AM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
Just take the player's x and y mod 64 (the width/height of a level):

PHP Code:
temp.temp.pl.64;
temp.temp.pl.64
% is the modulo operator (the remainder of division).

This will give you the player's x/y relative to the top-left of their current level, rather than the top-left of the entire GMAP.
Thank you very much! You were a giant help, kudos
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 07:50 AM.


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