[abandoned] Hitpoints and Constitution

[qoute] Note that constitution has been removed from the game, this topic is thus pointless.[/quote]

 

 

 

 

When I started modding, one of the more aggravating areas was how hitpoints and constitution interacted.

 

Let's say that a unit has this in his unittype:

       <LevelMilestone InternalName="L1">
            <Level>1</Level>
            <UnitStat_Constitution>9</UnitStat_Constitution>
            <UnitStat_Hitpoints>12</UnitStat_Hitpoints>
        </LevelMilestone>

 

In fact, the UnitStat_Hitpoints is dynamic, AFTER it has been determined in a milestone tag. In other words, you can give a unit 12 UnitStat_Hitpoints in the milestone tag, but after that, the number will change.

The true value of dynamic UnitStat_Hitpoints is in fact

(milestone UnitStat_Hitpoints + (( UnitStat_Constitution * level * 0,3) + 3) ) * troopcount           (this is true in 0.77 beta, will update if it changes)

so the above unit would at level 1, if it is not a group, have

12 + (( 9 * 1 * 0.3) + 3) * 1 = 17.7

The dynamic UnitStat_Hitpoints always gets rounded up, so 17,7 = 18 and 17,1 = 18.

 

Why is this important? Because you have to understand that the UnitStat_Hitpoints you see in-game, after the original milestone, is in fact a very different value than the one you assigned in the original milestone. And this impacts what you do in modifiers.

Consider the following modifier:

        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Hitpoints</StrVal>
            <DisplayName>Withered</DisplayName>
            <Duration>3</Duration>
            <Multiplier>0.8</Multiplier>
        </GameModifier>

At first glance, it would seem that this would multiply your milestone UnitStat_Hitpoints by 0.8, ie reduce it by 20%. But you will be surprised to find that it is NOT 12*0.8, it is in fact 17,7*0.8. As you can tell, it is not affecting your milestone UnitStat_Hitpoints, but your dynamic UnitStat_Hitpoints.

 

 

The result of this is that we can use such modifiers to modify your UnitStat_Hitpoints, even if your unittype has no UnitStat_Hitpoints to start with.

Let's take another unittype as an example:

 

     <LevelMilestone InternalName="L1">
            <Level>1</Level>
            <UnitStat_Constitution>9</UnitStat_Constitution>
            <UnitStat_Hitpoints>0</UnitStat_Hitpoints>
        </LevelMilestone>

This guy has zero milestone UnitStat_Hitpoints, is level 1 and is alone. His dynamic UnitStat_Hitpoints:

0 + (( 9 * 1 * 0.3) + 3) * 1 = 5,7 ~~ 6

 

But, what happens if we use this modifier on him?

        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Hitpoints</StrVal>
            <DisplayName>Withered</DisplayName>
            <Duration>3</Duration>
            <Multiplier>0.8</Multiplier>
        </GameModifier>

As I said, such modifiers impact the dynamic value of hitpoints. So even though he had zero milestone UnitStat_Hitpoints, this modifier will in fact reduce his dynamic UnitStat_Hitpoints to 5,7*0.8.

 

This is very important to understand when you refer to UnitStat_Hitpoints, that outside of the milestone tag, you are always referring to the dynamic UnitStat_Hitpoints. If you set up a spell to return a value equal to one third of your UnitStat_Hitpoints, it will be one third of the dynamic value, NOT the milestone value.

Example:

       <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>CurHealth</Attribute>
            <ApplyToCaster>1</ApplyToCaster>
            <Calculate InternalName="Calc" ValueOwner="CastingUnit">
                <Expression><![CDATA[[UnitStat_HitPoints] / 3]]></Expression>
            </Calculate>
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc] * -1]]></Expression>
            </Calculate>
        </GameModifier>

This modifier calculates the maximum hitpoints from a unit, divides it by 3, and deals that amount in damage to the unit.

 


 

So what's the difference between giving a unit UnitStat_Hitpoints and giving it UnitStat_Constitution in the milestone? They both get added up to the dynamic UnitStat_Hitpoints, right? Wrong.

The milestone UnitStat_Hitpoints does not scale with level one bit. But UnitStat_Constitution does, and as a result so does the dynamic UnitStat_Hitpoints.

Here's a chart to give you an overview of how constitution works on its own: http://i.snag.gy/ZDIOc.jpg  (this is true in 0.77 beta, will update if it changes)

The formula for just constitution bonus is ( UnitStat_Constitution * level * 0.3 ) + 3   (this is true in 0.77 beta, will update if it changes)

 

 

 

 

5,963 views 1 replies
Reply #1 Top

Like spell effects/traits, I want to tackle hitpoint next. I want units to have one body value, based on type of creature/race/etc. Have some traits that allow for a point or two of adding per pickup. If the body values are better matched to the weapons then it is easier to balance spells, weapons and armour. Right now it is a one shot fest in most cases. If the races are starting around 50, and everything else is scaled up/down on size. This will work better with mass effect spells too. I've already got a working fireball that is not laying waste to everything in site (mainly because I've adjusted all the mana related traits). Looks like using just Constitution may do the trick.

Good work!