The Army objects can reference details about the armies marching to or from your cities.

Incoming enemy armies can be referenced as:

Incoming friendly armies can be referenced as:

Your own armies can be referenced as:

The [x] will signify which army it is - starting with 0 being the first one. If you had 6 marching farm crews for example, you would reference these with city.selfArmies[0].property through city.selfArmies[5].property.

The .property at the end is how you will specify which detail you are referencing. Using the table below, you can for example get the lord name of the person that the third incoming attack wave belongs to with city.enemyArmies[2].king

Some properties can have further details, for example resource and troop. Look below the table to get the extra types of properties these can have. As an example, to see how much food your first returning npc farming crew is carrying, you could use city.selfArmies[0].resource.food. Another example, using troops, lets you check how many scouts are in the second incoming reinforcement from your alliance mate by using city.friendlyArmies[1].troop.scouter.

Property

Type

Description

alliance

String

Alliance of the player who sent the army

armyId

int

army ID

direction

int

The direction the army is travelling, 1 = marching, 2 = returning

hero

String

The name of the hero sent with the wave

heroLevel

int

The level of the hero sent with the wave

king

String

Lord name of the player who sent the army

missionType

int

Type of each wave being sent from the rally point: 1 - transport, 2 - reinforce, 3 - scout, 4 - build city, 5 - attack

reachTime

int

The time the wave will arrive, given in UnixTime

resource

Object

Object describing the army resources. See below.

restTime

startCoords

String

Coordinates of the city that sent the army

startFieldId

int

FieldId of the army origination point

startPosName

String

Name of the city that sent the army

startTime

int

The time the wave was launched, given in UnixTime

targetCoords

String

Coordinates of the destination for the army

targetFieldId

int

FieldId of the army destination point

targetPosName

String

Name of the destination for the army

troop

Object

Object describing the army troops. See below.


Some Army Objects serve as functions to reference details. As above, these objects should be used with m_city.cityManager.function or city.function. For example, city.hasEnemyArmies.


Functions

Function

Type

Description

xxxxArmies.length

int

Gives the number of total waves. Used with enemyArmies, selfArmies, or friendlyArmies in place of the xxxx

hasEnemyArmiesWithin(x)

Boolean

Returns true if there are enemy armies incoming within x seconds. Optionally use hasEnemyArmiesWithin(x, true) to return true if there are enemy armies incoming within x seconds, or if the beacon is too low to see the time. Returns false if not

hasEnemyArmies

Boolean

Returns true if you have incoming enemy armies, false if not

NumberOfRealAttacks

int

The total number of non-junk attacks incoming at your city

Examples



Army Resources
The resources carried by an army can be accessed through the army resource bean.

Property

Type

Description

food

Number

Food amount

wood

Number

Wood amount

stone

Number

Stone amount

iron

Number

Iron amount

gold

Number

Gold amount

Example



Army troops
The individual troop types in an army can be accessed as well. The format for using this would be m_city.cityManager.xxxArmies[x].troop.type or city.xxxArmies[x].troop.type. For example, city.selfArmies[1].troop.scouter.

Property

Type

Description

ballista

batteringRam

carriage

catapult

heavyCavalry

lightCavalry

militia

peasants

pikemen

scouter

swordsmen

archer


ScriptObjects

Army (last edited 2014-02-10 21:14:29 by Inanna)