A multipurpose unit. Can be either a fighting or a producting unit.
Variables
canPatrol:Bool
[HostOnly] Allow a unit to patrol in a zone. Jobless units in a friendly zones automatically starts patrolling when out of combat.
read onlyhasNoWork:Bool
Does the unit don't have any work to do. Example : A woodcutter without woodlodge.
targetPlayer:Player
[HostOnly] The player the unit is set to attack. The unit will travel to the player's territory to attack him automatically.
Methods
hideWeapons():Void
Hide the weapons of the unit. The weapons will reappear at the next attack action.
moveToZone(zone:Zone, canAttack:Bool, ?position:{y:Float, x:Float}, ?target:BaseUnit):Void
[HostOnly] Move the unit to a specific zone.
Parameters:
zone | |
---|---|
canAttack | Can the unit attack or retaliate when travelling. |
position | [Optional] Target position inside the zone. |
target | [Optional] A unit or hittable building to attack once inside the zone. |
moveUnit(x:Float, y:Float, ?walk:Bool):Void
[HostOnly] Make the unit move to the given coordinates.
Parameters:
x | |
---|---|
y | |
walk | true to have the unit walk instead of run, default at false. |
orientToPosSmooth(x:Float, y:Float, nbFrames:Float = 60.):Void
[HostOnly] Turn the unit toward the given coordinates over time.
Parameters:
x | |
---|---|
y | |
nbFrames | [Optional] The number of frames it takes, on a 60 frames per second base, for the units to rotate toward the target. |
orientToTargetSmooth(target:Entity, nbFrames:Float = 60.):Void
[HostOnly] Turn the unit toward a target over time.
Parameters:
e | |
---|---|
nbFrames | [Optional] The number of frames it takes, on a 60 frames per second base, for the units to rotate toward the target. |
setControlable(b:Bool):Void
[HostOnly] Allow or forbid a unit to be given orders by a player.
Parameters:
b | true to allow, false to forbid |
---|