Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   findplayer issue (https://forums.graalonline.com/forums/showthread.php?t=63286)

jake13jake 01-08-2006 10:01 AM

findplayer issue
 
Why in the world is findplayer returning me an RC? that shouldn't be allowed -_-

napo_p2p 01-08-2006 11:09 AM

Quote:

Originally Posted by jake13jake
Why in the world is findplayer returning me an RC? that shouldn't be allowed -_-

I didn't think it was.

How are you sure it's an RC?

ApothiX 01-08-2006 12:30 PM

Yea, a little bit of code / variable output would be beneficial.

jake13jake 01-08-2006 12:57 PM

Quote:

Originally Posted by ApothiX
Yea, a little bit of code / variable output would be beneficial.

PHP Code:

  else if (player.chat.starts("/focus")) {
    
player.chat.tokenize();
    if (
tokens[1] == "self")
      
this.cameraFocus player;
    else if (
tokens[1])
      
this.cameraFocus getPlayer(tokens[1]) == -player getPlayer(tokens[1]);
  } 

was using findplayer(tokens[1]) in this code. It is supposed to setfocus on the player in tokens[1]. However, when I used findplayer() I was having a slight problem. It was recognizing the other player's existence, but it wasn't getting the x or y values right. They remained constant at 30.5,30. When I asked the player to log off RC, the script with findplayer() worked. I just used a for loop function getPlayer i made to cycle through the players array for the level. Solved the problem. But should findplayer() really find RCs? would seem proper for it to cycle over them.

Yen 01-08-2006 07:32 PM

The ''players' array only draws from the players in the current level, so you can use that for referencing. It won't get an RC.

PHP Code:

gotten players[players.index(tokens[1])];
setfocus(gotten.xgotten.y); 


napo_p2p 01-08-2006 09:30 PM

It is possible that findplayer clientside acts different from findplayer serverside (I am assuming that the script is clientside, since you are setting focus).

If that is the case, then it looks like Yen provides a good alternative.

Admins 01-08-2006 09:44 PM

On clientside findplayer returns all possible players from the player list, so also 'virtual' players like people on other servers, or irc channels. May be you can check for the level of the player to check if its an actual player walking around somewhere.

jake13jake 01-08-2006 09:47 PM

Quote:

Originally Posted by Stefan
On clientside findplayer returns all possible players from the player list, so also 'virtual' players like people on other servers, or irc channels. May be you can check for the level of the player to check if its an actual player walking around somewhere.

couldn't really have done that since I wanted to return the actual player rather than the rc of the player. Just used players[i] cycle instead.

Rick 01-09-2006 01:18 AM

Maybe the client should return normal players in priority over virtual players?

Admins 01-09-2006 03:35 AM

Yes that would make sense


All times are GMT +2. The time now is 10:43 AM.

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