Newbie question about layers and traits

I’m trying to create my first Vassal module and am struggling with layers and traits. Can I use layers to assign/unassign traits to a piece? For example, if I have a double-sided counter that is defined as “ready” on one side (layer 1), and “spent” on the other side (layer 2), can I make some Actions only available on based on which layer is active? For instance I want a Rally action (Crtl-R) that should only be available if the unit is spent (layer 2) or a Fire action (Ctrl-F) that should only be available if the unit is ready (layer 1). Can traits be added/removed based on the layer or is some other method preferable?

Sure, you can easily do what you intend. I usually do it with just a single Layer trait that has 2 levels, but you can just as easily do it with the Ready/Spent images separated into 2 Layers.

In coordination with your Layer traits, you’ll need a pair of Restrict Command traits. One Restrict Command will be for the Ctrl-R…make the restriction “Hide” and follow the guidelines at the bottom of this wiki page: vassalengine.org/wiki/Layer

I don’t know what name you chose for your Layer traits, but let’s pretend the name of the “Ready” side layer was in fact Ready. In the restriction for the Rally action, you’d want to put: Ready_Active = true. The converse–restricting the Fire action–would be Spent_Active = true. Replace the Layer names as needed.