Looked through the reflection functions didn't find anything that could help me.
How can I detect other players near me? say 10 tile radius?
Printable View
Looked through the reflection functions didn't find anything that could help me.
How can I detect other players near me? say 10 tile radius?
As always, hooks needs updating, have a read here: https://villavu.com/forum/showthread.php?t=108798
Thank you, got it to work, now how can I add a tile radius to filter only those who are for example 10 tiles away from me?
Simba Code:program R_GetPlayers_TEST;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Misc/SmartGraphics.Simba}
{$I SRL-OSR/SRL/reflection/Reflection.simba}
var
amount: Integer;
type
TPlayer = record
Name: String;
Level: Integer;
end;
TPlayerArray = Array of TPlayer;
function R_GetPlayers: TPlayerArray;
var
I, J, _Count, _Player, _Name, _Level: Integer;
begin
_Count := SmartGetFieldArraySize(SmartCurrentTarget, 0, 'client.ga', 0);
SetLength(Result, J);
for I := 0 to _Count - 1 do begin
_Player := SmartGetFieldArrayObject(SmartCurrentTarget, 0, 'client.ga', I);
if (_Player <= 0) then
Continue;
Inc(J);
SetLength(Result, J);
end;
amount := J-1; // subtract yourslef
end;
begin
SetupSRL;
SetupReflection;
repeat
R_GetPlayers();
Writeln('There are currently '+tostr(amount)+' players');
wait(1000);
until(false);
end.
I'm surprised the class is the same after all these revisions.
Oke, something like this?
How can I get "PlayerLocation"?Simba Code:if R_DistanceFromTile(PlayerLocation) > 5 then
....
From a quick glance I didn't see the hooks for player position in the updater logs when I looked, and I don't have an OSR account to test any values.
You can test these like shown in the thread I linked:
Progress Report:v * -207467453 f * 708620417
Hmm I'm lost now :/