Modding:AiTaskBaseTargetable: Difference between revisions

From Vintage Story Wiki
(Link to subclasses)
(→‎Subclasses: add jealous subtasks)
Line 8: Line 8:


== Subclasses ==
== Subclasses ==
* [[Modding:AI_Task_fleeentity|fleeentity]]
* [[Modding:AI_Task_flyswoopattack|flyswoopattack]]
* [[Modding:AI_Task_jealousmeleeattack|jealousmeleeattack]]
* [[Modding:AI_Task_jealousseekentity|jealousseekentity]]
* [[Modding:AI_Task_lookatentity|lookatentity]]
* [[Modding:AI_Task_lookatentity|lookatentity]]
* [[Modding:AI_Task_flyswoopattack|flyswoopattack]]
* [[Modding:AI_Task_meleeattack|meleeattack]]
* [[Modding:AI_Task_seekentity|seekentity]]
* [[Modding:AI_Task_seekentity|seekentity]]
* [[Modding:AI_Task_meleeattack|meleeattack]]
* [[Modding:AI_Task_fleeentity|fleeentity]]


== Properties ==
== Properties ==

Revision as of 05:18, 13 October 2024

Because this class is abstract, it cannot be used directly as an AI task. However, it is documented on its own page because it defines common functionality for several attack related AI tasks that inherit from it.

The task determines which entities in range can be targeted. The actual search range is specified by the child tasks.

When the creatureHostility world configuration is set to passive (default is aggressive), then restrictions are placed on whether the entity can target the player, unless friendlyTarget is set to true, which causes these restrictions to be ignored. When the creatureHostility is set to passive, then the entity will only target the player if the entity is in the "aggressiveondamage" or "aggressivearoundentities" emotional state. When the creatureHostility is set to "off", then the entity will not target the player no matter its emotional state.

The seeking range for players is reduced if the player's "animalSeekingRange" stat is less than 1. By default the furtive class trait changes this stat. If the player is sneaking, this adds a stacking 40% reduction to the seeking range.

Subclasses

Properties

friendlyTarget: (boolean, default false)
if true, then ignore the creatureHostility world configuration.
retaliateAttacks: (boolean, default true)
defined by this class, but only used by subclasses. Most subclasses use this setting to make the entity more aggressive when attacked and focus on whatever attacked it last.
triggerEmotionState: (string, default "")
If set, then trigger this emotional state whenever the task starts executing (starts targeting an entity).
skipEntityCodes: (string array, default empty)
Do not target entities with code in this list. These strings can be exact codes or wildcards.
entityCodes: (string array, default "player")
If set, then only target entities in this list (still excluding entities in the skipEntityCodes property). These can either be exact entity codes, or wildcards that filter based on the entity prefix. These entity prefix wildcards must have exactly one asterisk, and that asterisk must be the last character.