Create account / Log in

restrict layer change

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

restrict layer change

Postby cemoreno » December 9th, 2019, 1:04 pm

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
cemoreno
 
Posts: 26
Joined: September 30th, 2010, 4:57 pm

Re: restrict layer change

Postby Brent Easton » December 10th, 2019, 2:52 am

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.
User avatar
Brent Easton
 
Posts: 2880
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: restrict layer change

Postby JoelCFC25 » December 10th, 2019, 2:09 pm

You can also use the Restrict Commands trait to hide or disable certain other keystrokes based on a property match expression.
JoelCFC25
 
Posts: 689
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: restrict layer change

Postby cemoreno » December 11th, 2019, 8:23 am

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
cemoreno
 
Posts: 26
Joined: September 30th, 2010, 4:57 pm

Re: restrict layer change

Postby cemoreno » December 11th, 2019, 8:38 am

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.
cemoreno
 
Posts: 26
Joined: September 30th, 2010, 4:57 pm

Re: restrict layer change

Postby cemoreno » December 11th, 2019, 9:39 am

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!
cemoreno
 
Posts: 26
Joined: September 30th, 2010, 4:57 pm

Re: restrict layer change

Postby JoelCFC25 » December 11th, 2019, 2:01 pm

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!
JoelCFC25
 
Posts: 689
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN


Return to Module Design

Who is online

Users browsing this forum: No registered users and 5 guests