Difference between revisions of "GetThreatRatio"
DavidJCobb (talk | contribs) (→Description: simplified presentation of the math involved, based on reverse engineering) |
(→Notes: Not really exhaustive) |
||
(One intermediate revision by one other user not shown) | |||
Line 9: | Line 9: | ||
</math> | </math> | ||
For the threat level calculation, the armor's estimated defense and estimated offense are multiplied together. The estimated defense is their current health, divided by the inverse of their armor protection (their Damage Resistance [[actor value]] scaled by the ''fArmorScalingFactor'' [[Game Settings|game setting]]). The estimated offense is the actor's estimated DPS (damage per second) given their currently equipped [[weapon]] (defaulting to the Unarmed weapon) and [[ammo]]. | For the threat level calculation, the armor's estimated defense and estimated offense are multiplied together. The estimated defense is their current health, divided by the inverse of their armor protection (their Damage Resistance [[actor value]] scaled by the ''fArmorScalingFactor'' [[Game Settings|game setting]]), with the divisor clamped to avoid a division by zero. The estimated offense is the actor's estimated DPS (damage per second) given their currently equipped [[weapon]] (defaulting to the Unarmed weapon) and [[ammo]]. | ||
==Syntax== | ==Syntax== | ||
Line 21: | Line 21: | ||
==Notes== | ==Notes== | ||
*Threat ratio is higher when the player is "stronger" than nearby enemies. The game uses this to determine when combat music should be played (if the enemies are strong enough compared to the player to drop the threat ratio below fCombatMusicPlayerTargetedThreatRatio) | *Threat ratio is higher when the player is "stronger" than nearby enemies. The game uses this to determine when combat music should be played (if the enemies are strong enough compared to the player to drop the threat ratio below fCombatMusicPlayerTargetedThreatRatio). | ||
==See Also== | ==See Also== |
Latest revision as of 06:53, 30 July 2022
Description[edit | edit source]
GetThreatRatio returns the calculated threat ratio between two specified actors.
A single actor's threat level is calculated using the formula below. The threat ratio between two actors is one actor's threat level divided by the other actor's threat level.
For the threat level calculation, the armor's estimated defense and estimated offense are multiplied together. The estimated defense is their current health, divided by the inverse of their armor protection (their Damage Resistance actor value scaled by the fArmorScalingFactor game setting), with the divisor clamped to avoid a division by zero. The estimated offense is the actor's estimated DPS (damage per second) given their currently equipped weapon (defaulting to the Unarmed weapon) and ammo.
Syntax[edit | edit source]
ActorRef.GetThreatRatio ActorRef
Examples[edit | edit source]
ActorRef.GetThreatRatio Player
Function returns the threat ratio between ActorRef and the Player.
Notes[edit | edit source]
- Threat ratio is higher when the player is "stronger" than nearby enemies. The game uses this to determine when combat music should be played (if the enemies are strong enough compared to the player to drop the threat ratio below fCombatMusicPlayerTargetedThreatRatio).