• 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

    HeroBean objects can reference details about the heroes hired your cities, and those available in the inns.

    Hired heroes can be referenced as:

    • city.heroes[x].property

    Heroes in the inn can be referenced as:

    • city.innHeroes[x].property

    The [x] will signify which hero it is - starting with 0 being the first one. If you had a level 10 inn for example, you would reference these with city.innHeroes[0].property through city.innHeroes[9].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 name of your 5th hero with city.heroes[5].name

    Properties

    Property

    Type

    Description

    base

    int

    Returns the base of the hero.

    buffsArray

    ?

    ?

    experience

    int

    Returns the amount of experience points the hero currently has accumulated and not used.

    expLevels

    int

    Returns the number of levels the hero can get for it's unallocated experience.

    itemId

    int

    Returns the type of medal needed to persuade this hero. Nation medals, for example, are itemId "hero.loyalty.9"

    itemAmount

    int

    returns the number of medals (which type found via itemId) needed to persuade this hero.

    status

    int

    Returns the hero's status. 0 = idle, 1 = mayor, 2 = defending, 3 = marching, 4 = captured, 5 = returning

    id

    int

    Returns the id of the hero.

    isAttackHero

    boolean

    Returns true if the hero's highest stat is attack, false if not.

    isAvailable

    boolean

    Returns true if a hero is not busy and either mayor or idle, false if not.

    isBusy

    boolean

    Returns true if a hero is busy, false if not. Busy state is a temporary flag given to a hero who's been given a command (eg - attack this npc) but server has not yet responded that it's marching.

    isCaptured

    boolean

    Returns true if a hero is a captive, false if not.

    isDefending

    boolean

    Returns true if a hero is defending, false if not.

    isIdle

    boolean

    Returns true if a hero is idle, false if not.

    isIntelHero

    boolean

    Returns true if the hero's highest stat is intel, false if not.

    isLoyal

    boolean

    Returns true if a hero has either 100 loyalty, or .

    isMarching

    boolean

    Returns true if a hero is marching, false if not.

    isMayor

    boolean

    Returns true if a hero is mayor, false if not.

    isPoliticsHero

    boolean

    Returns true if the hero's highest stat is politics, false if not.

    isReturning

    boolean

    Returns true if a hero is returning, false if not.

    level

    int

    Returns the level of the hero.

    logoUrl

    string

    Returns the path to the image icon for the hero's face.

    loyalty

    int

    Returns the loyalty of the hero.

    management

    int

    Returns the politics stat of the hero.

    managementAdded

    int

    Returns the number of points allocated to politics, usable only with innHeroes.

    managementBuffAdded

    int

    Returns the % extra from buffs added to politics, usable only with hired heroes. Ie - 25 returned if Wealth of Nations applied.

    managementWithBuffAdded

    int

    Returns the effective politics score including points from the Wealth of Nations buff.

    name

    string

    Returns the name of the hero.

    power

    int

    Returns the attack stat of the hero.

    powerAdded

    int

    Returns the number of points allocated to attack, usable only with innHeroes.

    powerBuffAdded

    int

    Returns the % extra from buffs added to attack, usable only with hired heroes. Ie - 25 returned if Excalibur applied.

    powerWithBuffAdded

    int

    Returns the effective attack score including points from Excalibur buff.

    remainPoint

    int

    Returns the number of remaining points available to assign to stats on the hero, not available for innHeroes.

    stratagem

    int

    Returns the intel stat of the hero.

    stratagemAdded

    int

    Returns the number of points allocated to intel, usable only with innHeroes.

    stratagemBuffAdded

    int

    Returns the % extra from buffs added to intel, usable only with hired heroes. Ie - 25 returned if Art of War applied.

    stratagemWithBuffAdded

    int

    Returns the effective intel score including points from Art of War buff.

    upgradeExp

    int

    Returns the amount of experience points needed for the hero's next level.


    Some hero objects serve as functions to reference details. As above, these objects should be used with m_city.cityManager.object or city.object. For example, city.heroes.length.


    Functions

    Function

    Type

    Description

    TrainingHeroIsHere

    boolean

    Returns true if the designated traininghero is in town, false if not.

    heroes.length

    int

    Returns the number of heroes in town.

    innHeroes.length

    int

    Returns the number of heroes in the inn.

    IsHeroInCastle("HeroString")

    boolean

    returns true if specified hero string matches any hero in the castle

    AnyIdleHero("HeroString")

    boolean

    returns true if specified hero string matches any idle hero in the castle

    findHeroByName("HeroName")

    ?

    Allows to reference the above objects for a specific hero by name, for example echo city.findHeroByName("Bob").level would return the level of the hero named Bob.

    HeroLevel(level, experience)

    int

    Returns new hero level which will be achieved for a hero of specified level and unused exp.

    HeroExperience(endLevel, startLevel, experience)

    int

    Returns the total hero exp needed to reach endLevel, optional startLevel specifies the beginning hero level, optional third parameter specifies the current unused exp.

    Examples

    • // name and isPoliticsHero property
      if city.heroes[0].isPoliticsHero echo "Hero {city.heroes[0].name} is a politics hero."
      
      // expLevels property
      hero = city.heroes[0]
      echo "Hero {hero.name} has {FormatNumber(hero.experience)} experience which is enough to add {hero.expLevels} levels"
      
      // HeroExperience function
      hero = city.heroes[0]
      level = max(hero.level + 100, 432)
      echo "To reach level {level} hero {hero.name} will need {HeroExperience(level, hero.level, hero.experience)} of additional experience"


    ScriptObjects

    Heroes (last edited 2017-02-09 02:06:41 by Romulus)