neeger
2014-12-07 21:30:42
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?
How can I detect other players near me? say 10 tile radius?
2014-12-07 21:30:42
2014-12-07 21:46:16
2014-12-08 07:15:15
From: Frement
As always, hooks needs updating, have a read here: https://villavu.com/forum/showthread.php?t=108798
2014-12-08 16:14:25
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.
2014-12-08 16:49:13
From: neeger
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?
2014-12-08 16:57:50
2014-12-08 20:02:53
if R_DistanceFromTile(PlayerLocation) > 5 then
....
How can I get "PlayerLocation"?
2014-12-08 20:09:46
v * -207467453
f * 708620417
2014-12-08 20:53:16
2014-12-08 21:18:21
From: neeger
Hmm I'm lost now :/