ClassicUO Logo

#Class: Target

Target.Target

#Constructors

#constructor

new Target()

#Methods

#entity

entity(serial): void

Target a Mobile or an Item with the currently open target

Example

client.castSpell(Spells.Heal);
target.wait();
target.entity(player);

#Parameters

Name Type
serial SerialOrEntity

#Returns

void


#self

self(): void

Target self with the currently open target

Example

client.castSpell(Spells.Heal);
target.wait();
target.self();

#Returns

void


#terrain

terrain(x, y, z, graphic?): void

Target a Tile or Static

Example

This will target the tile

client.castSpell(Spells.Teleport);
target.wait();
target.terrain(1203, 222, 0);

Example

This will target the static graphic on a specific tile

client.castSpell(Spells.Teleport);
target.wait();
target.terrain(1203, 222, 0, 0x5a2);

#Parameters

Name Type
x number
y number
z number
graphic? number

#Returns

void


#terrainWithOffset

terrainWithOffset(x, y, z, graphic?): void

Target a Tile or Static where { x, y, z } is the distance from the player.

Example

This will target the tile at position { player.x - 1, player.y - 2, player.z - 0 }

client.castSpell(Spells.Teleport);
target.wait();
target.terrainWithOffset(1, 2, 0);

Example

This will target the static graphic on a specific tile at position { player.x - 1, player.y - 2, player.z - 0 }

client.castSpell(Spells.Teleport);
target.wait();
target.terrainWithOffset(1, 2, 0, 0x5a2);

#Parameters

Name Type
x number
y number
z number
graphic? number

#Returns

void


#terrainRelativeToEntity

terrainRelativeToEntity(entity, range, forward, graphic?): void

Target a Tile or Static from a specific Item or Mobile

Example

This will target the file in front or behind the Mobile

client.castSpell(Spells.Teleport);
target.wait();
target.terrainRelativeToEntity(mob, 5, true);

Example

This will target the static on a specific tile in front or behind the Mobile

client.castSpell(Spells.Teleport);
target.wait();
target.terrainRelativeToEntity(mob, 5, true, 0x5a2);

#Parameters

Name Type
entity SerialOrEntity
range number
forward boolean
graphic? number

#Returns

void


#wait

wait(timeoutMs?): boolean

Wait for the target to open within a specific amount of time.

#Parameters

Name Type
timeoutMs? number

#Returns

boolean


#waitTargetEntity

waitTargetEntity(entity, timeoutMs?): boolean

Waits for the target to open, and then targets the desired entity

#Parameters

Name Type
entity SerialOrEntity
timeoutMs? number

#Returns

boolean


#waitTargetSelf

waitTargetSelf(timeoutMs?): boolean

Wait for target with a specific amount of time, when open target self.

#Parameters

Name Type
timeoutMs? number

#Returns

boolean


#clearQueue

clearQueue(): null

Clear target queue

#Returns

null


#cancel

cancel(): void

Close the target

#Returns

void

#Accessors

#open

get open(): boolean

Check if target is open

#Returns

boolean


#lastSerial

get lastSerial(): number

Serial of the last target

#Returns

number


#queryTarget

get queryTarget(): TargetInfo

Creates a target and returns information about the result

#Returns

TargetInfo