SRL Archive - Reflection Help

Npcs help


austin2162

2011-05-12 22:21:13

imma trying to learn reflection i wrote from a form on how to get npc data this is my code
procedure DoNPC;
var
NPCs:TNPCArray;
i,ii:integer;
begin
Repeat
NPCs := SortNPCs(getnpcs(15));
Writeln('--NPCs--');
For I:=0 to high(GetNPCs(15)) do
begin
Writeln('[' + ToStr(I) + ']Name: ' + NPCs[I].Name + '(' + ToStr(NPCs[I].Tile.X) + ', ' + ToStr(NPCs[I].Tile.Y) + ') ID: ' + ToStr(NPCs[I].ID) + ' - Index:' + ToStr(NPCs[I].Index));
Writeln(' Orientation: ' + ToStr(NPCs[I].Orientation) + ' - Level: ' + ToStr(NPCs[I].Level) + ' - Animation:' + ToStr(NPCs[I].Animation) + + ' - HPRatio:' + ToStr(NPCs[I].HPRatio));
Writeln(' Moving:' + ToStr(NPCs[I].Moving) + ' - InFight:' + ToStr(NPCs[I].Fighting) + ' - Interacting:' + ToStr(NPCs[I].Interacting) + ' - Height:' + ToStr(NPCs[I].Height));
Writeln(' Actions:');
For II:=0 to High(NPCs[I].Actions) do
Writeln(' ' + NPCs[I].Actions[II]);
end;
Wait(3000);

ClearDebug;
Until(False);
end;
i modified slighly to work.
but it still doesnt work npc are in the area.

any_one

2011-05-12 22:30:06

Wouldn't it be
 for i := 0 to High(NPCs) do
...

?

austin2162

2011-05-12 22:57:18

It didnt work it stll comes up blank
figured it out.

like this
procedure DoNPC;

begin
Repeat
NPCs := SortNPCs(getnpcs('Monsternamehere'));
Writeln('--NPCs--');
For I:=0 to high(NPCs) do
begin
Writeln('[' + ToStr(I) + ']Name: ' + NPCs[I].Name + '(' + ToStr(NPCs[I].Tile.X) + ', ' + ToStr(NPCs[I].Tile.Y) + ') ID: ' + ToStr(NPCs[I].ID) + ' - Index:' + ToStr(NPCs[I].Index));
Writeln(' Orientation: ' + ToStr(NPCs[I].Orientation) + ' - Level: ' + ToStr(NPCs[I].Level) + ' - Animation:' + ToStr(NPCs[I].Animation) + + ' - HPRatio:' + ToStr(NPCs[I].HPRatio));
Writeln(' Moving:' + ToStr(NPCs[I].Moving) + ' - InFight:' + ToStr(NPCs[I].Fighting) + ' - Interacting:' + ToStr(NPCs[I].Interacting) + ' - Height:' + ToStr(NPCs[I].Height));
Writeln(' Actions:');
For II:=0 to High(NPCs[I].Actions) do
Writeln(' ' + NPCs[I].Actions[II]);
end;
Wait(3000);

ClearDebug;
Until(False);
end;

mormonman

2011-05-12 23:36:32

You are only searching for NPCs with the ID: 15.
Use GetAllNPCs(False);

austin2162

2011-05-12 23:57:54

Thanks