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

Hired heroes can be referenced as:

Heroes in the inn can be referenced as:

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

name

string

Returns the name of the hero.

id

int

Returns the id of the hero.

loyalty

int

Returns the loyalty of the hero.

level

int

Returns the level of the hero.

base

int

Returns the base of the hero.

management

int

Returns the politics stat of the hero.

power

int

Returns the attack stat of the hero.

stratagem

int

Returns the intel stat of the hero.

managementAdded

int

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

powerAdded

int

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

stratagemAdded

int

Returns the number of points allocated to intel, 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.

powerBuffAdded

int

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

stratagemBuffAdded

int

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

managementWithBuffAdded

int

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

powerWithBuffAdded

int

Returns the effective attack score including points from Excalibur buff.

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.

experience

int

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

remainPoint

int

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

logoUrl

string

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

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

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.

isAvailable

boolean

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

isIdle

boolean

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

isMayor

boolean

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

isDefending

boolean

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

isMarching

boolean

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

isCaptured

boolean

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

isReturning

boolean

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

isPoliticsHero

boolean

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

isAttackHero

boolean

Returns true if the hero's highest stat is attack, 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 .

buffsArray

?

?


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.

Examples


ScriptObjects

Heroes (last edited 2015-03-27 05:00:45 by tech)