Does Unitclass Outclass Background Stats?

I have been using some background stats to add specific modifiers to the game. After figuring out how the unitclass sepcification works, though, I am wondering if there is still a reason to even use background stats. For instance, my cities have an improvement that gives all bowmen +4 Initiative. I just need to add a unitclass tag to each unit I want to be affected and then specify that unitclass in the game modifier. Isn't that why we started using BG_Unitstat in the first place?

 

What do you think, Hf?

3,208 views 3 replies
Reply #1 Top

Wait, what?

If I understand you correctly, some units have say <Class>Archer</Class>. And you can specifically target those somehow? From what - spells, improvements, traits? I have no idea how to do that.

 

But anyway, the reason I made bg unitstats was because of this:

1) A unit's creaturetype is not dynamic (I can't change it if say a unit equips a mount so that he becomes UnitStat_BG_IsUsingMount=1)

2) A unit's creaturetype cannot be referenced in spells (I can't use it in calculate tags)

3) A unit's creaturetype does not enable me to unlock traits specific to that type (ex: a champion that suffers a Hex can only remove it at level-up if it has UnitStat_Reliquary_CanLiftCurse > 1)

4) A unit can have an infinite number of unitstats, but only one creaturetype

5) A unit's creaturetype does not allow me to make comparisons of who has more or less of X. Consider the following three examples:

 

Example 1: Always causes 50% more blunt damage against any unit with creaturetype beast

            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>AdjustUnitStat</Attribute>
                <StrVal>UnitStat_Attack_Blunt</StrVal>
                <StrVal2>Beast</StrVal2>
                <Multiplier>1.5</Multiplier>
                <vsUnitType>1</vsUnitType>
            </GameModifier>

Example 2 (not possible with creaturetype): Attacks gain +5 blunt attack by a mounted unit against an unmounted unit

      <GameModifier>
        <ModType>Unit</ModType>
        <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_Attack_Blunt</StrVal>
        <StrVal2>UnitStat_BG_IsUsingMount</StrVal2>
        <Value>5</Value>
        <vsLower>1</vsLower>
      </GameModifier>

Example 2 (not possible with creaturetype): Unit gains 15 Spell resist vs an enemy with less Grey Magic, and loses 15 Spell resist vs an enemy with more Grey magic

      <GameModifier>
        <ModType>Unit</ModType>
        <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_MagicResist</StrVal>
        <StrVal2>UnitStat_BG_GreyMagic</StrVal2>
        <Value>15</Value>
        <vsLower>1</vsLower>
      </GameModifier>

      <GameModifier>
        <ModType>Unit</ModType>
        <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_MagicResist</StrVal>
        <StrVal2>UnitStat_BG_GreyMagic</StrVal2>
        <Value>-15</Value>
        <vsHigher>1</vsHigher>
      </GameModifier>

 6) A unit's creaturetype is not inherited if the unit design is edited, and not set automatically according to what the unit is (all unit designs have no <class>)

 

Those are the reasons I can think of off the top of my head.

Reply #2 Top

I forgot about calcs. So it is still very useful. You should note that some things can be done with <Class>. Improvements that increase defense can apparently target a specific unit class. Using the same logic I am going to give each monster for the beastmaster mod a class <Class>BeastMarked</Class> and then add modifiers that use <UnitClass>BeastMarked</UnitClass>.

I am still testing this function, but it already works with city summons and a host of other random tags. That probably means unitclass is set up to target a specific class in any modifier.

Reply #3 Top

Well, there's calcs... and the other 5 reasons. Hah! Give us an example of how it works.