A
Anime
Guest
Code:
I used this as a way to check the index of the NPC I'm looking for:
The index of the NPC that I'm lookng for was '0'.
My script crashes when I use:
I get a out of range error.
How can it be out of range if it printed Mobiles[0] in the debug?
Code:
var
Mobiles : array of TNPC;
Index : Integer;
begin
Mobiles := GetNPCsByID( mobile );
for Index := 0 to GetArrayLength( Mobiles ) - 1 do
begin
Writeln( 'Index: ' + IntToStr( Index ) );
Writeln( 'Name: ' + Mobiles[Index].name );
Writeln( 'ID: ' + IntToStr( Mobiles[Index].NPCType ) );
end;
if not TileOnMS( Mobiles[0].tile, Player.Height ) then
begin
WalkToTile( Mobiles[0].tile, 5, 1 );
Wait( 500 + Random( 250 ) );
end;
Result := TileToMS( Mobiles[0].tile, Player.Height );
end;
I used this as a way to check the index of the NPC I'm looking for:
Code:
for Index := 0 to GetArrayLength( Mobiles ) - 1 do
begin
Writeln( 'Index: ' + IntToStr( Index ) );
Writeln( 'Name: ' + Mobiles[Index].name );
Writeln( 'ID: ' + IntToStr( Mobiles[Index].NPCType ) );
end;
My script crashes when I use:
Code:
if not TileOnMS( Mobiles[0].tile, Player.Height ) then
How can it be out of range if it printed Mobiles[0] in the debug?

