Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Player level/gmap in clientside allplayers loop (https://forums.graalonline.com/forums/showthread.php?t=134262331)

Crow 03-06-2011 02:43 PM

Player level/gmap in clientside allplayers loop
 
I'm trying to find out the level/gmap name of other players looping through allplayers on the clientside. Doesn't seem to work. obj.level.name and obj.gmap.name always return nothing. Any advice?

Toxen 03-06-2011 04:26 PM

for(a: allplayers) {
urvariable = a.level;
}

should work fine?

Crow 03-06-2011 05:11 PM

It'd be:
PHP Code:

for (temp.plallplayers)
  echo(
pl.level.name); 

But no, it doesn't work.

Deas_Voice 03-06-2011 07:29 PM

try using players instead of allplayers,
PHP Code:

for (temp.plplayers
  echo(
pl.level.name); 

i dont got access to graal ATM to test.

Crow 03-06-2011 07:41 PM

Quote:

Originally Posted by Deas_Voice (Post 1634894)
try using players instead of allplayers,
PHP Code:

for (temp.plplayers
  echo(
pl.level.name); 

i dont got access to graal ATM to test.

Not what I'm going for, but thanks anyway. I'm forced to use allplayers in this specific situation. I just want to know if I've missed anything that helps in this case. If there's nothing, I'll create a workaround using player attributes.

salesman 03-06-2011 07:43 PM

I don't think you'll be able to read player attributes, either. You only load information from players in the same level, iirc.

Crow 03-06-2011 07:59 PM

Quote:

Originally Posted by salesman (Post 1634900)
I don't think you'll be able to read player attributes, either. You only load information from players in the same level, iirc.

There's a server option list thingy where you can add all attributes you want to have synchronized for all players whether they are in your level or not.

WhiteDragon 03-06-2011 08:04 PM

Yeah, the problem is that player information isn't sent to you after they are more than 1 level away I think. This area can be altered with some recently added server options, but it isn't really a solution here since making the area too large would lag everything down.

The only solution, as far as I know, is the attribute/server option thing that you mentioned.

fowlplay4 03-06-2011 08:07 PM

Any chance you could share what you're trying to accomplish?

DustyPorViva 03-06-2011 08:09 PM

Player info is sent, it's just updated less frequently(only when the player changes level). However, it's just certain information.

Tigairius 03-06-2011 08:11 PM

Use player.levelname instead of player.level.name because levelname is sent to all players.

WhiteDragon 03-06-2011 08:15 PM

Personally, I encountered a problem like this when making a minimap, because you won't have the exact player coordinates after they move far away enough. My solution was just to fade players out after they are far away enough, but I think we're going to change it soon.

cbk1994 03-06-2011 08:25 PM

Quote:

Originally Posted by Tigairius (Post 1634910)
Use player.levelname instead of player.level.name because levelname is sent to all players.

Note that this only works on v6.

Crow 03-06-2011 09:08 PM

Quote:

Originally Posted by Tigairius (Post 1634910)
Use player.levelname instead of player.level.name because levelname is sent to all players.

Quote:

Originally Posted by cbk1994 (Post 1634914)
Note that this only works on v6.

*sigh*


Quote:

Originally Posted by WhiteDragon (Post 1634911)
Personally, I encountered a problem like this when making a minimap, because you won't have the exact player coordinates after they move far away enough. My solution was just to fade players out after they are far away enough, but I think we're going to change it soon.

DING DING FU-DING-KING

And we have a winner ^^ I fade on the minimap, but my minimap is, at the same time, my large map. And I don't want to fade on the large map.

Astram 08-24-2011 02:53 AM

I'm pretty new to scripting, and this might be a terrible idea but can't you do this.
Add this to allplayers
PHP Code:

function onActionServerSide() {
  
clientr.level == player.level.name;
}
//#CLIENTSIDE
function onPlayerEnters() {
  
triggerserver"gui"this.name);


And for the allplayers level thing
PHP Code:

for (temp.allplayers) {
  echo(
p.clientr.level);



0PiX0 08-24-2011 05:02 AM

Quote:

Originally Posted by Astram (Post 1665054)
And for the allplayers level thing
PHP Code:

for (temp.allplayers) {
  echo(
p.clientr.level);



You cannot read the client or clientr variables of other players from the clientside.

Crow 08-24-2011 12:08 PM

Hey, thanks for the bump. Reminded me of the issue and that we apparently have this player.levelname thingy in v6. Gotta try that later.


All times are GMT +2. The time now is 07:22 AM.

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