Pieces initially placed rotated

How can I position a starter stack with rotated pieces, without an already rotated image?

I can offer the option to rotate the piece image, but I’m having trouble positioning them initially already rotated.

Any suggestions?

It’s a bit of a kludge, but you can add a Startup Global Key Command to send the command to rotate the piece to the correct facing as soon as the game starts (you’ll want to use the option to trigger “At Start Of Every Fresh Game Only”).

There’s a number of ways you can do this, depending a little on your setup.

  1. As @jrwatts suggested:

    1. Define a Startup Global Key Command setting When to apply to an appropriate value. The Global key command could be the named command rotateToStart
    2. Define a Trigger Action in a relevant prototype, with
      • Key command: rotateToStart
      • Perform these keys: rotate
      • Loop: true
      • _Type of loop: Fixed number of times`
      • Number of times: {InitialRotationSteps}`
    3. In the same prototype, define a Can Rotate trait with
      • Allow arbitrary rotations: false
      • Number of allowed facings: some number
      • Rotate clockwise: rotate
    4. In each piece, define a Marker trait with
      • Name: InitialRotationSteps`
      • Value: some number between 0 and Number of allowed facings from above.
  2. Supposing your pieces are placed in their initial position by an At-Start Stack.

    • Add a Can Rotate trait to each individual piece, with
      • Allow arbitrary rotations: true
    • Edit the properties of the At-Start Stack element (double-click it in the editor), and select Reposition stack. Then use the mouse to rotate the piece to its initial facing
  3. The direct way

    • Add a Can Rotate trait to each individual piece.
    • Then open the buildFile.xml of the module in a text editor, and edit the state of the trait of each piece.

    This is rather cumbersome because of the way Vassal encodes traits and trait states. An alternative, which has the benefit that it is easy to re-apply if you make changes, is to use my pywargame Python module. This of course requires that you are a bit familiar with Python.

    • Define a Python script - say patch.py a la
       from pywargame.vassal import *
      
       initialRotations = { 
             # Mapping, from piece name to initial rotation number 
             'foo': 2,
             'bar': 2, 
       }
       def patch(build,data,vmod,**kwargs):
           game = build.getGame()
            
           pieces = game.getPieces(asdict=True)
           for name, piece in pieces.items():
               traits  = piece.getTraits()
               rotate = Trait.findTrait(traits, RotateTrait.ID)
               if not rotate:
                   continue
               rotate.setState(angle = initialRotations.get(name,0))
      
      and then use vmodpatch.py to patch your module - say Foo.vmod with
       $ vmodpatch.py Foo.vmod patch.py
      
  4. The scenario way

    1. Once you’ve finished your module, open the module in the Vassal player.
    2. Rotate the pieces to their starting facing as a user would normally do
    3. Save the game and close the player
    4. Open the module in the Vassal Editor
    5. Add a Predefined Setup using the game you saved above.
    6. Save the module and close the editor.

Yours,
Christian