restrict layer change

Hi, I have a piece with a Layer trait.

There are four layers, numbered 1 to 4, which are “always active” and “follow expression value”.

The piece has a Dynamic Property called “steps”, which is limited from 1 to 4.

Key Commands: Gain Step (CTRL +) and Lose Step (CTRL -)

My question: Can I restrict somehow the “Gain Step” command when the unit is at full strenght?

Thanks!
César

In the Dynamic Property properties box, if you tick the ‘Is Numeric’ checkbox, then you get the option to enter a minimum and a maximum value. Set the Minimum to 1, the maximum to 4 and leave the ‘Wrap?’ checkbox unchecked. Players will not be able to change the value of the property outside of the 1-4 range using the Gain Step and Lose Step commands.

Regards.

You can also use the Restrict Commands trait to hide or disable certain other keystrokes based on a property match expression.

Yes, but what I want to do is disallow “gain step” command when the block is at full strenght.

Piece has also a trait “report action” that triggers on CTRL+ or CTRL-

If I press “CTRL+”, of course the piece does not get a 5th step, it stays at 4. But nevertheless I get a report “Block gains one step”. It is a hidden block, it might not be that bad, so the opponent cannot know if it actually gains or not a step.

I would want to avoid this.

I know how to use Restrict Command to disable certain commands if a piece is in a certain map or zone of the map for example, but:
how should I go to disable commands if Piece Layer is #4 or #1?

Thanks again,
César

Bonus question, could I restrict “Gain Step” command if Piece Layer is “maximum”? there are blocks with a maximum of 1,3 and 4 steps, so “maximum” would be different for each one. If I somehow can write an expression

Restrict when properties match: “piece has maximum steps”

I could put this in the prototype for every block.

Thanks again.

Edit to answer my previous questions.

What I was looking for was LAYERNAME_Level.

Also, as I have blocks with different maximum number of steps I gave each of them a marker trait, MaxSteps=# (where # is the maximum number of steps for that block).

Then in prototype for all blocks, I restricted “gain Step” when Steps_Level=$MaxSteps$, and voilà!!

Thanks guys!

You got it–sorry, I should have been more complete in my response and linked to the documentation page for the Layer trait in the wiki!