TCArknight
Well-known member
Howdy!
in the system I'm playing around with there are 10 attributes which can be generated randomly. For Random generation, I am storing the initial/base value in an array on the hero. Each attribute pulls the array value into the BaseValue field. Once those are set, then the values of two attributes can be swapped. Swapping is done through two choosers, one for the "from:"and one for the "to:". When a button is clicked, the two values in the array change should change.
The Base Value field of the attributes change, but the FinalValues never recalculate.
Is there a secret to getting the trtFinal field to recalculate?
in the system I'm playing around with there are 10 attributes which can be generated randomly. For Random generation, I am storing the initial/base value in an array on the hero. Each attribute pulls the array value into the BaseValue field. Once those are set, then the values of two attributes can be swapped. Swapping is done through two choosers, one for the "from:"and one for the "to:". When a button is clicked, the two values in the array change should change.
The Base Value field of the attributes change, but the FinalValues never recalculate.
Code:
(Procedure to load the array to the various attributes)
<procedure id="RecalcBaseScores" scripttype="none"><![CDATA[
~declare variables that are used to communicate with our caller
var score as number
var i as number
i = 0
foreach pick in hero from Attribute
eachpick.field[trtBaseValue].value = herofield[acRandomAbils].arrayvalue[i]
i += 1
nexteach
]]></procedure>
(Eval Script on the Attribute Component)
<!-- Calculate the final value from the three distinct pieces -->
<eval index="1" phase="Traits" priority="3000" name="Calc trtFinal"><![CDATA[
if (hero.tagis[source.srcAbilityRandom] <> 0) then
Call RecalcBaseScores
endif
field[trtFinal].value = field[trtBaseValue].value + field[trtUser].value + field[trtBonus].value + field[trtGear].value + field[trtInPlay].value
]]></eval>
Is there a secret to getting the trtFinal field to recalculate?