Difference between revisions of "Combat AI"

From Divinity Engine Wiki
Jump to: navigation, search
Line 5: Line 5:
 
===Skill conditions===
 
===Skill conditions===
 
===Archetypes and modifiers===
 
===Archetypes and modifiers===
 +
===AiHints===
 +
[[File:CombatAi_AiHints.PNG|none]]
 +
<sub>The EXTERN script variables AiHints and StayInAiHints</sub>
 +
You can assign a tag to the EXTERN AiHint parameter in the DefaultBehaviour script for the Ai to use. Ai will find AiHintAreaTriggers with this tag and use these during the calculation. The AiHintAreaTriggers with the specified tag (referred to ai AiHints from now on) are areas where the Ai would <i>prefer</i> to stand when attacking. You could use this when you, for example, want a ranger to prefer standing on some platforms in the back instead of on the lower ground. Keep in mind that it does <b>not</b> force the Ai to stay in the AiHint. For that you also need to enable the <i>StayInAiHints</i> parameter in the same DefaultBehaviour script. This forces the Ai to always stand in the AiHint, even if it blocks it from attacking. There's only 2 exceptions to this rule:
 +
# All of the AiHints are filled with dangerous surfaces (all of them full of fire for example)
 +
# The character has been moved outside of the AiHint (started outside of it or has been teleported for example) and is not able to attack anyone from any AiHints. In this case it will try to attack anyone without moving.
  
 
=Overriding Ai=
 
=Overriding Ai=

Revision as of 14:50, 11 September 2017

Introduction

Ai 2.0 or, as we'd like to call it, Jane (used to be an abbreviation, but we already forgot about it the next day) no longer uses a script for every single skill to reason about its usage. Almost all logic has been moved to code, and all that's left in script is starting the Ai calculation, stopping the Ai calculation, and executing the action that has been selected by Ai. This script logic can be found in DefaultBehaviour.charScript. The Ai now takes into account the properties of a skill, the statuses that are applied, the weapons that are used, the items nearby, etc. It (attempts) to simulate what's going to happen if it will use a certain skill at a certain target and assign a score to it. The action with the highest score will be executed. All this happens automatically, so a new skill or status can be used by Ai without any extra steps. Of course, there are exceptions, and you'd still like to guide or override the Ai from time to time. That's what this page tries to cover in detail.

Guiding Ai

Skill conditions

Archetypes and modifiers

AiHints

CombatAi AiHints.PNG

The EXTERN script variables AiHints and StayInAiHints You can assign a tag to the EXTERN AiHint parameter in the DefaultBehaviour script for the Ai to use. Ai will find AiHintAreaTriggers with this tag and use these during the calculation. The AiHintAreaTriggers with the specified tag (referred to ai AiHints from now on) are areas where the Ai would prefer to stand when attacking. You could use this when you, for example, want a ranger to prefer standing on some platforms in the back instead of on the lower ground. Keep in mind that it does not force the Ai to stay in the AiHint. For that you also need to enable the StayInAiHints parameter in the same DefaultBehaviour script. This forces the Ai to always stand in the AiHint, even if it blocks it from attacking. There's only 2 exceptions to this rule:

  1. All of the AiHints are filled with dangerous surfaces (all of them full of fire for example)
  2. The character has been moved outside of the AiHint (started outside of it or has been teleported for example) and is not able to attack anyone from any AiHints. In this case it will try to attack anyone without moving.

Overriding Ai

Skill overrides

Scripting

Unsupported properties

Skills

Statuses

Debugging Ai