Is there a way to trigger an action by selecting a piece?

howdy! :slight_smile:

Is there a way to trigger an action by selecting (clicking on) a piece?

Look at the Action Button trait.

True i totally forgot.
I’d rather have the trigger only active when the unit is selected though. And deactivate once it isn’t selected anymore. Otherwise the player always has to click the unit a second time to deactivate the trigger action.

Isn’t there a basic property in each piece called selected with the value true and false or something? Maybe i could build a trigger on that?

I’d rather have the trigger only active when the unit is selected though. And deactivate once it isn’t selected anymore. Otherwise the player always has to click the unit a second time to deactivate the trigger action.

Your terminology doesn’t make sense. Trigger Actions don’t get ‘deactivated’. Perhaps if you describe what you want to achieve without assuming a solution I can better advise as I need a picture of what you want to do.

You mean using the Vassal Property Selected in the expression Selected == “true” All the Vassal Properties you can use (including “Selected” are in this list here.

Right, so i want to have an Area of Effect that is shown when a piece is selected, but that goes away automatically when i click somewhere else (when the piece is not selected anymore).

Ok, Now I know what you want! Yes, there is a way. Almost.

In the Area of Effect, uncheck the ‘Fixed Radius’ option and in the Radius Marker field enter the name of a Calculated Property in the piece (say Range).

Then create the Calculated Property name Range with the Expression

Selected ? 2 : 0

When selected, the piece will have an Area of Effect of 2, when unselected it will have an Area of Effect of 0.

The Almost is because when an AoE is showing, a range of 0 means the current hex is highlighted, so it doesn’t quite go away.

Perhaps it would make sense that a -ve Range turns the Area display off altogether? That would be a simple change.

You can turn an AoE on and off using Key Commands, but this becomes vastly more complex (if at all possible) to achieve what you want.

1 Like

Ha! Perfect, thank you! :ok_hand: