How to conditionally counting Cargo and show the sum(s) to another piece?


This is a Commander unit, and his Card describing it. On the card (which is a Mat) there’s two Tokens (Mat Cargo) and the card shows the MatNumCargo property (that green number).

I’d need to show that same exact number on that tiny circle under the Commander feet, which seems to me a work for Attachments, but i can’t figure out how to do it.

And, how can i count ONLY that kind of token? That card can have other types of Cargo, but they need to be summed separately, by type. How can i do that? Again, seems a matter of Attachments, right?

I can’t use the Zone (i think) 'cause there will be at least two Commander cards, and I need to count the tokens on each of them.

I’d need to be kickstarted on this all.

You may want to take a look at what I do in Littoral Commander: Indo-Pacific.

In that game, each unit has an associated “tracker” card. Cubes on those cards track hit points and available resources (Long-range, Supply, Intercept, and Close combat ammo). The placement of the cube on the card indicates the level (there are slots from 1 to 20 on each tracker card). A unit cannot perform an attack (nor counter attack) if it does not have the corresponding available resource.

In the module, the cubes - separate for each resource type - are implemented as Cargo and the tracker cards as Mats. The tracker cards knows the resources levels.

In the module, each unit is an Attachment to a tracker card (and vice versa). That allows the unit pieces to know how much of a given resource it has available. If a resource corresponding to a specific action (e.g., Supply for re-supplying other units) is not available, then the module does not allow the unit to perform the corresponding action.

And of course, if the Hit Point resource falls to zero, then the unit (and associated tracker and possibly any attached Joint Capabilities) are automatically eliminated.

It is all fairly automatised, though not fully because the various actions requires some user choices that are hard to capture in Vassal.

Yours,
Christian

Ok:
if i’m right understanding that vaste module, your way to count different cubes is to look in which column (x,y coordinates) they are placed on the mat. If I am right, i “can’t” follow this way (i mean: the real game doesn’t have any kind of restriction about what and where you can put on that card, and i would like to stay “close” to this behaviour).

If i were writing a program, I would loop thru all the cargo pieces looking for a specific property, and just adding that to my sum (in fact, my prototypes already has a marker like “OrderTokenValue” or “CommandTokenValue” that was create 'cause i knew i had to count them, sooner or later). Problem is I can’t loop.

So, pls tell me if this way seems viable:
When needed (and this is another whole story) the Mat piece sends a Global Key Command (only to all the Cargo pieces, if this is viable): the Cargo pieces with the relevant property as condition for the Trigger Action, increments a Property on the Mat piece by 1, effectively counting how many of them are on the Mat.
Then the Mat (which is the card, in the picture of the first post) updates the sum on the Attached Commander miniature.
Should I Attach also the Cargo tokens to the Card mat? will this give me some advantage, in terms of simplicity, other than performance?

Sure, what I do in Littoral Commander: Indo-Pacific may not be directly applicable to your situation. The point was really to illustrate how to get information from a tracker card to a game piece.

As I understand it, you have a number tokens (Cargo) placed on a “tracker” card (Mat). The tracker card receives a command, and then needs to figure out how many of a given token type is placed on it.

This seems like a case for Global Key Command where you select on CurrentMatBasicName being equal to the trackers BasicName - e.g.,

{CurrentMatBasicName==$BasicName$}

Remember to use $...$ property names for properties of the calling piece, and non-$...$ property names for possible target pieces.

The command send to the tokens could then increment some global - temporary - property, and then the calling piece may take that value and propagate that onto your game piece. E.g., in your tracker

  • TriggerTrait
    • Key: countTokens
    • Actions: [resetCounter, countTokens, takeCount, sendCount]
  • GlobalPropetyTrait
    • Property: TmpTokenCount
    • Commands:
      • key: resetCounter , type: Direct, expression: `{0}’
  • GlobalCommandTrait
    • Key: countTokens
    • Global key: countTokens
    • Filter: {CurrentMatBasicName==$BasicName$}
  • DynamicPropertyTrait
    • Property: TokenCount
    • Expression: {TmpTokenCount}
  • SetPiecePropertyTrait
    • Key: sendCount
    • Property: Count
    • Filter: Attached piece

and in your tokens

  • GlobalPropertyTrait
    • Property: TmpTokenCount
    • Commands:
      • key: countTokens, method Increment, expression: {1}
        (note, Increment only works with integer values)

and in your piece

  • DynamicPropertyTrait
    • Name: Count

BTW, you may be able to use CountMat:

{CountMap("TokenType","{CurrentMatBasicName==$BasicName$}")}

(not sure the second conditon is really needed - whether the count is by MatName - which may be shared over many mat instances - or by $BasicName$), instead of the trampoline to a global property.

Yours,
Christian

1 Like