How to make a Piece invisible

Hi all;
I have been trying to make a piece visible ONLY while a particular layer on another piece is being displayed. I tried a Trigger Action with a Global Key Command on the Piece with the Layer that sends to the Invisible trait on the Piece I want to hide. The problem I am having is that the Hidden Trait alternates Hide/Show when it is activated so sometimes the Piece is hidden and sometimes it is not. The “Loop” feature on the Trigger Action might be useful except I can’t figure it out…or maybe there is another way.

I worked out a way to do this by using 2 Triggers and 2 Global Key Commands on the Piece with the Layer then added a Layer to the other piece which hides it. If there is a better, more advanced way I am all ears.


The invisible trait has a property InvisibleToOthers that you should be able to use to avoid the unnecessary toggling.

My limited understanding is that InvisibleToOthers Property is enabled when the Piece is invisible to other players. I don’t know how to manipulate it other than the options available in the Trait’s window - (there is much I don’t know about Vassal and probably never will). This Trait just toggles on/off when it is activated so if I set it to toggle off when one piece is being displayed, it will come on again when another is displayed. When the Piece that I want this to be visible for is displayed, it may be either visible or invisible depending on where it is ready to toggle next. This makes the invisible Trait useless for what I want. It seems to only work well when activated manually.

Another idea I have is to make the Piece I want to hide part of a one card deck. Locate the deck on a discrete part of the map with a Mask that will hide it. Have a Trigger use Send To Location and “Deal” the piece to where I want it when called for, then, in all other cases it will return to deck. My earlier idea above using a Layer works but it increases the number of GKC I have in the game. I am not entirely happy with it.

[EDIT] What I think the Invisible Trait needs is one command for visible and another for invisible.

Thanks for your response;

My second option using a one-card Deck works better so I will go with that I guess.

To the more experienced Vassal module authors: can a global property be used in the Levels follow expression value: of the Layer trait rather than a dynamic property?

If so, how about using a global property for the related pieces?

I suggest the following:

I have been trying to make a piece (let’s call this piece A) visible ONLY while a particular layer on another piece (let’s call this piece B) is being displayed.

So piece A can have two layers, one blank and the other with its image. Make a global property that piece B will use to control whether its particular layer is “on” (visible) or “off” (invisible) by using the Levels follow expression value: (, and piece A will use to set whether or not it is visible by Levels follow expression value:. Then when the global property is set to display the particular layer on piece B, piece A will be visible, and when the property is set to not display that layer, piece A will be invisible.

1 Like

A piece knows if it is invisible or not based on the state of its InvisibleToOthers property. When you send it a global key command to make it invisible, you want it to do the command only if it is visible. If it’s already invisible, you want it to skip the command.

To accomplish this, you must add “InvisibleToOthers == false” to the global key command’s conditions. (In the GKC’s “additional matching expression” would work.)

1 Like

Hi and thank you for taking the time to respond. I tried similar to this with a Dynamic Property before and it didn’t work but as mentioned before there is much I still don’t know and the learning curve for me is steep. My bad I did not mention it earlier but there is more than one layer that for which, want this Piece hidden (there are actually 4) and while I could get this to function correctly when swapping from any of the 4 Pieces to the one I wanted this to show for, if I alternated between one of the other 4 it would toggle show/hide. When I am in front of my PC again I will try out these suggestions and let you know what happens. It is difficult to get my head around Global Properties, what they can do, why they can do it and how to use it (and many other things), but I will persevere. So far I have been able to get this module to do what I want one way or the other. Thanks again to you both for your help. :+1:


1 Like

After many hours of trying various combinations of expressions, the best I could come up with was that the Piece would show when required but remained there when changing to the other layers. Here are the relevant settings (I think);

When I changed the Expression in the GKC from true to InvisibleToOthers == false, it didn’t work at all.

Is Reserve Ammo a piece or a prototype? It looks like you gave a screenshot of a prototype definition (as there is no Basic Piece trait), but your GKC is looking for a piece named Reserve Ammo

Hello Jonathan;
Reserve Ammo is what I called the Protype for that Piece of the same name

Might that be causing problems? I didn’t think it would because the Prototype is not a Property…or is it? I dunno.


Expressions, Expressions I hate them. If I want a layer to set off a Trigger when it is displayed but not if it is already on should this work? {MissionChart_Level == 5 && MissionChart_Active != 5}
It isn’t. I waste hours on these things so I try to avoid them if possible. I am using a menu list for the Layers in the game and if Layer 5 is selected when it already is, the Trigger will activate again and do the complete opposite to what I want. The time wasted on expression is seriously killing my interest in Vassal. I have just about had enough. :frowning_face:

Typically in these situations it’s useful if people can examine the module, as the cause of the problem could be something you’ve not described.

I could upload the Module somewhere but where to go from there? How would I direct you to that part of the module where I am having this problem?

Typically I have found a way to not use expressions. By removing the Loop ability for the layer and using the “Increase Level” and “Reset” options only, I can now use 2 separate commands to switch show/hide and don’t need to filter with an expression for the Trigger at all.

I have still wasted my time though because the Ammunition Counter…


still shows. It is a Text Label trait that adjusts itself down as I top up Ammo for the Turrets. There does not appear to be an option to hide this Trait and no instruction how to do this if possible. The only option now is to have to create a white layer that will cover both and hide them or just go with the Send To Location with a Mask which is also bodgy but at least it works.

Rather than waste the time of other people and myself, I consider this thread closed. My idea to create a one Card Deck may not be ideal but it works. The deck contains the Piece I want to show/hide and a mask so that it can’t be seen. When called for, it will appear in the place I want it and when not required it hides in an unused corner of the Mapboard underneath a Mask so it is invisible. No expressions needed which is good because they suck.


You’re probably quite close with this, but just need to reflect on the Layer reference and look at what properties you can access and what they return.

MissionChart_Active != 5 won’t work because the _Active property of a Layer returns only true or false. So if you want a Trigger to only work if this layer is not active, it’d be MissionChart_Active == "false"

1 Like

Hello Joel thank you for your reply;

I created this Expression using the builder and followed all the arrows, it also got the Green tick but it still doesn’t work which is one the many things I find frustrating about expression in Vassal. Trying to make an expression work takes me an entire frustrating day of trial and error which is often fruitless.

There were 5 levels in that layer and I wanted the trigger to work when that particular level (5) was not active. Here I found what you are referring to and it seems this particular expression applies to the Layer name (MissionChart) and not the Level so this not the expression I wanted at all. It looks like I have been getting Layers and Levels confused with each other. Perhaps there isn’t an expression for what I wanted and unfortunately, I can’t reproduce this because that Layer does not exist now as I replaced it with my one card Deck solution mentioned above. Today I was supposed to be working on this, another Trigger with an expression but I have had enough of Vassal for now, maybe next weekend. I am sorry to have wasted your time Joel but your effort is appreciated.


The green arrow is only indicative of correct formatting/syntax–e.g., all parentheses are matched, quotes are closed, things like that. It does not mean the expression will return the intended result.

1 Like

Your previous answer may have helped me with these expressions because it made me realise that I was confusing levels with Layers thanks again :+1: