• My Pages
  • Comments
  • Add Link
  • Subscribe
  • Subscribe User
  • Edit (Text)
  • Rename Page
  • Copy Page
  • Load Page
  • Save Page
  • Delete Page
  • Attachments
  • Check Spelling
  • Diffs
  • Info
  • Revert to this revision
  • XML
  • Render as Docbook
  • Print View
  • Raw Text
  • Delete Cache
  • Like Pages
  • Local Site Map
  • Remove Spam
  • Package Pages
  • Sync Pages

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

    Incoming enemy armies can be referenced as:

    • m_city.cityManager.enemyArmies[x].property or city.enemyArmies[x].property

    Incoming friendly armies can be referenced as:

    • m_city.cityManager.friendlyArmies[x].property or city.friendlyArmies[x].property

    Your own armies can be referenced as:

    • m_city.cityManager.selfArmies[x].property or city.selfArmies[x].property

    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

    • // List the origin and target of the 1st marching wave of your troops
      origin = city.selfArmies[0].startPosName
      target = city.selfArmies[0].targetPosName
      echo "My first wave in the rally at city " + origin + " has " + target + " as it's target."
      
      Result:
      18:55:26 My first wave in the rally at city Shanra has Barbarian's city as it's target.
      18:55:27 Script stopped



    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

    • // This sample script outputs the amount of food carried by the first army in the Armies window
      res = city.selfArmies[0].resource
      echo "Food amount is " + res.food



    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

    • // This sample script outputs the amount of ballista incoming in the first enemy army wave in the Armies window
      echo "Ballista amount is " + city.enemyArmies[0].troop.ballista


    ScriptObjects

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