Am I Missing Something on Dynamic Properties?

I’ve run across a problem that I’m not sure is a bug or something that Vassal doesn’t support.

I have army counters that use a Dynamic Property called UnitCount that is used to show the number of units on that counter. This is a numeric value and both the dynamic property - and the layer that’s adjusted via this dynamic property - are working fine.

I then have a Set Global Property trait on the units called StatsCount1 that I’m using to collect statistics on the map. The trigger for the trait is supposed to increment the StatsCount by $UnitCount$ but all I get is a message that says,

  • Bad Data in Module: Numeric field contains a non-number Increment StatsCount1: format=$UnitCount$, value=UnitCount

Can’t I increment a Global Property with a Dynamic Property?

I could use some help here. I’m sort of stuck until I can find a way to increment a Global Property with the number of units on a counter.

Since the Dynamic Property of UnitCount didn’t seem to work, I tried using the layer level.

The name of the level that displays the unit count on the piece is NumUnits. I tried to increment the Global Property of StatsCount1 with $NumUnits_Level$ and I still get an error message that says,

  • Bad Data in Module: Numeric field contains a non-number Increment StatsCount1: format=$NumUnits_Level$, value=NumUnits_Level

I have verified that all properties are numeric values so I’m completely at a loss as to what the problem is.

I made a simple test mod (.vmod renamed to .zip for attachment purposes)

The first button randomizes the number of units on each of the two counters.

The second button triggers each counter to update a Global Property called StatsCount by the UnitCount of each piece and display the total below the buttons.

It doesn’t work. Why?

Your trait stack order is the problem - fixed attached

Thanx for the fix but raises a question.

If things are supposed to work from the bottom up, why would the Dynamic Property reside above the Set Global Property?