# restrict layer change

**URL:** <https://forum.vassalengine.org/t/restrict-layer-change/10135>\
**Category:** Module Design\
**Created:** [December 9, 2019, 1:04pm UTC](https://forum.vassalengine.org/t/restrict-layer-change/10135 "2019-12-09T13:04:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CesarM](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@CesarM](https://forum.vassalengine.org/u/CesarM)\
**Post date:** [December 9, 2019, 1:04pm UTC](https://forum.vassalengine.org/t/restrict-layer-change/10135/1 "2019-12-09T13:04:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Brent\_Easton](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/brent_easton/32/10_2.png) [@Brent\_Easton](https://forum.vassalengine.org/u/Brent_Easton)\
**Post date:** [December 10, 2019, 2:52am UTC](https://forum.vassalengine.org/t/restrict-layer-change/10135/2 "2019-12-10T02:52:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JoelCFC25](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/joelcfc25/32/2687_2.png) [@JoelCFC25](https://forum.vassalengine.org/u/JoelCFC25)\
**Post date:** [December 10, 2019, 2:09pm UTC](https://forum.vassalengine.org/t/restrict-layer-change/10135/3 "2019-12-10T14:09:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CesarM](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@CesarM](https://forum.vassalengine.org/u/CesarM)\
**Post date:** [December 11, 2019, 8:23am UTC](https://forum.vassalengine.org/t/restrict-layer-change/10135/4 "2019-12-11T08:23:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CesarM](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@CesarM](https://forum.vassalengine.org/u/CesarM)\
**Post date:** [December 11, 2019, 8:38am UTC](https://forum.vassalengine.org/t/restrict-layer-change/10135/5 "2019-12-11T08:38:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![CesarM](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@CesarM](https://forum.vassalengine.org/u/CesarM)\
**Post date:** [December 11, 2019, 9:39am UTC](https://forum.vassalengine.org/t/restrict-layer-change/10135/6 "2019-12-11T09:39:23Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![JoelCFC25](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/joelcfc25/32/2687_2.png) [@JoelCFC25](https://forum.vassalengine.org/u/JoelCFC25)\
**Post date:** [December 11, 2019, 2:01pm UTC](https://forum.vassalengine.org/t/restrict-layer-change/10135/7 "2019-12-11T14:01:11Z")

</div>

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!
