Changing Morale of a counter based on formation

I have a Text ID $morale$ what I am looking to do is have that value be reduced 1 when in line formation, but increase 1 when in square. So the formula would have to check current formation to make sure it correctly reduces or increases, that way a square formation can’t be put in square again and have it’s morale go up again, or in line formation and have it’s value reduce again etc.

So I figure the simple thing to change the value is to trigger the dynamic property key to reduce or increase the value, but I’m not sure how to take a formation check to determine what Dynamic Property to trigger

So line to square +1 +1 from line to column +1, column to square +1, square to line -1 -1, square to column -1
I’m using crtl + for adding and crtl - for subtracting the value.

So do I need to assign a text ID with $Formation$ With text values of Line, Column, Square and a text ID of $Future Formation$ where you select from the 3 items and compare the two formations and trigger keys that way?

So if Future formation = line and formation = column then crtl - and formation = future formation

Not sure how to actually write the code so hope it’s clear!

By Text ID do you, I think, mean a Text Label trait?

Looks you have a Dynamic Property, Formation, and the possible values are “Line”, “Column”, “Square”.

You could now add a Calculated Property, MoraleModifier, and the “expression” field for it could be…
In other words, there’s a +1 bonus for being in square, a -1 penalty for being in line, and neutral (0) for being in column (or perhaps I’ve misunderstood your levels, but you can correct).

Now I gather you also have some base morale value for the unit – either a Marker or a Dynamic Property, “Morale”? So you could have a Calculated Property, NetMorale, and the expression for it could be…
Morale + MoraleModifier
So the “base morale” of the unit isn’t being changed by this, only the modified Net Morale – this prevents the problem you imagined of the unit being put in square twice and receiving a double benefit, etc. You could of course bypass having a separate Calculated Property for MoraleModifier, and have the expression for NetMorale instead be…
Morale + If(Formation==“Square”,1,If(Formation==“Line”,-1,0))
(if you never need to separately access the current value of the modifier). I just thought explaining it as two steps might make it easier.

So then, available to your Text Label, would be the substitutions:
$NetMorale$ $Formation$ etc. You could optionally even mention $MoraleModifier$

I hope that helps give you the idea?


Thanks I will think about this!!