<?xml version="1.0" encoding="utf-8"?>
<s1 title="HeroFunctions"><p><p>Contents</p>
<ol><li>
<link anchor="I">IsHeroInCastle</link></li>
<li>
<link anchor="T">TrainingHeroIsHere</link></li>
<li>
<link anchor="A">AnyIdleHero</link></li>
</ol>
</li>
</ol>
<p> </p>
<p>See also: <jump href="/wiki/Heroes">Heroes</jump><br/>
 </p>
<p></p>
<s2 id="IsHeroInCastle" title="IsHeroInCastle">
<table><strong class="highlight"><![CDATA[]]></strong><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Usage: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>m_city.IsHeroInCastle(&quot;HeroName&quot;) </p>
</td></tr><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Example: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>m_city.IsHeroInCastle(&quot;LKD70&quot;) </p>
</td></tr></table><p>If the hero named &quot;LKD70&quot; is in the castle this will return true. A <jump href="/wiki/HeroString">HeroString</jump> can also be used instead of the hero name.  <br/>
 </p>
<p></p>
</s2>
<s2 id="TrainingHeroIsHere" title="TrainingHeroIsHere">
<table><strong class="highlight"><![CDATA[]]></strong><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Usage: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>m_city.cityManager.TrainingHeroIsHere </p>
</td></tr><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Example: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>echo m_city.cityManager.TrainingHeroIsHere</p>
</td></tr></table><p>If the specified TrainingHero is in the castle this will return true. </p>
<p></p>
</s2>
<s2 id="AnyIdleHero" title="AnyIdleHero">
<table><strong class="highlight"><![CDATA[]]></strong><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Usage: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>m_city.AnyIdleHero(<jump href="/wiki/HeroString">HeroString</jump>) </p>
</td></tr><tr><td><strong class="highlight"><![CDATA[]]></strong><p>Example: </p>
</td><td><strong class="highlight"><![CDATA[]]></strong><p>echo m_city.AnyIdleHero(&quot;any:attack&gt;1000&quot;)</p>
</td></tr></table><p>returns true if specified hero string matches any idle hero in the castle. </p>
<p></p>
<source><![CDATA[targetValley = ("123,456")

if m_city.AnyIdleHero("any:att>100,att<300") if city.troops.archer>100k execute "attack "+targetValley+" any:att>100,att<300 a:25k,p:1,sw:1,c:1,cata:1,s:1"]]></source><p>if there is a hero matching the criteria available, and city has more than 100k arch, send it marching on the valley.... </p>
<p>assumes you have the layers constantly being replaced, it could hang waiting for missing layer... so if you use scouts to transport res, leave them out of the march. </p>

<br/>------------------------------------------------------------------------------<br/>
<p> <jump href="/wiki/CategoryFunctions">CategoryFunctions</jump> </p>
</s2></s1>