SRL Archive - OSR Help

Reflection help please


Troll

2010-12-27 13:34:04

Ok some im trying to find a fishing spot which is a npc, and the id is 329 so what do i need to do to find it ? I've gone though Cstrike tut and could not seem to find it. :(

Thanks

3Garrett3

2010-12-27 13:39:16

Well technically the only thing required to find NPCs is the line of code "GetNPC(329)" although you'll find that NPCs are actually less easy to get than that and will require some innovation to provide failsafes.

I'm releasing a *Learners* version of my script very soon which has detailed comments on every line of the script. You may find it useful

Troll

2010-12-27 13:41:01

Ok thanks, umm lets see what i can find in the include :p Also a tut like that would be great i find seeing a working item helps me learn better :)

mormonman

2010-12-27 13:42:59

function FindFishingSpot(var Tile: TTile): Boolean;
var
fishSpot: TNPC;
begin
if not LoggedIn then Exit;
fishSpot := GetNPC(329);
if not (fishSpot = NULL_NPC) then
begin
Tile := fishSpot.Tile;
result := true;
end;
end;

TomTuff

2010-12-27 16:10:09

i would do…


function FindSpot(var Tile: TTile): Boolean;
var
NPCs: TNPCArray;
i: Integer;
begin
if not(LoggedIn) then
Exit;
NPCs := SortNPCs(GetNPCsBy(329));
for i := 0 to High(NPCs) do
if (TileOnMS(NPCs[i].Tile)) then
begin
Result := True;
Tile := NPCs[i].Tile;
Break;
end;
end;

mormonman

2010-12-27 16:32:18

From: TomTuff
i would do…


function FindSpot(var Tile: TTile): Boolean;
var
NPCs: TNPCArray;
i: Integer;
begin
if not(LoggedIn) then
Exit;
NPCs := SortNPCs(GetNPCsBy(329));
for i := 0 to High(NPCs) do
if (TileOnMS(NPCs[i].Tile)) then
begin
Result := True;
Tile := NPCs[i].Tile;
Break;
end;
end;


GetNPC sorts them…