Each Game Piece has its own Combat Dice

Modifying a module where there are varying game piece types eg, archer units, calvary units, infantry units.
Each unit type has a"battle value".
For example, an archer unit has a “battle value” of 4.
For archer to score a hit, it has to roll a 4 or less on a 12 sided dice.
A cavalry unit is more powerful having a “battle value” of 6.

Current module has a “Roll Combat Dice” button for resolving combat regardless of the unit attacking.

Instead of one common “Roll Combat Dice” button, I’d like each game piece to be it’s own roll combat dice button.
I’d like to be able to click on my Archer game piece, trigger a dice roll, and if dice roll is less than the battle value of whatever piece I clicked get a message eg, “Archer scores hit”, ect.

How would this be done?
Is it “Trigger Action” or an “Action Button” setting?
Where would I assign the “Battle values” for the piece?

figured out how to do what I want using
Random text generator and Global Hotkey

Random Text Generator
Name = Cavalry attacks
Button text = Attack w Cavalry
Tooltip text = Attack w Cavalry
Button icon = null
number of dice = 1
HotKey = f4
Report Format = $Result$
Faces 1-6 = “Cavalry Scores Hit!”
Face 7 -12 = “Cavalry Misses”

Calvary Game piece traits
Global Hotkey
Description = Cavalry attacks
Menu text = attak with Cavalry
Keyboard command = CTL C
Global Hotkey = f4

Drag Cavalry unit onto board. Right click and select “attack with Cavalry”
Report message will indicat “Calvary scores hit!” 50% of the time


Where do you tell it to roll a d12?

I assume the number of faces you assign IS the number of dice sides.
If I define 12 faces, then the dices has 12 sides.

Since my calvary has a 50% chance of hitting whenever it rolls a dice I could just have 2 faces,
“Cavalry scores a hit”
“Cavalry misses”