Is checking a unitstat in IsTargetWorthy possible?

Hi all,

I've looked through the IsTargetWorthy tags for the spells and can't see any examples other than something to get hit points.

Anyone know a way to check for value of a custom unitstat in the IsTargetWorthy tag?

Thanks.



3,678 views 3 replies
Reply #1 Top

OK, pulling up a tag with IsTargetWorthy...


        <ValueCalcWrapper>
            <ValueType>IsTargetWorthy</ValueType>
            <Calculate InternalName="Calc" ValueOwner="TargetUnit">
                <Expression><![CDATA[[Unit_GetHPCurrent]]]></Expression>
            </Calculate>
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc] < 30]]></Expression>
            </Calculate>
        </ValueCalcWrapper>

I'd think simply substituting the Unit_GetHPCurrent with your custom unit stat should be fine.  Here's an example that affects UnitStat_Accuracy:


        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Accuracy</StrVal>
            <DisplayName>Blinded</DisplayName>
            <Duration>5</Duration>
            <Effect>E_Blindness_Particle</Effect>
            <Calculate InternalName="Calc" ValueOwner="TargetUnit">
                <Expression><![CDATA[[UnitStat_Accuracy] * -0.25]]></Expression>
            </Calculate>
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc]]]></Expression>
            </Calculate>
        </GameModifier>

Sooo, merging these two, I'd guess that this would be a suitable 'call' for istargetworthy using Accuracy as the base:

         <ValueCalcWrapper>
            <ValueType>IsTargetWorthy</ValueType>
            <Calculate InternalName="Calc" ValueOwner="TargetUnit">
                <Expression><![CDATA[[UnitStat_Accuracy]*1]]></Expression>
            </Calculate>
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc] < 30]]></Expression>
            </Calculate>
        </ValueCalcWrapper>

 

You should be able to substitute UnitStat_MyCustomStatName (whatever it is) for UnitStat_Accuracy.

I'd think that'd work, but of course the only way to know is to test it.  Let us know how it goes!

Reply #2 Top

OK home from work, had a bit of a chance to test this now and from what I can tell so far unfortunately it doesn't seem to do anything.  Will try a few variations though.

 

 

 

Reply #3 Top

OK, I had a thought here which may be relevant to your issue.

I noticed targetunit in the tag, which means you'd use the target unit for the stat.  Are you trying to cast a spell on/target a unit, or are you trying to modify the caster's/owner's stat?

Also, as a suggestion you might try Unit_GetCustomStat instead of UnitStat_CustomStat as a variation...