The unit object

From Scenario League Wiki

Jump to: navigation, search

Back To TOTPP Functions

id (get) -> integer

Returns the unit's id.

type (get)

unit.type -> unittype

Returns the unit's type.

location (get)

unit.location -> tile

Returns the unit's location.

homeCity (get/set)

unit.homeCity -> city

Returns the unit's home city, or `nil` if it doesn't have one.

damage (get/set)

unit.damage -> integer

Returns the damage taken by the unit in hitpoints.

hitpoints (get)

unit.hitpoints -> integer

Returns the number of hitpoints left. It is defined as unit.type.hitpoints - unit.damage.

moveSpent (get/set)

unit.moveSpent -> integer

Returns the number of moves spent by the unit.

order (get/set)

unit.order -> integer

Returns the current order of the unit.

owner (get/set)

unit.owner -> tribe

Returns the unit's owner.

carriedBy (get)

unit.carriedBy -> unit

Returns the carrying unit if this unit is currently on board, `nil` otherwise.

attributes (get/set)

unit.attributes -> integer

Returns the attributes of the unit (bitmask).

veteran (get/set)

unit.veteran -> boolean

Returns the veteran status of the unit.

gotoTile (get/set)

unit.gotoTile -> tile

Returns the tile the unit is moving to under the goto order, or `nil` if it doesn't have the goto order.



Activates a unit, clearing its orders, and, if it has a human owner and movement points left, selects it on the map.


unit:teleport(tile) Alias for `civ.teleportUnit(unit, tile)`.

Personal tools