I’m looking to add a morale rating to a unit but would like to make it hidden so that it could only be revealed during a morale check event. Is there a way?
I could use a simple text field for the item or make it a layer with numbers from 1-10 lets say.
Two separate cases - one for Layer and one for Text Label. But first, I assume you have a Dynamic Property trait that encodes your state - say Morale with the state variable State, and a Marker that encodes which side the piece belongs to - say with name Faction and possible values Axis, Allied corresponding to your Definition of Player Sides.
Define n+1 layers, where n is the number of distinct states (e.g., Morale levels 1 through 10)
The first layer has no image - or possibly a transparent image
The remaining n images show the state (e.g., Morale levels 1 through 10)
Enable Always active
Levels follow expression value
Define Follow Expression to be
{PlayerSide!=Faction ? 1 : State+1}
What this expression does is the following: If the current PlayerSide is not the same as the pieces Faction, then layer 1 is shown - the layer with no, or transparent, image. Otherwise, the level corresponding to the State of the piece plus 1 is shown. That is, if State is 5, then layer 6 is shown.
What this expression does is the following: If the current PlayerSide is not the same as the pieces Faction, then the empty string is shown. Otherwise, the string `“State=” with the current state level is shown.
If the state can be revealed, then that should be stored in some Dynamic Property trait, with name say StateRevealed, and you can modify the above expression to be
for layer and text label traits respectively. What this means is, if the current player side is _not _ the same as the pieces faction and the pieces state has not been revealed, then either level 1 or the empty string is shown. If the state has been revealed, then the condition is false and so the appropriate level or text is shown, irrespective of the player side.