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?
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.
As @jrwatts suggested:
rotateToStartrotateToStartrotatetrue: Fixed number of times`: {InitialRotationSteps}`falserotateSupposing your pieces are placed in their initial position by an At-Start Stack.
trueThe direct way
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.
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
The scenario way
Yours,
Christian