A zone represent a patch of land in Northgard that can be colonized and exploited by the players. Any entity is located in

Variables

allowScouting:Bool

Allow the player to discover this zone with a scout.

read onlybuildings:Array<Building>

All the buildings in the zone. Include player built buildings and gameplay buildings like Wolf Den or Swamp, but not decorative rocks, trees or grasses.

read onlycolonize:Float

[HostOnly] The progress of a zone colonisation, if the zone is neutral or contested. Goes from 0 to 1, at which the zone owner become the owner referenced by colonizeBy.

read onlycolonizeBy:Float

[HostOnly] The player current attacking the zone, if the zone is neutral or contested.

id:Int

[HostOnly] The id of the zone, can be retrieved using the map editor.

maxBuildings:Int

[HostOnly] The maximum number of building a zone can hold, excluding the additional buildings from a developped zone or from Kraken's Shallow Waters

read onlynext:Array<Zone>

The list of neighbor zones accessible from this one.

owner:Player

[HostOnly] The current owner of a zone.

read onlyteam:Faction

The team owning this zone.

read onlyunits:Array<Unit>

All the active units in the zone. Include foes like draugar or wolfs.

Methods

addUnit(kind:UnitKind, ?nb:Int, ?owner:Player, ?withSpawnSfx:Bool, ?modelsNb:Array<Int>, ?radiusMax:Float):Array<Unit>

[HostOnly] Add a unit of a certain UnitKind at a random position in the zone.

Parameters:

kind

The kind of unit to add.

nb

[Optional] A number of units to spawn at once. Spawn one by default.

owner

[Optional] The units' owner. Is the main player by default.

withSpawnSfx

[Optional] Set at true to play the spawn sound effect. False by default.

modelsNb

[Optional] An array of variant ids to change the visuals of each new units with variants.

rayMax

[Optional] Constrain the spawn position inside a radius from the center of the zone.

getDepositResCount(res:ResourceKind):Float

Tell the quantity of a specific ore resource is available in the whole zone.

Parameters:

res

The kind of resource we want to count. Only works with an ore resource like Stone, Iron, RimeSteel or Gemstone.

Returns:

Float

getUnit(kind:UnitKind):Unit

Get the unit of a given kind which entered the zone first.

Parameters:

kind

Returns:

Unit

@:value({ alert : true })takeControl(newOwner:Player, alert:Bool = true):Void

[HostOnly] Immediately give the control of the zone to the given player.

Parameters:

newOwner
alert

[Optional] Do we generate an alert to the player as he lose or gain a zone.