Random layer on placement

Is it possible to place a random layer on placement?

So that one of the levels is random selected on placement.

By placement if you mean when pulled from palette and placed on a map then yes.

Use the key command to apply on piece that moves (in map properties). Give the pieces a DP and set their layers to allow randomization with a key command. Give the pieces a trigger that will change value of DP (use true/false type setup on the DP) and execute the randomize layer key. The trigger key command should match the map move applied key command and contain a filter that verifies the value of the DP (true/false). This will prevent the randomization trigger from firing again any time piece moves if the DP value does not match

Dark Scipio messages@forums.vassalengine.org wrote:

Post generated using Mail2Forum (mail2forum.com)

Demo Mod attached inside zip.

Grab piece out of the palette and place on map (as many as you like) Note that it randomizes the layer, but subsequent map movement on the board does not cause it to change

I am very impressed by your kindness. Thank you very very much.

Sorry to revive the thread, but I have the same issue in a module I’m trying to implement in vassal 3.2.8

I downloaded the module Tim M posted and tried to recreate an item with the same properties, layers etc as the piece in the downloaded module. Unfortunately, even though Tim’s module works, when I try to add a new item to do a similar thing (including all the properties and such) it does not work.

Trying the random keypress manually, works but i would like to make an auto randomizer. Is there something I do wrong, or is it due to vassal version. any ideas? I wish i could copy items from module to module.

Did you set up your map properties correctly also? Having the piece right is not enough

I even tried adding a new item in the module from RandomLayerPlacementDemo.zip. So i guess the map options are no problem since they were configured. Unless there some steps, to relate new pieces with the map options.
I tried checking the map tree one item at the time but nothing apart from the default seems to be there. Still new to the hole trigger thing.

As a side note, if i edit the original demo piece it still works, but new pieces do not.

Looks like a old vs new property expression problem. Do everything exactly as the demo is setup except in your piece’s trigger action trait replace the expression RandomValue = false with {RandomValue==“false”}

Works for me after doing that on new pieces

I used the expression builder before which might be problematic. I entered the expression manually and it worked.

Thank you for the help!