Moved marking and layer priority

I have implemented a highlight feature using a layer image that surrounds a unit with a yellow ring. I also use the feature that marks the unit with a little flag „moved“ to the when it has been moved, but I have found that this flag is not visible when the unit is highlighted. That is, when the unit is selected, the Moved flag comes on top of the layer, but when not selected the Moved flag is below the highlighting layer image, and is not visible.

Is there a way of telling Vassal to always draw the Moved flag on top of the layer image?

I would expect simply swapping the order of the traits would fix it, but I could be wrong. Keep in mind that any traits in a prototype are inserted at the location of the prototype reference.

I have found it necessary to split prototypes into 2 in the past, so that another trait could be listed between the 2 parts of the original prototype.

2 Likes

It would be a good idea to post a link to your module (see also How to report problems). That will help us help you. If you cannot post your module, for whatever reason, then try to make a Minimale Working Example (MWE) that illustrates your problem.

See Reference manual - Trait Ordering and YOU (and also this post by @Brent_Easton). As Brent points out, it is absolutely crucial that module developers understand trait ordering.

One thing not mentioned in the reference manual or elsewhere, as far as I can tell, is how PrototypeTraits are handled. When VASSAL constructs a piece (or card, or whatever that has traits), it fully unpacks the traits. Suppose you have

  • Prototype A
    • BasicTrait - empty
    • Trait A1
    • Trait A2
  • Prototype B
    • BasicTrait - empty
    • Trait B1
    • Trait B2
  • Prototype A'
    • BasicTrait - empty
    • PrototypeTrait: name = A
    • Trait A'1
  • Piece a
    • BasicTrait - name = a
    • Trait a1
    • PrototypeTrait: name = A'
    • PrototypeTrait: name = B
    • Trait: a2

(Note that all elements that carries traits must have a BasicTrait as the last (top-most) element of the traits list).

When the piece a is constructed, it is fully expanded (except BasicTraits in prototypes) and becomes

  • Piece a (expanded)
    • BasicTrait name: a
    • Trait a1
    • Trait A1 (from prototype A via prototype A')
    • Trait A2 (from prototype A via prototype A')
    • Trait A'1 (from prototype A')
    • Trait B1 (from prototype B)
    • Trait B2 (from prototype B)
    • Trait a2

If @jrwatts suggestion is the answer to your problem, please remember to mark that as the solution. That will help others that may have a similar problem.

Yours,
Christian

1 Like

Thanks for the answers everybody. But there is a problem: the ability to „mark as moved“ belongs to the map and not the unit.

I’ll post screen dumps of the problem when I get home in two days from a trip I am on at the moment.

Not entirely true - see MarkMovedTrait. Essentially, the pieces need that trait to be marked as moved and the Map need to have the Mark pieces that move (if they possess the proper trait) option enabled. Thus, trait ordering is still important.

Yours,
Christian

1 Like

Thanks, I am sure this is the solution. I did go through the traits of the unit, but somehow I must have missed the MarkMovedTrait. Probably in some prototype that I overlooked.

Can’t wait to get home and test it! :ok_hand:

Yes, the solution was in the trait ordering. Thanks everybody for the prompt and detailed help!