TL2Spawn = class(TL2Object)

Class describing all objects having coordinates.

Name Result Description Code Params Examples
X Integer Object coordinate X
function X: Integer;
There are no arguments
Print('My coordinates: ('+ IntToStr(User.X) +', '+ IntToStr(User.Y) +', '+IntToStr(User.Z)+')');   // prints our coordinates
Y Integer Object coordinate Y
function Y: Integer;
There are no arguments
Print('My coordinates: ('+ IntToStr(User.X) +', '+ IntToStr(User.Y) +', '+IntToStr(User.Z)+')');   // prints our coordinates
Z Integer Object coordinate Z
function Z: Integer;
There are no arguments
Print('My coordinates: ('+ IntToStr(User.X) +', '+ IntToStr(User.Y) +', '+IntToStr(User.Z)+')');   // prints our coordinates
DistTo Cardinal Distance to the point \ object
function DistTo(X: Integer; Y: Integer; Z: Integer): Cardinal; overload;   // Возвращает дистанцию до заданной точки/Returns the distance to the specified point
function DistTo(Obj: TL2Spawn): Cardinal; overload;   // Возвращает дистанцию до объекта/Returns the distance to the object

X, Y, Z - point coordinates distance to which is measured
Obj - object distance to which is measured

if (User.DistTo(User.Target.X, User.Target.Y, User.Target.Z) > 1000) then  // if distance to our target  > 1000, then..
  • Examples found for this method:
SpawnTime Cardinal Time since appearance of the object in game world (ms)
function SpawnTime: Cardinal;
There are no arguments
for i:= 0 to DropList.Count-1 do Print(DropList(i).SpawnTime);  // Checking drop list and prints info, how long each of them fell out of the mob
InRange Boolean Checking if object in radius of a point (x, y, z)
function InRange(X: Integer; Y: Integer; Z: Integer; Range: Cardinal; ZRange: Cardinal = 250): Boolean;

X, Y, Z - point coordinates
Range - search radius
ZRange - Z restriction

if (User.Target.InRange(Npc.X, Npc.Y, Npc.Z, 40)) then Print(User.Target.Name +' in range 40m of the '+Npc.Name)   // if our target is close to the NPC, will print it
InZone Boolean Check on the entry of the object in the hunting zone
function InZone: Boolean;
There are no arguments
if (User.InZone) then Print('I'm on the spot');

Objects

Name Class Description
SpawnList TL2List из TL2Spawn List of objects who have coordinates