Modding:AI Task meleeattacktargetingentity: Difference between revisions

From Vintage Story Wiki
(Created page with "This does the same thing as meleeattack with one exception. Only entities that are targeting the guarded entity (owner of the entity) are attacked, still maintaining all of the range restrictions from "meleeattack". The potential attack target is considered as targeting the guarded entity if the potential target has an AI task active that inherits from Modding:AiTaskBaseTargetable|AiTaskBase...")
 
m (typo)
 
Line 1: Line 1:
This does the same thing as [[Modding:AI_Task_meleeattack|meleeattack]] with one exception. Only entities that are targeting the [[Modding:Entity_Attribute_guardedPlayerUid|guarded entity]] (owner of the entity) are attacked, still maintaining all of the range restrictions from "meleeattack".
This does the same thing as [[Modding:AI_Task_meleeattack|meleeattack]] with one exception. Only entities that are targeting the [[Modding:Entity_Attribute_guardedPlayerUid|guarded entity]] (owner of the entity) are attacked, still maintaining all of the range restrictions from "meleeattack".


The potential attack target is considered as targeting the guarded entity if the potential target has an AI task active that inherits from [[Modding:AiTaskBaseTargetable|AiTaskBaseTargetable]], its '''TargetEntity''' is set to the guarded entity, and the task has '''AggressiveTargeting=true''' (true for everything that inherits from '''AiTaskBaseTargetable''' except [[Modding:AI_Task_fleeentity|fleeentity]]. For example, let's say there is a wolf near the player. The wolf is approaching the player due to an active [[Modding:AI_Task_seekentity|seekentity]] task. A hacked locust is guarding the player. The hacked locust sees that the "seekentity" task on the wolf is targeting the player, so it attacks the wolf as it passes by.
The potential attack target is considered as targeting the guarded entity if the potential target has an AI task active that inherits from [[Modding:AiTaskBaseTargetable|AiTaskBaseTargetable]], its '''TargetEntity''' is set to the guarded entity, and the task has '''AggressiveTargeting=true''' (true for everything that inherits from '''AiTaskBaseTargetable''' except [[Modding:AI_Task_fleeentity|fleeentity]]). For example, let's say there is a wolf near the player. The wolf is approaching the player due to an active [[Modding:AI_Task_seekentity|seekentity]] task. A hacked locust is guarding the player. The hacked locust sees that the "seekentity" task on the wolf is targeting the player, so it attacks the wolf as it passes by.


After the guard starts attacking a target, it continues attacking the target until it dies, or 30 seconds elapsed and the target is no longer targeting the guarded entity. Returning to the previous example, let's say that after receiving damage the wolf starts fleeing (but somehow it's stuck so that it remains within melee attack range of the locust). The hacked locust will continue trying to attack it for 30 seconds. At that it realizes that the wolf is no longer targeting the player, so the "meleeattacktargetingentity" task stops running.
After the guard starts attacking a target, it continues attacking the target until it dies, or 30 seconds elapsed and the target is no longer targeting the guarded entity. Returning to the previous example, let's say that after receiving damage the wolf starts fleeing (but somehow it's stuck so that it remains within melee attack range of the locust). The hacked locust will continue trying to attack it for 30 seconds. At that it realizes that the wolf is no longer targeting the player, so the "meleeattacktargetingentity" task stops running.

Latest revision as of 03:33, 20 October 2024

This does the same thing as meleeattack with one exception. Only entities that are targeting the guarded entity (owner of the entity) are attacked, still maintaining all of the range restrictions from "meleeattack".

The potential attack target is considered as targeting the guarded entity if the potential target has an AI task active that inherits from AiTaskBaseTargetable, its TargetEntity is set to the guarded entity, and the task has AggressiveTargeting=true (true for everything that inherits from AiTaskBaseTargetable except fleeentity). For example, let's say there is a wolf near the player. The wolf is approaching the player due to an active seekentity task. A hacked locust is guarding the player. The hacked locust sees that the "seekentity" task on the wolf is targeting the player, so it attacks the wolf as it passes by.

After the guard starts attacking a target, it continues attacking the target until it dies, or 30 seconds elapsed and the target is no longer targeting the guarded entity. Returning to the previous example, let's say that after receiving damage the wolf starts fleeing (but somehow it's stuck so that it remains within melee attack range of the locust). The hacked locust will continue trying to attack it for 30 seconds. At that it realizes that the wolf is no longer targeting the player, so the "meleeattacktargetingentity" task stops running.

Properties

All properties are inherited from meleeattack. So see the list of properties there.


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