Stances

Darren Ravenscroft edited this page Feb 17, 2017 · 6 revisions
Clone this wiki locally

Ingame you can cycle through stances by using the Ctrl + Z hotkey.

There are a couple of simple things being controlled:

  • whether the unit retaliates when it takes damage
  • whether the unit scans for targets and engages them automatically
  • whether the unit is allowed to move

HoldFire turns all of that off, the unit will only accept targets from the player
ReturnFire turns off the scanning, but will engage a unit that fires upon you (provided it does at least 1hp of damage)
Defend enables scanning and retaliation, but prevents the unit from chasing a target
AttackAnything scans, retaliates, and chases things

  • Ground units in most cases by default are to set Defend (from 20151031 onwards) or AttackAnything
  • Submarines are set to HoldFire

Using stances in mapping / modding

Setting the initial stance of a unit type

The initial stance of an actortype is defined on the AutoTarget trait. You can differentiate between the initial stance a player-controlled and a bot-controlled unit has. The player-controlled stance is defined on the InitialStance property while the bot-controlled stance is customizable on the InitialStanceAI property. The following example will further explain the usage:

e1:
    AutoTarget:
        InitialStance: ReturnFire
        InitialStanceAI: ReturnFire

Setting the initial stance of a single unit

In map.yaml you can change the initial stance of single units by adding a StanceInit (just Stance: <value> in yaml).
You do this on the actor definition in the Actors section:

myactor: e1
    Location: 17,112
    Owner: Multi0
    Stance: Defend

In lua you can just set the stance of individual units runtime:

myactor.Stance = HoldFire