Modding:AiTaskBaseTargetable: Difference between revisions

From Vintage Story Wiki
(→‎Subclasses: add jealous subtasks)
(→‎Properties: Add navbox)
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:
* [[Modding:AI_Task_lookatentity|lookatentity]]
* [[Modding:AI_Task_lookatentity|lookatentity]]
* [[Modding:AI_Task_meleeattack|meleeattack]]
* [[Modding:AI_Task_meleeattack|meleeattack]]
* [[Modding:AI_Task_meleeattacktargetingentity|meleeattacktargetingentity]]
* [[Modding:AI_Task_seekentity|seekentity]]
* [[Modding:AI_Task_seekentity|seekentity]]


Line 23: Line 24:
; '''skipEntityCodes''': (string array, default empty) : Do not target entities with code in this list. These strings can be exact codes or wildcards.
; '''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.
; '''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.
{{Navbox/contentmodding}}

Latest revision as of 16:46, 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.


Content Modding
Basics Content Mods Developing a Content Mod Packaging & Release
Tutorials
Concepts Modding Concepts Modinfo Variants Domains Patching Remapping World Properties
Moddable Assets
Uncategorized
Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityEntity BehaviorsBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsCollectible BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository