Threat

Threat is a mechanism in Dragon Age: Origins whereby enemies decide which characters in your party to attack. The threat of a character is an indication of how aggressive enemies are towards that character. Enemies usually ignore characters with low threat levels and attack characters with high threat levels. Threat is an essential part of combat strategy, especially in higher levels of difficulty.
==Initial threat==
Initial threat is the threat each party member has when they're first seen by an enemy. It has a base value of 10 that can be increased by a bonus that depends on the weapons and armor the character has equipped and the difficulty level. In difficulty levels lower than Nightmare the threat bonus is 5 for light armor; 10 for medium, heavy and massive armor; and 5 for melee weapons. In the Nightmare difficulty level there are no bonuses.
==Distance-based threat==
After a party member has been added to the threat table, a distance-based threat component is initialized (distance between enemy and party member). This threat component scales approximately like this (distance in m):
Distance in m 	1.8 	4.5 	7 	14 	18 	28 	43
Threat 	97 	92.5 	88 	74 	66 	51 	23
1.8m - 2m is the common melee-combat distance	1.8m - 2m is the common melee-combat distance	1.8m - 2m is the common melee-combat distance	1.8m - 2m is the common melee-combat distance	1.8m - 2m is the common melee-combat distance	1.8m - 2m is the common melee-combat distance	1.8m - 2m is the common melee-combat distance	1.8m - 2m is the common melee-combat distance
The distance-based threat component cannot be reset with Abilities / Spells like Disengage, Distraction, Mind Blast and is not affected by threat decay.
==Drawing threat==
===Dealing damage===
Dealing damage to an enemy draws threat from that enemy. The amount of threat drawn is the percentage of the enemy's maximum health inflicted as damage:
 ThreatIncrease = 100 * DamageDealt / MaximumHealth of Enemy
For example, inflicting 40 points of damage to an enemy with 200 hit points (i.e., 20% of its maximum health) draws 20 threat.
Rogues are an exception: they only draw 80% of this amount.
This means that using damage to draw threat from boss and elite boss enemies is very inefficient (because they usually have thousands of health points). Against these enemies it is much more efficient to use abilities with high fixed threat values, like Taunt.
===Warriors===
Some warrior abilities increase threat:
*Taunt provides an AoE threat increase of 300 (400 with Frightening Appearance).
*Threaten doubles the amount of threat drawn when dealing damage.
*Most Activated Talents should draw additional threat from affected enemies. However, this only works for the talents Arrow of Slaying, Pinning Shot and Scattershot (primary target only). The mod Dain's fixes fixes this problem
===Mages===
Some offensive spells draw extra threat on top of that drawn by the damage they deal. In many cases this doesn't work as described in the spell descriptions (the mod Dain's fixes fixes this problem). However, it does work for the following spells:
*Area of Effect spells:
**Earthquake draws 50 threat on Casual/Normal and 70 on Hard/Nightmare
**Miasma draws 20 threat on Hard/Nightmare.
**Death Cloud draws 80 threat.
*Single-Target spells:
**Walking Bomb draws 50 threat on Casual/Normal and 100 on Hard/Nightmare.
**Virulent Walking Bomb draws 70 threat.
**Crushing Prison draws 100 threat.
**Petrify draws 100 threat.
**Death Hex draws 100 threat.
**Misdirection Hex draws 60 threat.
**Horror draws 60 threat.
**Paralyze draws 50 threat.
**Affliction Hex draws 30 threat from the primary target. No threat is drawn from surrounding enemies.
**Weakness draws 10 threat.
**Vulnerability Hex draws 10 threat.
Animate Dead is a special case: the summoned skeleton (not the caster) draws a lot of threat when initially summoned.
===Items===
Items with the property, such as Ageless, do not have their effects implemented properly and do not adjust threat in any way. Cadash Stompers, which has the property, is an exception (it draws 5 threat per hit). The mod Dain's fixes fixes this problem.
==Reducing threat==
Threat decreases automatically at a rate of 0.5 per second. This means that a character that resets their threat (by one of the methods described below) might still have higher threat than their companions.
Mind Blast clears all threat drawn by the mage except for the distance-based component.
When a rogue enters Stealth mode his threat values are reset unless Stealth is broken within 1-2 seconds. Feign Death works in a similar way. Distraction clears all the threat of the target except for the distance-based component.
Disengage lowers threat by 100.
The property , found in items like Bard's Dancing Shoes, Dalish Promise Ring, Amulet of Accord, Magister's Cinch and Adaia's Boots, is not implemented properly and does not reduce threat in any way. The mod Dain's fixes fixes this problem.
When a character moves more than 60 meters away from enemies their threat is reset.
==Common threat strategies==
Tank & Range: This is a common strategy that consists in increasing the threat of a warrior (sometimes two) equipped with a weapon and a shield. The high threat draws most enemy attacks to this warrior. The warrior acts as a "tank" whose job it is to soak up damage while the other party members either heal and buff, backstab, attack with two-handed weapons, deal magic damage or use other ranged attacks.
When an enemy chasing a fleeing party member passes close by another party member the reduced distance to this second party member can make the enemy switch targets to this second party member. This is a useful tactic when a mage is attacked by several enemies at the beginning of combat, specially in Nightmare difficulty, because in this difficulty level the only difference in initial threat between party members is that due to distance.
==Enemy target switching==
Enemies will always try to attack the target they hate most (has the highest threat amount to this particular enemy).
Enemies with melee weapons have timers limiting how often they switch targets. The timer start value is initialized to 0 and increases by 5s (up to 25s), each time the target is switched. While the timer is counting down, targets will not be switched (unless the current target cannot be attacked).
If the target has 20% health left, enemies will not switch to a higher threat target with a probability of 50%. If the target has 10% health left, enemies will not switch to a higher threat target with a probability of 90%.
==Special attacks==
An exception to targeting the most-hated enemy, are ranged AoE attacks some creatures can perform. Those are controlled by a Tactics system similar to the party AI. These tactics may contain ability / spell triggers based on clustered enemies and target range.
Examples would be the Harvester's Vile Disembowelment and Varterral's Scream.
==Verification and testing notes==
===Hooking into the engine===
Most of the threat management/updating is done in ai_threat_h.nss. This is a header file, so it cannot be directly recompiled. Root scripts with a main() function using this header must be recompiled, e.g. rules_core.nss, player_core.nss, spell_aoe_instant.nss, spell_aoe_duration.nss, talent_model.nss, talent_singletarget.nss.
Useful script functions:
*float threat = GetThreatValueByObjectID(oCreature, oAttacker); Returns current threat value.
*GetName(oAttacker) Name of party member.
*GetName(oCreature) Name of enemy, as displayed in game.
*GetTag(oCreature) Base name of the *.utc file of the actual creature spawned.
*ObjectToString(oCreature) Unique Object ID of the creature.
*Logging
===Verified functionality===
Testing was performed with Patch 1.02; Toolset 1.01.
*Base threat upon sighting (including weapon / armor bonus at lower difficulties).
*Threat based on damage (including Threaten functionality, Frightening Appearance does not give Threaten bonus - this can be fixed with Dain's Fixes).
*Spells draw additional threat, taken from ABI_base.xls, threat_impact column. The threat_impact value is multiplied by 10. Walking Bomb special case verified. This is triggered by the EVENT_TYPE_CAST_AT event in rules_core.nss. This is working for about half the spells. Spell descriptions have been updated.
*Most Talents do not draw additional threat, there are threat_impact values in ABI_base.xls as well. All activated Talents have been checked. Only Archery talents Arrow of Slaying, Pinning Shot and Scattershot, Shale talents Stone Roar, Regenerating Burst, Rock Barrage and Stone Aura, and Dog talent Overwhelm draw additional threat. The EVENT_TYPE_CAST_AT event is used as here as well to trigger the threat update. The problem can be fixed for all Talents with Dain's Fixes.
*Taunt.
*Feign Death, Stealth reduce threat if the Rogue has disappeared from perception long enough.
*Reaching a distance of more than 60m drops threat.
*Target switch counters, limiting melee target switch rate.
*Mind Blast.
*Items with Reduces Hostility and Increases Hostility and Intimidation properties do not work (tested items: Bard's Dancing Shoes, Ageless) - a fix for this is included in Dain's Fixes. However, items like Cadash Stompers with Increases Hostility property do work by default (note the lack of "intimidation" in the property description). The latter items add 5 points of threat per hit.
*The distance-based threat generation is happening somewhere deep in the bowels of the engine and not performed using scripts. The values appear to be reproducible, but special cases that have not been discovered may exist.
Category:Game mechanics
Category:Dragon Age: Origins gameplay