Count tokens in one zone

Hi Friends,

I am working in a new module for Vietnam VG module. I want to made the pacification automatically . I need know the units that are include in a province and what type of hex they are. It depend of the hex they are occupying (Cities, cultivates, non-cultívate) they have a value.

I have clear in my head the way but I don’t know how to do it. I have define some zones in the province and mark the tokens of communist side with a special marker. Then I have to count it at the end of the season. How can I define a order that count this marker and add all in one value for all the province. For example cultivated hex with one or more token (all the stack give 1 point only) units give 1 points, Non-cultivated give 0,5, and in cities each token give +2 until 5 units (10 maximount).

I have defined the zones and the marker in the communist unit. Can you give me some idea how I can make it work.

Thanks in advance. this reduce the time of play in a big quantity and this game is very long to play. I think it would be a good tool for the module.

Thanks in advance.

One way to go about it:

  • Create a bunch of Global Properties, one for each Zone you will want to count. You could name each one after its zone e.g. “Mekong” or perhaps “Mekong_Pacification” or something like that.
  • When you’re ready to count the values for all the zones, you will have some master game piece that initiates the process (it can either be some token on your board, or you could have a button on your toolbar that sends a Global Key Command (e.g. “StartCount”) to some “secret hidden piece” you keep somewhere).
  • What the special master piece does on being told to count things is:
    (1) Sets the value of all of your Global Properties to 0
    (2) Then sends a single Global Key Command (e.g. “DoCount”) to every piece on your map that might possibly have a value.
  • What every countable piece does when receiving the “DoCount” command is:
    • Check its hex value (e.g. cities, cultivates) to find its value
    • Check its CurrentZone to find what zone it is in
    • Using those two pieces of information it has a SetGlobalProperty trait. The property name expression uses the CurrentZone to compute the right name of the property to change e.g. { CurrentZone + “_pacification” } and then the expression in an Increment setter responding to DoCount adds the proper value to the value for the zone.

So then you will fire that original thing off once and you’ll have a proper count for every zone (in the Global Properties), which you can then display, or use in calculations, or use to change markers on the map, etc.

It’s not a trivial calculation to get correct, but that’s more or less the way you’d go about it.

1 Like

Another way to do it is to have movement of each piece trigger a decrement of a property with the same name as OldZone and an increment of a property with the same name as CurrentZone. There are various different ways of achieving this, but the aim is to have an ongoing accurate count of piece values in all zones.

The module where I first encountered this was Fire in the Lake, if you want an example of how it can be done.

1 Like

Calculated Properties can now sum things up in a specified zone, but use that feature with care–if it’s something you want constantly displayed as a value that adjusts in real-time you actually don’t want to display the Calculated Property directly, as it will result in a massive performance hit. It’s safer to display a Dynamic or Global Property that is getting updated to match the value of the CP. If it’s ok to only display this value at the end of a phase or end of a turn, you could just have a piece display it at that time and toggle it back off when you’re done, and/or write it to the log instead. There are a bunch of ways!

This.

The hit is not so bad depending on the query and how many pieces are on the map. But Joel is right. You don’t want to query this way unless you have a small number of pieces. You can drag the running of the module down and then its a crap shoot.

This should not be an issue for V4 but right now be careful how you run real time calcs. They will affect 6module performance

Yes, I think in this way, but the problem is that in some cases if you move one token to other token’s hex, you have not to count, becouse the rule use hex ocupied in some cases, then 2 units in the same hex count as one. I don’t know to do this and probably is complex.

Really I don’t need this value all time, dinamic. I can check it at the end of the turn and calculate in this point. Really it is not need for play the turn, becouse player can see it easily.
The idea is that this value can update in 30 provinces automaticvally and avoid to introduce this value manually for players. But really only need at the end of the turn. One you have this value ready you make one roll for each province and see the result in a pacification table. It is done now, I only to implement the value determination.

Thanks for your interest.

@Cattlesquat, I think I see your idea. The problems it is that I can implement this. I think that SetGlobal Property are over my knowledge of Vassal programation.

I will take some time trying to do it. If I have more question I will comment her.

But the principal problem I see (All is a problem but the other steep of the plan is clear for me) is that in non cty hex, I have count hexs with tokens not tokens, becouse you only count the hex ocupies, it is the same 1 tikens there that 3 tokens. I can count ‘stacks’ and not tokens in some cases.

I will try to imploement to count tokens per zone and later I will comment the result.
Thasnk all for your advices.

Yes, time is a problem if the process is very long. I try to avoid it.

For regions where it only matters if any units are in the region, not how many, then you have the Set Global Property set the GP for that region to “1” if the unit is there, instead of incrementing the GP by 1. That way, if no units are there, the GP will remain “0”, but if any units are there, it will get changed to “1” (possibly multiple times, but that won’t matter).

I see… but the problem is that I want avoid to make 1 zone for each hex. I have a 30 zones with 20, 30 or mor hexes and I want control the number of hexes with units in that zones. there are a lot of hexes and I can not make a zone per hex.

If I understand your problem correctly, one option you are considering is to increment a Global Property when a counter moves into an empty hex and vice versa.

You might consider using Count() on the LocationName/CurrentMap and (for checking leaving a hex empty) on OldLocationName/OldMap.

This method would use your hex map locations rather than requiring a zone per hex.

I can provide an example of what the Count() expressions will look like if that will help.

Thinking a bit more… Count() is only necessary at setup. Once you have your Global Properties established, you just use the GP for each hex. Or you could try using Count() at the point you need to do the VP calculations.

Another possibility is the Game Piece Inventory Window. I’m not sure it can be configured to give you a VP result but it could be used to display number of counters of a given type at locations by type of location.

Yes, but there are some types of hex becouse one multiplay for 1, other for 0.5 and other for 2. I have to define each hex in order to use the system. I think that Zones are more practica, I can define each zone and all hexes there are include…

I don’t think about game piece Inventory. I don’t know if I can take information of there… but the problem will be the same, I need define each hex and they are 2 big maps.

I think about this new posibility
!

Finally I can not solve this objetive, I wonder if someone can see the module more in detail and help me with this part. I now it is a hard and complicate work see design you have not designed, but I think it is a great time reduction in the play you need for play the campaing. THen it will be important if we can do it.
Thasks in advance.

Someone might look if you post your module somewhere accessible.