Hep... Hep... Haeeellp! Trying to summon unit...

OK, I'm trying to get a building to summon a unit upon building completion (guardian for the city).  I've tried the following iterations with no success...

        <GameModifier InternalName="UnitJoin">
            <ModType>Unit</ModType>
            <Attribute>UnitJoinArmy</Attribute>
            <StrVal>AnnieDog</StrVal>
            <UnitClass>Unit</UnitClass>
        </GameModifier>


         <GameModifier InternalName="SummonUnit">
              <ModType>Map</ModType>
              <Attribute>SummonUnit</Attribute>
              <UnitClass>Sentinel</UnitClass>
              <StrVal>Sentinel</StrVal>
         </GameModifier>

Nothing is happening with either version.  Suggestions?  Anyone have any success with writing code for a building that creates a unit upon completion, as opposed to making unit production possible?

4,106 views 8 replies
Reply #1 Top

Try using City for Modtype.

 

Reply #2 Top

I use this type of game modifier in my spells mod

 

 <GameModifier InternalName="SummonUnit">    

 <ModType>Unit</ModType>    

 <Attribute>SummonUnit</Attribute>      

<UnitClass>Sentinel</UnitClass>    

 <StrVal>Sentinel</StrVal>    

 <Duration>-1</Duration>  

 </GameModifier>

Reply #3 Top

Buildings don't cast spells the same was as other modifiers.

Reply #4 Top

Quoting impinc, reply 1
Try using City for Modtype.

 
End of impinc's quote

Will do.  Will be later today though.  I'll let you know how it goes.

Unless someone else posts another solution before then...

Reply #5 Top

Still no luck.  Using City for ModType didn't help.   I'm actually thinking of a workaround, where the structure casts a spell when it is completed.  Not sure if that can be done though.

Reply #6 Top

Structures don't cast spells. A lot of modifiers that work inside a spelldef will simply fail outside it.

Edit: That sounded very negative. You should keep trying, of course.

Reply #7 Top

Heavenfall, when you first replied to one of my posts a while back, initially it seemed a little negative (although I didn't 'bristle' to it publicly).  I've since come to realize you aren't trying to be negative, but that some frustration of various things Elemental sometimes creeps into your wording.

No worries man!  I know you are a good egg!

:thumbsup:

Reply #8 Top

It's not exactly what you want, but you might want to try what the Random Guardian level up (from CityLevelUpBonuses.xml) option does:

Code: xml
  1. &lt;GameModifier InternalName="City_Level_Ability_Guardian_Bonus_Modifier"&gt;
  2.         &lt;ModType&gt;City&lt;/ModType&gt;
  3.         &lt;Attribute&gt;SummonRandomGuardian&lt;/Attribute&gt;
  4.         &lt;Value&gt;1.0&lt;/Value&gt;
  5. &lt;/GameModifier&gt;

This works in spells, but I haven't a clue if it would work on a building. Furthermore, I'm pretty sure you'd have little control over what unit it would summon.... you could always experiment, though.