Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   finding players/npcs (https://forums.graalonline.com/forums/showthread.php?t=62023)

jake13jake 11-01-2005 06:47 PM

finding players/npcs
 
I'm so confused by the lack of documentation on these functions. Not sure if it's findnpc(whattheheckaretheparams)or getnpc(whattheheckaretheparams), getplayer(somekindofparams)... etc.
What I really want to do is find an NPC or player by coordinates. How the heck do you do that? The only way i know how is to cycle through the index until you find one in a range of coords.

Yen 11-01-2005 07:17 PM

findplayer(account) is the GS2 version of getplayer(account).

It only works on the serverside, because it does all actions to the player you specify.
For example..
findplayer("Yen").hearts = 0;
This would set my hearts to 0.

If you want to find an NPC or player by coordinates, you can use testplayer(x,y) or testnpc(x,y). This returns the ID of the player/NPC on those coordinates. You can then access that player/NPC by npcs[#] or players[#].

For example, if testnpc(30,30) returned 3, you could do npcs[3].chat = "Hi.";
This would set the chat of the NPC at 30,30's chat to 'Hi.'

Skyld 11-01-2005 07:38 PM

Also, findPlayerByID(id); serverside.


All times are GMT +2. The time now is 06:32 AM.

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