First of all Hello to all, I am new on the forum, I just try to make my first module for Vassal.
I have 2 questions,
1 Is there a way to make a prototype definition that makes that I draw a card from a deck, and the card gets automatic 6 properties with random numbers? I mean I draw a card from a deck with properties for example health, power etc. but the value is randomly generated when I draw the card.
2 How can I do it, that I roll a dice and the result is added to the card property what is selected?
You can’t do that simply by drawing a card but the card has be be placed somewhere and you can have it generate those values when it’s placed.
Let’s assume you’re placing the card in a Private Window. In the Map Windows properties for that private window, you’ll see an option “Key command to apply to all units ending movement on this map”. For this example, let say you set it to - GetValues
Let’s also assume you’re going to roll a D6 for each of the values and you already have a dice button named D6 in place with the Hotkey - RollD6
On each card, you would probably want to use a Dynamic Property trait for each of the 6 values you want. You would also want to include a key command to each like SetHealth or SetPower. This key command would “set value directly” to $D6_result$
In a Prototype, you can set up a Trigger Action with the following:
Trigger when properties match - StatsClick = 0 (I’ll explain this later)
Keyboard Command - GetValues
This will cause the Trigger Action to trigger when the card is placed in the Private Window.
Under “Perform These Keystrokes” you can set up a list of things you want to happen. Probably something like
Above the Trigger Action in the trait list, you would put a Global Hotkey with the following:
Keyboard Command - GetD6Roll
Global Hotkey - RollD6
With this setup, the Trigger Action would roll a D6, set the health, roll a D6, set the power, etc.
You’ll probably also want to include another Dynamic Property on each card called something like - StatsClick - with the key commands:
SetStatsClick - set value directly to 1
ResetStatsClick - set value directly to 0
The last command you want to run in the Trigger Action is - SetStatsClick. This will set the dynamic property for the StatsClick to 1. You’ll notice that the trigger action will only trigger if StatsClick = 0. By setting it to 1 after all your values are set, this will prevent the card from generating a new set of stats every time you move it.