Skip to content

Unit: Influence Map and Factors

Michael Starkweather edited this page Jun 16, 2019 · 2 revisions

Behavior variables act as parameters to both the behavior tree and assorted other AI code. For example, the Float_FenceRadius controls how big the unit could get from the mean position of the lance for the influence factor PreferInsideFenceNegativeLogicPositionalFactor. Bool_AllowAttack is used as parameter to the IsBVTrueNode in many places in the tree to control if the unit can attack.

You can provide overrides to behavior variables in two ways:

  • Provide the path to a folder that contains BehaviorVariableScope files (such as global.json) in BehaviorScopesDirectory in a TeamAIOverrideDef
  • Provide simple overrides in BehaviorVariableOverrides in a UnitAIOverrideDef

An example BehaviorVariableOverrides that contains both vanilla variables and variables for a modded influence factor:

"BehaviorVariableOverrides": {
    "Bool_AllowAttack": {
        "type": "Bool",
        "boolVal": true
    },
    "Float_FenceRadius": {
        "type": "Float",
        "floatVal": 150
    },

    "PreferHigherEvasionPositionFactorWeight": {
        "type": "Float",
        "floatVal": 1.0
    },
    "PreferHigherEvasionPositionFactorSprintWeight": {
        "type": "Float",
        "floatVal": 0.0
    }
}
Clone this wiki locally