Images filenames as Property?

In my module, i’d like to show the Lifepoints (LP) of units by showing a miniature for each LP
just like the Memoir44 boardgame do:

Seems to me that this requires one Layer trait for each LP, each of them with a different offset and a different LP value for showing/hiding the miniature.

My problem is that i have about 40 different types of units, so i need to create the same exact 4 layers for each type, only to use a different miniature image.
If i could set the image filename inside the Layer … layers as a Property, I will be already done.
I’ve also tryed to “trick” vassal by using a Text Label with this string: <html><img src="$UnitImage$.png"></html>, but to render it there’s need to be some text, and the size of the picture is not taken in account, so i have to set the font size to something like 250 and it just messes up the whole piece.

There’s any way i can build just one prototype that places and then set the image needed inside the piece?

Maybe I did not understand your request but… Why don’t you simply use one layer, controlled by the LP dynamic property, with 4 levels, each one with one image showing from 1 to 4 miniatures ?

You will still need to copy paste this layer 40 times with 4 different images but that’s already less than copy 40 times 4 layers.

'cause this will move the hassle from “create 40x4 different Layers, using 40 images” to “Create 40 Layers, and 40x4 different images” :slightly_smiling_face:

I think that. in term of maintenance, if i have to change something and modify/recreate 160 images is worse than 160 layers (as, if i’m desperate, I can always edit the xml file with some regex replacement)

Ok I see. I was minimising the Vassal work but you also have the image editing. You could try ChatGPT or a similar tool to produce the 40x4 different images from the 40 original ones. That’s what I’m doing nowadays for repetitive images work. https://imagemagick.org/ could also be a solution (I used it before).