Questions about placing and removing markers, and possibly doing so in prototypes?

I’ve figured out how to place a marker using the marker trait. There are two things I haven’t yet figured out:

  1. Can I have the marker appear on a specific part of the piece it is placed on? Currently it appears in the lower left corner of the square piece, I’d like it in the upper left. I’ve read some instructions about how to do that but those instructions don’t jibe with what I’m seeing on the screen.

  2. (And more important) How can I make the marker easy to remove?

For context, this is a wargame where the units take 3 hits to destroy. So hit number one is a disorganized marker. That marker needs to stay on the piece when it flips. Then, if the unit rebuilds, the first thing is the marker goes, then the piece flips back to it’s original side. I’ve figured out how to add the marker using the trait, and then use layers for the two sides of the unit counter. What I haven’t figured out it how to easily remove the marker (ideally using a key command / right click menu setup).

I’m also hoping that the marker trait can be part of the prototype so I don’t have to manually create that with every unit.

Thanks,

Chris

If you are employing the Place Marker trait, you are creating a wholly separate piece that stacks with the piece that places it. That’s why their bottom left corners are aligning–it’s the default nature of stacking. Designing what are effectively unit status overlays as completely separate pieces is likely to cause a bunch of headaches going forward when moving pieces around, having to expand a stack to eliminate the marker, giving a muddled mouseover stack view, etc.

Having status markers/overlays implemented as piece Layers is likely to be easier. They have a wealth of configuration options and can be positioned however you like relative to the base piece using offsets. This sort of thing is ideal for putting in a Prototype, where the marker/overlay is going to look the same and be in the same position no matter what the base piece is.

1 Like

Your use case sounds very much like Battle of the Bulge (Smithsonian Edition). There, a unit can have up to 4 steps. In that module, I implement this by

  • Prototype: Allied prototype
    • LayerTrait:
      • images: ["","step-loss.png"]
      • Follow: true
      • Expression: {Math.min(Current%2)+1,Steps}
    • TriggerTrait:
      • Key: Ctrl-F
      • Command: Step loss
      • Actions: [stepOrElim]
    • TriggerTrait:
      • Key: stepOrElim
      • Actions: [eliminateKey]
      • Property: {Current==1}
    • TriggerTrait:
      • Key: stepOrElim
      • Actions: [decrCurrent]
      • Property: {Current>1}

Note how the two stepOrElim triggers work as an if ... else ...: If Current is one, then another step-loss eliminates the unit. Otherwise, decrement Current by one.

A unit will then have

  • us 2 ad
    • LayerTrait:
      • images: [us_2_ad.png, us_2_ad_flipped.png]
      • Property: Step
      • Follow: true
      • Expression: {(Steps/2)-(Current+1)/2+1}
    • DynamicPropertyTrait:
      • Action:
        • Key: decrCurrent
        • Type: Increment
        • Expression: {-1}
      • Property: Current
    • MarkTrait:
      • Name: Steps
      • Value: 4
    • MarkTrait:
      • Name: FullCF
      • Value: 7
    • MarkTrait
      • Name: ReducedCF
      • Value: 3
    • CalculatedPropertyTrait
      • Name: CF
      • Expression: {Step==2?ReducedCF:FullCF}
    • PrototypeTrait:
      • Name: Allied prototype

Thus, when the user issues the Step loss command (Ctrl-F), then

  • Check to see if Current==1
    • If so, issue the eliminateKey command to eliminate the unit
    • If not, issue the decrCurrent command so that Current = Current - 1
    • That is noticed the the LayerTrait in the prototype (because of Follow=true).
      • If Current is odd (Current%2 evaluates to 1), then the second image of that layer will be shown.
      • If Current is even (Current%2 evaluates to 1), then the first image of the layer (which is empty) is shown
    • The LayerTrait in the counter also notices the new value of Current
      • Show the image number selected by half the number of steps (Steps/2 - integer division) minus half the current level, rounded up ((Current+1)/2), plus 1. For example, with Steps=4
        • Current=4, (Steps/2) - (Current+1)/2 + 1= 2 - 2 + 1 = 1
        • Current=3, (Steps/2) - (Current+1)/2 + 1= 2 - 2 + 1 = 1
        • Current=2, (Steps/2) - (Current+1)/2 + 1= 2 - 1 + 1 = 2
        • Current=1, (Steps/2) - (Current+1)/2 + 1= 2 - 1 + 1 = 2
      • Also, if we are to evaluate the unit’s CF property, we will get 7 (FullCF value) if Current is either 4 or 3, and 3 (ReducedCF) when Current is either 2 or 1.

You can get the above module from the library or look at the source code at GitLab.

Note that the module does not define a way to re-gain lost steps. But to do that would be rather simple. Simply add an Action to the DynamicPropertyTrait that increments the Current property up to and including the Steps property, and the rest of the code will react appropriately to it.

Hope that helped.

Yours,
Christian

1 Like

Youguys are the best. I’ve finally realized I have to print out the developers guide and try to read up on the more complex stuff, but this is tremendously helpful to get started. Thanks again.