Sorry but I haven’t found this answered anywhere; I guess it is a simple question:
I would like to have pieces on the map board that would act like a piece on a piece pallete: i.e. if I would click on it and drag, an immediate clone is created?
If it is possible it would avoid the need to put a trait clone in the piece, then rigt-click on it, then choose “clone”, then drag the new piece from above the older one, or (B) avoid the need to go the Game piece pallete in the menu. At table top is very easy but at Vassal I don’t know if it’s possible…
You can have a palette appear in a separate window but assuming you must have a piece on the board that can act exactly like a piece in a pallette (as I understand your request), here is the bones of a method:
Establish your palette piece on the board (typically through an At Start Stack).
Your Map will need a Movement Key Command configured. Let’s call that mapMove.
On your piece, add a Trigger Action trait, that responds to mapMove
The actions performed by the mapMove Trigger should be:
i) Clone
ii) Send to Location (to OldX, OldY)
Let us know if that works for you. Possibly two pieces will return to the original (Palette”) location. In which case we will need to restrict the Send to Location to limit it to just one piece.
I’m expecting that dragging the piece will create a new piece at the drop location whilst the original piece appears to remain in your palette area.
Property match: {CloneID!="" && CloneId!=UniqueID}
(Each piece has a unique UniqueID - duh - and CloneID is set to the UniqueID of the parent piece by the Clone trait)
Key commands: [cloneMe]
Hence, when you click the “mother” piece, a clone will be created, and that clone will get the a new uniqueUniqueID, and will have the property CloneID set to the UniqueID of the mother piece. The RestrictCommads trait disables the cloneMe command (and hence the Clone trait) for all clones since their UniqueID does not match their CloneID.
This method is slightly different than @marktb1961 's suggestion, in that a user will simply click the mother piece, rather than dragging it somewhere.
Another option is to make an entirely different mother piece - probably one that cannot be moved - which, when the user clicks it, uses a Place Marker trait to place a copy of the the actual piece on top of it. The mother piece can share the base image of the actual piece, of course, but is otherwise not very feature rich.
Even at Christmas Day I’ve posed a question and received not only one but three solutions for my problem. It is really amazing the way you are so efficient!
In the end I went by Christians’ suggestion of using a place marker trait. Not only I am already used to this trait but also I am not really that at ease with expressions and properties.
The advantage of not going to the pallete menu is that I want to play this game with people who are not very familiar with vassal, and I find it more intuitive to get your new piece right from the map instead of navigating through tabbed panels to chose a specific piece among dozens of others.
Merry Christmas to you all and congratulations for your fine work.
Yours, José Miguel
( I think I will start using your advices to solve, not only Vassal things, but also to decide about my financial investments and about my love life ).
First, thank you for the kind words and votes of confidence - perhaps a bit unwarranted - especially when it comes to financial advice and affairs of the heart
If you do this, then i think the mother piece should have the Does not stack trait with
Select piece: never - should not prevent the Action Button from being efficiated, but ensures that the mother piece is not selected together with the spawned pieces.
Band-Select piece: never - as above
Move Piece: never - the mother piece stays where you placed it on the board, probably using an At-Start Stack.
Piece can stack: false - so that it doesn’t get mangled up in a stack with the spawned pieces.
Furthermore, you should probably place the mother piece on a separate Game Piece Layer by giving it a Marker with
Regarding the Place Marker trait: It is most efficient to define the “marker” piece like you would normally do, and then simply reference that piece from the Place Marker trait. Do not define the piece in the Place Marker trait directly.
Also, remember that you can hide the Game Piece Palette from the user. You can still have it in the module and use it as a repository of pieces, but the user will not see it. Will make sense especially if you do book-keeping in the mother pieces.