## VASSAL Reference Manual

Home > Module > Game Piece Palette > Game Piece > Replace With Other

### Replace With Other

A Game Piece with this trait will have a command that replaces this piece with a different piece. You can select any existing piece for the replacement or define a new one from scratch.

EXAMPLE: A unit that can be destroyed but still leaves a wreck behind can be given this trait to turn it into a wreck. This is more convenient than dragging a new piece from the Game Piece Palette and can’t be accidentally undone, as a Layer trait could.

EXAMPLE: A unit representing a General is killed in battle. This trait can be used to replace him with a counter for a new more junior General who will appear as a replacement, and then the "Keystroke to apply after placement" can be used to activate a Send to Location trait on the replacement General’s piece to send that piece to the Turn Track to await availability.

Description:

  A brief description of this trait that will appear in the Piece Definer window.

Menu command:

  The right-click context menu text for this trait. If left blank, no context menu item will appear, but the trait can still be activated with the Key Command.

Key command:

  The Keystroke or Named Command to initiate this trait.

Marker definition:

  Click the Define Replacement button to open a Piece Definer to create a definition for the new piece from scratch (or to edit the definition you have already created).

  Click the Select button to use the definition from an existing piece in the module. This acts as a pointer to an existing definition: if the original piece is changed, the piece created by the Replace with Other trait will also change.

Horizontal offset:

  The center of the replacement piece will be placed this many pixels to the right of the center of the original piece.

Vertical offset:

  The center of the replacement piece will be placed this many pixels above the center of the original piece.

Match current state:

  If selected, VASSAL will attempt to put the replacement piece in the same state as the original piece. Layers will be set to the same level, labels will be given the same value, rotation angles will match, etc. The state of a particular trait will carry over only if it has an exact match in the replacement, i.e. the properties settings of that trait are the same in both the original and replacement piece.

  Note | Markers are never state matched. A Marker defined in the replacement piece will always get the value defined in the replacement piece, even if the same Marker is defined in the source piece.

Only match states above this trait:

  If selected, VASSAL will only replace states in traits that appear above this one in the list of traits in the game piece editor. For example, the state of a Layer that’s above this one will change if the state in the new game piece changes. If it’s below, then it will not change if the new game piece has the same Layer property.

Copy Dynamic Property values whre Property name matches:

  The default option for Dynamic Properties is that the trait must be defined exactly in the replacement as it is in the original (including description, minimum and maximum values and Key Commands).

  Selecting this option causes the match process to just compare the name of the Dynamic Property between the original and the replacement, regardless of the other settings.

  This makes it easier to simply copy the value of Dynamic Properties into the matching properties replacement piece where you may need to define them differently in the replacement piece.

Place marker:

  Choose whether the new piece should be placed on the top of this piece’s stack, on the bottom of the stack, or directly above/below the triggering piece.

Set Dynamic Properties in marker:

  Allows you to set the values of the named Dynamic Properties that exist in the created marker.
  Properties used in the expression reference values in the newly created marker.
  The expression used to set the value can reference existing property values in both the piece creating the marker (Using $$ variables) and in the newly created marker.
  The values are set into the new marker after any propert values are copied based on State matching, but before the Keystroke after placement is applied.

  See Passing values to pieces for more detailed information on using this feature.

Note | The named Dynamic Properties must exist in the Piece Definition of the Marker to be created. This option does not create new Dynamic Properties

Key Command to apply after placement:

  Optional Keystroke or Named Command to be applied automatically to the new piece immediately after being placed.

SEE ALSO: Place Marker trait, Send to Location trait.