Calculating Value of Cards and show in Hand

I’m trying to figure out if there is a way to sum up the value of a marker property of all the cards in player’s hand and show that in the same window.

Create a global property. Let’s call is G_Value

Give it an initial value of 0 and make it numeric.

Next, in the window you would like to sum up the values (player hand?), create an At-Start Stack. Give it the following traits:

Trigger Action- Description : Whatever you want to name it.
Trigger When: Leave blank I will explain this below.
Menu Command: If you want a right click option, put in what you’d like it to say. I leave this blank
Keyboard Command: Ctrl X
Perform These Keystrokes: Ctrl 1
For the above,
Have the keyboard command be the same as the map key command. You can edit map key command by clicking on the player hand, and looking at the selection, “Key Command To Apply To All Units Ending On This Map”
For learning purposes, let’s say you have that set as Ctrl X.

Set Global Property:
Description: Again, whatever you’d like.
Global Property Name: Input the G_Value name that you created just before. You will be taking this constant property, and increasing it to what you need.
Minimum Value: Set this to the same as how you have it in the property already. Might be -10 or 0 or something. Same with maximum. That is most likely at 100.

Check the IS NUMERIC box.
Then add the following key commands:

Menu Command: Again, the right click words. I try not to use them as it clutters things.
Key Command: CTRL 1. This is the key that will be triggered by the Trigger Action trait. So essentially, the trigger is getting hit by the map standard key, and then hitting this Set Global Property trait.
Type: Increment numeric value.
Increment by: Use your marker name here. If you have a marker on the cards called value let’s say, this space would say $value$ . Use the dollar signs, as it makes it numeric. The dollar signs essentially say THIS IS THE VALUE of marker “value”

Text Label: Here is where you will be displaying your new card sum.
Description: Whatever you’d like to call it.
Text: $G_Value$ . Feel free to put words before or after that <–. That essentially is calling the VALUE (remember, dollar sign is reporting the value of G_value property) . So maybe you want to write, Combat Level = $G_value$ , or something like that.
All the other properties here you can mess around with yourself.

Does Not Stack: Select Peice: Normally.
Move Piece: Never.
This will stop you from being able to move the button around. If you would like it to slide around, do not put this trait.

NOW, THERE ARE TWO VERY CRITICAL THINGS YOU MUST REALIZE.

  1. The order of the traits I just listed, goes from bottom to top, So in your list, the top trait would be Does not stack, and the last one would be the Trigger Action. That is because the top most trait is the boss, it can see everything else in process, while the bottom traits are more blinded and can only see what is below them.

  2. Your TRIGGER ACTION WILL RECORD EVERY POINT AND MOVEMENT. This is because you did not set up a gate or requirement to restrict it from working sometimes. As of now, every single time you move a card, it will add that to the total. In order to stop this, you need to set up provisions. To do this, go back into the Trigger Action Trait

Mine for comparison: Trigger When: {CurrentMap == GetProperty(“playerSide”) + " Hand" && LocationName != Screened && (OldLocationName ==Screened || OldMap == “Main Map”)}

In this scenario, each player has a Map Hand called 1P Hand, 2P Hand, 3P Hand, and so on. So, the first thing I am saying in the following requirement, is that the current Map that this is happening on changes depending on who is controlling it. So, if you had something like 1P Hand, that part would be the same. If you had 1P Barracks for example, replace the Hand part with Barracks. Next, I have the requirement that the LocationName cannot be a special zone called Screened. I created this zone as a private part of the hand in which cards would always be masked. The points begin to total when the cards are inside the playerhand Map, but not in that specific zone called Screened. The last part is very important for you. OldLocationName is what I used in order to stop the card value from adding up non stop. It says (essentially), "if this card was just in this map right before you moved it here, (or zone if you create one) then it will or will not trigger depending on what you want. SO for me, if a player moved a card from screened on to the equip zone (all of this is in his hand, remember I have special zones for masking purposes) then it would register. However, if i tried moving it back and fourth INSIDE THE SAME ZONE, it would not register, because the old location was not screened. In order to offer myself more flexibility, I said that it could have moved from my Screened zone, OR from the main map. This way if a player moves it from the main map OR screened, it would register, but would stop adding points from double movements. Here it is again for review:

Trigger When: {CurrentMap == GetProperty(“playerSide”) + " Hand" && LocationName != Screened && (OldLocationName ==Screened || OldMap == “Main Map”)}

Now, that should get you started. However, there is one final thing to note. You are going to have to get this all to apply to the cards somehow. You may need to split up these steps, try adding them to a prototype, and putting them onto the cards or pieces or whatever you are using, individually. Or you can add it to another prototype that you already have, if you do.

Using all of these steps I have told you should help. I have only been at this for a few weeks, but I understand how frustrating it is sitting on a problem, unable to find the applicable solution. You have stolen me away from “Tales Of Xillia” for about 30 minutes so I could write this post, (the game is SICK by the way, definitely recommend it) but hopefully this may help someone with further questions in the future. If you have any other questions, feel free to ask. I probably won’t be of much help, but I can try my best. For anyone else reading, I am aware my syntax is probably flawed, but I am still in the infant stages of this as well. So, reserve your judgement hahaha.

Good Luck

M

Thank you very much for you reply, I will try that.

I have a similar problem with a mod I’m working on, cjmeate, and I tried applying this method without success.

Here’s what I’ve got: my mod is a two-player miniature wargame. Units are placed on one of several maps each with an associated irregular grid. When opposing forces come into contact with one another, they are moved to a special “battle board” where combat is resolved via a combat results table. Each unit has a Strength and a Maneuver value associated with it; I’ve added these as Marker traits to the tokens (Property Name = Strength, Maneuver; Property Value (for example) = 5, -2). What I ultimately want to do is have the mod tally up the Strength and Maneuver scores for all of a player’s tokens on the boards separately, then from those values display the ratio of the Strength scores and the difference in the Maneuver scores between the two players (and if I could make it change the display based on which player is the attacker, that’d be awesome). Right now, I’m just working on the “adding stuff up” bit.

So I created a numeric Global Property for the four scores I want to to tally (P1 Strength, P1 Maneuver, P2 Strength, P2 Maneuver) and initialized them at zero. I then created an At-Start Stack on the battle board and Added a Single Piece to it (I was supposed to do that, right? The properties you mention above don’t appear to be available for an At-Start Stack but they would be available to a Single Piece). I set the “Key Command To Apply To All Units Ending On This Map” on the battle board to Ctrl-X and added the properties as you describe them above.

I did leave the “Trigger When” command blank…occurs to me this morning that this could be why I couldn’t get anything to work last night.

The cjmeate idea was very interesting, so I decided to try it in my Vassal module of Congress of Vienna; I have tried applying this method (cjmeate idea) without success.

Always the G_Value is 0. I have tried without the “Trigger when” restriction to try to observe how the G_Value global property grew and grew when the cards were moved inside a player’s hand, but it was always at value 0

I have the following doubts now;

  1. The Global Property is placed in the Player Hand or in the main node? (I have proved in both sites without success)

2)In the Set Global Property trait "Locate Property starting in the: ******? (what is the correct option), I have chosen CurrentZone/ CurrentMap/ Module

  1. cjmeate said “you are going to have to get this all to apply to the cards somehow”, What? Set Global Property? Trigger Action?..

Thanks

Frank Esparrago

This is a fragment of a test module that I made to demonstrate something else, but it demonstrates a good way to implement piece tracking, and has been modified to track marker values instead of pieces.

You’ll see 13 zones, 12 of them occupied with pieces of values 2, 3, or 12, and one large shaded area representing a “hand”. If you drag any of those pieces between any of the zones, the value of the piece will be added to new zone and subtracted from the previous zone.

There are lots of other ways to achieve the same result, but this module demonstrates a method that I have found to be flexible and effective in all situations.

I’m happy to field questions, but please have a good look in the editor to see how it is done first.

Not exactly what you ask for, as you want to add the value on all your cards, but this can be usefull one day :

  • All my cards all have a cost, shown as Marker - cost : number
  • Some cards have tags, which could lead to discounts: Marker - energyTag : 1 Marker - spaceTag : number (so this card can show 1 EnergyTag and 2 spaceTag)
  • A Player may have a discount for EnergyTags, and can also pay ScienceTagged cards with an another money

When you play the card, you have to pay for it. The price is calculated based on the cost, the global discount, the specific discounts, and the use of a specific money, if the player decides to spend that resource. By the way, the Titanium money, for spaceTagged cards has a value that can change … it may be worth 3M$ or more … 4 or 5 !

So, a player has Global Properties defined (in the module) for : global discount, spacetags, standardprojects, energytags…
But a player also have a GP to define the value of Titanium units, as well as Steel units (the 2 moneys you can spend for some cards)

The cards (in a prototype) have a Calculated Property for ALL the possible discounts : discountSpace, discountEvent, discountVenus … based on tags, and also a calculated property for the discountcost And the globaldiscount.
If a player prepays with Steel/Titanium, it’s considered as a discount for the card…

Example:
Calculated Property - discountAllCards
Expression: GetProperty($PlayerSide$+"_Discount_AllCardsGP")

Calculated Property - discountEnergy
Expression: If(energyTag == 0,0,GetProperty($PlayerSide$+"_Discount_EnergyGP"))

Calculated Property - discountcost
Expression: If(cost+globaldiscount < 0,0,cost+globaldiscount)

Calculated Property - globaldiscount
Expression: discountAllCards+discountScientific +discountBuilding+discountMicrobe+discountAnimal+discountJovian +discountEnergy+discountPlant+discountSpace +discountVenus+discountCloud+discountEvent+discountEarth

Calculated Property - discountcostwithprepaid
Expression: If(discountcost+steelDiscount+titanDiscount<0,0,discountcost+steelDiscount+titanDiscount)

Calculated Property - titanDiscount
Expression: If(spaceTag == 0,0,-maxprePaidTitan*GetProperty($PlayerSide$+"_Moneys_TitanGP"))

Now you can imagine how the maxprePaidTitan is limited by the real balance for the player. And also that’s where we check the change rate for titanium for that player with the _Moneys_TitanGP

For the sake of our minds, when a card is played, the control window reports:
$PlayerName$/$PlayerSide$ played $PieceName$ (price: $cost$ ; discount: $globaldiscount$ ; cost after discount: $discountcost$). $PlayerSide$ paid $discountcostwithprepaid$ M€ (plus $maxprePaidSteel$ steel and $maxprePaidTitan$ titanium).

Does that help ?

By the way … your request is much easier than I thought :

Assuming each card has a marker called cost, with a numeric value, you can set the Game Piece Inventory with:
Label for folders: $CurrentMap$ : $sum_Cardcount$ card(s) , total Costs: $sum_cost$

The $sum_$ function sums up the variable automatically.
It’s up to you to define how the Inventory will find the pieces based on their types and maps. I use this :
Show only pieces matching these properties: {type==“card” && map==“hand”}