Arma Reforger Script API
Loading...
Searching...
No Matches
AIWeaponTargetSelector Interface Reference
Inheritance diagram for AIWeaponTargetSelector:

Public Member Functions

proto external void Init (notnull IEntity owner)
 Some functions accept minimal magazine count specification array: array<int> minMagCountSpec.
 
proto external void SetSelectionProperties (float maxLastSeenDirect, float maxLastSeenIndirect, float maxLastSeen, float minTraceFractionIndirect, float maxDistanceInfantry, float maxDistanceVehicles, float maxTimeSinceEndangered, float maxDistanceDisarmed)
 Initializes properties for target/weapon selection.
 
proto external void SetTargetScoreConstants (EAIUnitType targetUnitType, float offset, float slope)
 Sets constants for target score calculation.
 
proto external bool SelectWeaponAndTarget (notnull array< IEntity > assignedTargets, float assignedTargetsScoreIncrement, float dangerTargetsScoreIncrement, bool useCompartmentWeapons, array< int > weaponTypesWhitelist=null, array< int > weaponTypesBlacklist=null)
 Selects weapon and target.
 
proto BaseTarget GetSelectedTarget ()
 Returns selected target.
 
proto void GetSelectedWeapon (out BaseWeaponComponent outWeapon, out int outMuzzleId, out BaseMagazineComponent outMagazine)
 Returns selected weapon, muzzle, magazine.
 
proto external EAIUnitType GetUnitTypesCanAttack ()
 Return unit types which we can attack based on available weapons.
 
proto void GetSelectedWeaponProperties (out float outMinDistance, out float outMaxDistance, out bool outDirectDamage)
 Returns properties of selected weapon/magazine.
 
proto void GetMostRelevantTargetCantAttack (out BaseTarget target, out float targetScore)
 Returns most relevant target which we can't attack.
 
proto external bool SelectWeaponAgainstUnitType (EAIUnitType targetUnitType, bool useCompartmentWeapons, array< int > minMagCountSpec=null)
 Selects weapon against abstract target of given type.
 
proto external bool SelectWeaponAgainstUnitTypeAndDistance (EAIUnitType targetUnitType, float distance, bool preferDirectAttackWeapon, bool useCompartmentWeapons, array< int > weaponTypesWhitelist=null, array< int > weaponTypesBlacklist=null, array< int > minMagCountSpec=null)
 Selects weapon against abstract target of given type, but takes distance into account.
 
proto external float CalculateTargetScore (BaseTarget target)
 Returns score of the target.
 
proto external bool HasWeaponOfType (EWeaponType weaponType, bool searchCompartment)
 Methods below perform fast lookup from inventory caches.
 
proto external BaseWeaponComponent FindWeaponOfType (EWeaponType weaponType, bool searchCompartment)
 
proto external int GetMagazineCount (TypeName magazineWellType, bool searchCompartment)
 Returns amount of magazines for magazine well.
 
proto external BaseMagazineComponent FindMagazineWithTraits (EAICombatPropertiesComponentTraits traits, bool searchCompartment)
 Finds magazine with given traits. Traits value is treated as flags.
 
proto BaseWeaponComponent FindWeaponAndMuzzleForMagazineWell (TypeName magazineWellType, bool searchCompartment, out int muzzleId)
 Finds a weapon and muzzle compatible with given magazine well.
 

Member Function Documentation

◆ CalculateTargetScore()

proto external float AIWeaponTargetSelector.CalculateTargetScore ( BaseTarget target)

Returns score of the target.

◆ FindMagazineWithTraits()

proto external BaseMagazineComponent AIWeaponTargetSelector.FindMagazineWithTraits ( EAICombatPropertiesComponentTraits traits,
bool searchCompartment )

Finds magazine with given traits. Traits value is treated as flags.

◆ FindWeaponAndMuzzleForMagazineWell()

proto BaseWeaponComponent AIWeaponTargetSelector.FindWeaponAndMuzzleForMagazineWell ( TypeName magazineWellType,
bool searchCompartment,
out int muzzleId )

Finds a weapon and muzzle compatible with given magazine well.

◆ FindWeaponOfType()

proto external BaseWeaponComponent AIWeaponTargetSelector.FindWeaponOfType ( EWeaponType weaponType,
bool searchCompartment )

◆ GetMagazineCount()

proto external int AIWeaponTargetSelector.GetMagazineCount ( TypeName magazineWellType,
bool searchCompartment )

Returns amount of magazines for magazine well.

◆ GetMostRelevantTargetCantAttack()

proto void AIWeaponTargetSelector.GetMostRelevantTargetCantAttack ( out BaseTarget target,
out float targetScore )

Returns most relevant target which we can't attack.

◆ GetSelectedTarget()

proto BaseTarget AIWeaponTargetSelector.GetSelectedTarget ( )

Returns selected target.

◆ GetSelectedWeapon()

proto void AIWeaponTargetSelector.GetSelectedWeapon ( out BaseWeaponComponent outWeapon,
out int outMuzzleId,
out BaseMagazineComponent outMagazine )

Returns selected weapon, muzzle, magazine.

◆ GetSelectedWeaponProperties()

proto void AIWeaponTargetSelector.GetSelectedWeaponProperties ( out float outMinDistance,
out float outMaxDistance,
out bool outDirectDamage )

Returns properties of selected weapon/magazine.

◆ GetUnitTypesCanAttack()

proto external EAIUnitType AIWeaponTargetSelector.GetUnitTypesCanAttack ( )

Return unit types which we can attack based on available weapons.

Uses cached value from last SelectWeaponAndTarget call.

◆ HasWeaponOfType()

proto external bool AIWeaponTargetSelector.HasWeaponOfType ( EWeaponType weaponType,
bool searchCompartment )

Methods below perform fast lookup from inventory caches.

They should be prefered for weapon or magazine searches for AI instead of inventory queries. searchCompartments - if true, the inventory cache for current compartment is used. Otherwise character's cache is used.

◆ Init()

proto external void AIWeaponTargetSelector.Init ( notnull IEntity owner)

Some functions accept minimal magazine count specification array: array<int> minMagCountSpec.

This array lets you exclude weapons which have lower amount of magazines than specified. The array is of following format: {DefaultValue, WeaponType0, MagCount0, WeaponType1, MagCount1, ...}.

  1. Element 0 is default mag. count if weapon type is not found in the array.
  2. Other elements are pairs of EWeaponType, MagCount. !!! When magazines are counted, the current magazine in weapon is counted as well.

◆ SelectWeaponAgainstUnitType()

proto external bool AIWeaponTargetSelector.SelectWeaponAgainstUnitType ( EAIUnitType targetUnitType,
bool useCompartmentWeapons,
array< int > minMagCountSpec = null )

Selects weapon against abstract target of given type.

Call GetSelectedWeapon, GetSelectedWeaponProperties to get result.

◆ SelectWeaponAgainstUnitTypeAndDistance()

proto external bool AIWeaponTargetSelector.SelectWeaponAgainstUnitTypeAndDistance ( EAIUnitType targetUnitType,
float distance,
bool preferDirectAttackWeapon,
bool useCompartmentWeapons,
array< int > weaponTypesWhitelist = null,
array< int > weaponTypesBlacklist = null,
array< int > minMagCountSpec = null )

Selects weapon against abstract target of given type, but takes distance into account.

Call GetSelectedWeapon, GetSelectedWeaponProperties to get result.

◆ SelectWeaponAndTarget()

proto external bool AIWeaponTargetSelector.SelectWeaponAndTarget ( notnull array< IEntity > assignedTargets,
float assignedTargetsScoreIncrement,
float dangerTargetsScoreIncrement,
bool useCompartmentWeapons,
array< int > weaponTypesWhitelist = null,
array< int > weaponTypesBlacklist = null )

Selects weapon and target.

Returns true when a valid option is selected. Call GetSelectedTarget, GetSelectedWeapon, GetSelectedWeaponProperties to get result.

◆ SetSelectionProperties()

proto external void AIWeaponTargetSelector.SetSelectionProperties ( float maxLastSeenDirect,
float maxLastSeenIndirect,
float maxLastSeen,
float minTraceFractionIndirect,
float maxDistanceInfantry,
float maxDistanceVehicles,
float maxTimeSinceEndangered,
float maxDistanceDisarmed )

Initializes properties for target/weapon selection.

◆ SetTargetScoreConstants()

proto external void AIWeaponTargetSelector.SetTargetScoreConstants ( EAIUnitType targetUnitType,
float offset,
float slope )

Sets constants for target score calculation.

Formula is: score = offset + slope*distance


The documentation for this interface was generated from the following file: