<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>Heroes</title><revhistory><revision><revnumber>8</revnumber><date>2017-02-09 02:06:41</date><authorinitials>Romulus</authorinitials></revision><revision><revnumber>7</revnumber><date>2016-09-27 21:00:37</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>6</revnumber><date>2016-09-27 21:00:06</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>5</revnumber><date>2015-03-27 05:00:45</date><authorinitials>tech</authorinitials></revision><revision><revnumber>4</revnumber><date>2015-03-27 04:59:46</date><authorinitials>tech</authorinitials></revision><revision><revnumber>3</revnumber><date>2014-07-13 07:19:30</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>2</revnumber><date>2014-02-10 19:01:13</date><authorinitials>Inanna</authorinitials></revision><revision><revnumber>1</revnumber><date>2014-02-10 19:00:33</date><authorinitials>Inanna</authorinitials></revision></revhistory></articleinfo><para>HeroBean objects can reference details about the heroes hired your cities, and those available in the inns. </para><para><emphasis role="strong">Hired heroes can be referenced as: </emphasis> </para><itemizedlist><listitem override="none"><para><emphasis>city.heroes[x].property</emphasis> </para></listitem></itemizedlist><para><emphasis role="strong">Heroes in the inn can be referenced as: </emphasis> </para><itemizedlist><listitem override="none"><para><emphasis>city.innHeroes[x].property</emphasis> </para></listitem></itemizedlist><para>The <emphasis>[x]</emphasis> 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 <emphasis>city.innHeroes[0].property</emphasis> through <emphasis>city.innHeroes[9].property</emphasis>. </para><para>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 <emphasis>city.heroes[5].name</emphasis> </para><para><emphasis role="strong">Properties</emphasis> </para><informaltable><tgroup cols="3"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para><emphasis role="strong">Property </emphasis> </para></entry><entry colsep="1" rowsep="1"><para><emphasis role="strong">Type</emphasis> </para></entry><entry colsep="1" rowsep="1"><para><emphasis role="strong">Description </emphasis> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>base </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the base of the hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>buffsArray </para></entry><entry colsep="1" rowsep="1"><para>? </para></entry><entry colsep="1" rowsep="1"><para>? </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>experience </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the amount of experience points the hero currently has accumulated and not used. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>expLevels </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the number of levels the hero can get for it's unallocated experience. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>itemId </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the type of medal needed to persuade this hero. Nation medals, for example, are itemId &quot;hero.loyalty.9&quot; </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>itemAmount </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>returns the number of medals (which type found via itemId) needed to persuade this hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>status </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the hero's status. 0 = idle, 1 = mayor, 2 = defending, 3 = marching, 4 = captured, 5 = returning </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>id </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the id of the hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isAttackHero </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if the hero's highest stat is attack, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isAvailable </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if a hero is not busy and either mayor or idle, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isBusy </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>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. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isCaptured </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if a hero is a captive, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isDefending </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if a hero is defending, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isIdle </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if a hero is idle, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isIntelHero </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if the hero's highest stat is intel, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isLoyal </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if a hero has either 100 loyalty, or . </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isMarching </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if a hero is marching, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isMayor </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if a hero is mayor, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isPoliticsHero </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if the hero's highest stat is politics, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>isReturning </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if a hero is returning, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>level </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the level of the hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>logoUrl </para></entry><entry colsep="1" rowsep="1"><para>string </para></entry><entry colsep="1" rowsep="1"><para>Returns the path to the image icon for the hero's face. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>loyalty </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the loyalty of the hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>management </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the politics stat of the hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>managementAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the number of points allocated to politics, usable only with innHeroes. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>managementBuffAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the % extra from buffs added to politics, usable only with hired heroes. Ie - 25 returned if Wealth of Nations applied. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>managementWithBuffAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the effective politics score including points from the Wealth of Nations buff. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>name </para></entry><entry colsep="1" rowsep="1"><para>string </para></entry><entry colsep="1" rowsep="1"><para>Returns the name of the hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>power </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the attack stat of the hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>powerAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the number of points allocated to attack, usable only with innHeroes. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>powerBuffAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the % extra from buffs added to attack, usable only with hired heroes. Ie - 25 returned if Excalibur applied. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>powerWithBuffAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the effective attack score including points from Excalibur buff. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>remainPoint </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the number of remaining points available to assign to stats on the hero, not available for innHeroes. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>stratagem </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the intel stat of the hero. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>stratagemAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the number of points allocated to intel, usable only with innHeroes. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>stratagemBuffAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the % extra from buffs added to intel, usable only with hired heroes. Ie - 25 returned if Art of War applied. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>stratagemWithBuffAdded </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the effective intel score including points from Art of War buff. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>upgradeExp </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the amount of experience points needed for the hero's next level. </para></entry></row></tbody></tgroup></informaltable><para> Some hero objects serve as functions to reference details. As above, these objects should be used with <emphasis>m_city.cityManager.object</emphasis> or <emphasis>city.object</emphasis>. For example, <emphasis>city.heroes.length</emphasis>. </para><para> <emphasis role="strong">Functions</emphasis> </para><informaltable><tgroup cols="3"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><para><emphasis role="strong">Function </emphasis> </para></entry><entry colsep="1" rowsep="1"><para><emphasis role="strong">Type</emphasis> </para></entry><entry colsep="1" rowsep="1"><para><emphasis role="strong">Description </emphasis> </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>TrainingHeroIsHere </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>Returns true if the designated traininghero is in town, false if not. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>heroes.length </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the number of heroes in town. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>innHeroes.length </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the number of heroes in the inn. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>IsHeroInCastle(&quot;HeroString&quot;) </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>returns true if specified hero string matches any hero in the castle </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>AnyIdleHero(&quot;HeroString&quot;) </para></entry><entry colsep="1" rowsep="1"><para>boolean </para></entry><entry colsep="1" rowsep="1"><para>returns true if specified hero string matches any idle hero in the castle </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>findHeroByName(&quot;HeroName&quot;) </para></entry><entry colsep="1" rowsep="1"><para>? </para></entry><entry colsep="1" rowsep="1"><para>Allows to reference the above objects for a specific hero by name, for example echo city.findHeroByName(&quot;Bob&quot;).level would return the level of the hero named Bob. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>HeroLevel(level, experience) </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns new hero level which will be achieved for a hero of specified level and unused exp. </para></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"><para>HeroExperience(endLevel, startLevel, experience) </para></entry><entry colsep="1" rowsep="1"><para>int </para></entry><entry colsep="1" rowsep="1"><para>Returns the total hero exp needed to reach endLevel, optional startLevel specifies the beginning hero level, optional third parameter specifies the current unused exp. </para></entry></row></tbody></tgroup></informaltable><para><emphasis role="strong">Examples</emphasis> </para><itemizedlist><listitem override="none"><screen><![CDATA[// name and isPoliticsHero property
if city.heroes[0].isPoliticsHero echo "Hero {city.heroes[0].name} is a politics hero."
]]><![CDATA[
// expLevels property
hero = city.heroes[0]
echo "Hero {hero.name} has {FormatNumber(hero.experience)} experience which is enough to add {hero.expLevels} levels"
]]><![CDATA[
// 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"]]></screen></listitem></itemizedlist><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="http://guide.neatportal.com/wiki/Heroes/wiki/ScriptObjects#">ScriptObjects</ulink> </para></article>