Arma Reforger Script API
|
Public Member Functions | |
void | SetGroupSuppressClusterState (SCR_AITargetClusterState state) |
void | SetGroupFireRateCoef (float coef=1, bool overridePersistent=false) |
void | SetFireRateCoef (float coef=1, bool persistent=false) |
float | GetFireRateCoef () |
EAISkill | GetAISkill () |
void | SetAISkill (EAISkill skill) |
Use this to change AIskill dynamically. | |
void | SetPerceptionFactor (float value) |
Sets perception ability. | |
void | ResetAISkill () |
use this to reset AI skill to default | |
BaseWeaponComponent | GetCurrentWeapon () |
EWeaponType | GetCurrentWeaponType (bool overrideWithMuzzle=false) |
BaseTarget | GetCurrentTarget () |
BaseTarget | GetRetreatTarget () |
BaseTarget | GetLastSeenEnemy () |
BaseTarget | GetEndangeringEnemy () |
bool | IsEnemyKnown (IEntity ent) |
void | EvaluateWeaponAndTarget (out bool outWeaponEvent, out bool outSelectedTargetChanged, out BaseTarget outPrevTarget, out BaseTarget outCurrentTarget, out bool outRetreatTargetChanged, out bool outCompartmentChanged) |
vector | GetTargetDestinationPos () |
SCR_AIInfoComponent | GetAIInfoComponent () |
bool | EvaluateLowAmmo (BaseWeaponComponent weaponComp, int muzzleId) |
Checks amount of magazines for given weapon, and if low on ammo, reports that to group. | |
int | GetWeaponLowMagThreshold (BaseWeaponComponent weapon) |
void | Update (float timeSliceMs) |
bool | DismountTurretCondition (inout vector targetPos, bool targetPosProvided) |
Condition to dismount turret Returns true when we should dismount it immediately. | |
void | TryAddDismountTurretActions (vector targetPos, bool addGetOut=true, bool addInvestigate=true, bool addGetIn=true) |
Adds action to dismount turret, investigate, and go back. | |
vector | FindNextCoverPosition () |
bool | IsActionAllowed (EAICombatActions action) |
EAICombatActions | GetAllowedActions () |
void | SetHoldFire (bool isHoldFire) |
EAICombatType | GetCombatType () |
void | SetCombatType (EAICombatType combatType) |
void | SetDefaultCombatType (EAICombatType combatType) |
When AI use reset e.g. | |
void | ResetCombatType () |
bool | IsFriendlyInAim () |
bool | IsTargetVisible (notnull BaseTarget target) |
Checks if given target can be considered visible. | |
void | SetAssignedTargets (array< IEntity > assignedTargets, SCR_AITargetClusterState clusterState) |
Either array of targets or target cluster must be provided. | |
void | ResetAssignedTargets () |
void | SetExpectedEnemyType (EAIUnitType expectedEnemyType) |
void | ResetExpectedEnemyType () |
void | GetSelectedWeaponAndMagazine (out BaseWeaponComponent outWeaponComp, out int outMuzzleId, out BaseMagazineComponent outMagazineComp) |
Getters which return the weapon which combat component thinks is best against current target If there is no current target, then there is no selected weapon as well! In that case use GetExpectedWeapon. | |
void | GetSelectedWeapon (out BaseWeaponComponent outWeaponComp, out int outMuzzleId) |
EWeaponType | GetSelectedWeaponType () |
void | GetSelectedWeaponProperties (out float outMinDistance, out float outMaxDistance, out bool outDirectDamage) |
bool | GetSelectedWeaponDirectDamage () |
float | GetSelectedWeaponMinDist () |
float | GetSelectedWeaponMaxDist () |
ResourceName | GetSelectedWeaponResource () |
EAIUnitType | GetUnitTypesCanAttack () |
void | EvaluateExpectedWeapon (out BaseWeaponComponent outWeaponComp, out int outMuzzleId, out BaseMagazineComponent outMagazineComp) |
Returns weapon which combat component thinks is expected to be used this situation This should be used for selecting fallback weapon in a situation without an actively attacked target. | |
void | EvaluateSuppressionWeapon (EAIUnitType targetUnitType, float distanceToTarget, out BaseWeaponComponent outWeaponComp, out int outMuzzleId, out BaseMagazineComponent outMagazineComp) |
Returns optimal weapon which can be used for suppressing target of given type at given range. | |
bool | HasWeaponOfType (EWeaponType weaponType) |
BaseWeaponComponent | FindWeaponOfType (EWeaponType weaponType) |
int | GetMagazineCount (TypeName magazineWell, bool countMagazineInWeapon=false) |
override void | OnPostInit (IEntity owner) |
override void | EOnInit (IEntity owner) |
override void | OnDelete (IEntity owner) |
void | SetTargetSelectionProperties (bool closeCombat) |
void | UpdatePerceptionFactor (PerceptionComponent perceptionComp, SCR_AIThreatSystem threatSystem) |
void | ~SCR_AICombatComponent () |
void | DebugPrintToWidget (TextWidget w) |
Used by AIDebugInfoComponent. | |
SCR_ChimeraAIAgent | GetAiAgent () |
BaseTarget | FindTargetByEntity (IEntity ent) |
void | UpdateLastSeenPosition (IEntity entity, notnull SCR_AITargetInfo targetInfo) |
void | UpdateLastSeenPosition (notnull BaseTarget tgt, notnull SCR_AITargetInfo targetInfo) |
Public Attributes | |
ref AIWeaponTargetSelector | m_WeaponTargetSelector = new AIWeaponTargetSelector() |
Static Public Attributes | |
static const int | TARGET_ENDANGERED_TIMEOUT_S = 10 |
How long after last time target was endangering we stop treating it as such. | |
static const float | ENDANGERING_TARGET_SCORE_MULTIPLIER = 1.05 |
Multiplier of target score if target is considered endangering. | |
static const float | TARGET_MAX_LAST_SEEN_VISIBLE = 0.5 |
'IsTargetVisible' variable in attack tree relies on this | |
static const float | TARGET_MIN_LAST_SEEN_INDIRECT_ATTACK = 2.0 |
static const float | TARGET_MAX_LAST_SEEN_INDIRECT_ATTACK = 7.0 |
static const float | TARGET_MAX_LAST_SEEN_INDIRECT_ATTACK_MG = 14.0 |
static const float | TARGET_MAX_LAST_SEEN_INDIRECT_ATTACK_CLOSE = 20.0 |
static const float | TARGET_MAX_LAST_SEEN = 11.0 |
static const float | TARGET_SCORE_HIGH_PRIORITY_ATTACK = 98.5 |
Threshold for high priority attack. | |
static const float | CLOSE_RANGE_COMBAT_DISTANCE = 35.0 |
Within this distance AI considers combat as 'close range', used in firing times. | |
static const float | CLOSE_RANGE_COMBAT_DISTANCE_SQ = CLOSE_RANGE_COMBAT_DISTANCE * CLOSE_RANGE_COMBAT_DISTANCE |
static const float | LONG_RANGE_COMBAT_DISTANCE = 280.0 |
Beyond this distance AI considers combat as 'long range', used for danger events and firing times. | |
Protected Member Functions | |
void | EvaluateDismountTurret (float timeSliceMs) |
void | Event_OnInventoryChanged (IEntity item, BaseInventoryStorageComponent storageOwner) |
void | Event_OnTimerAfterInventoryChanged () |
void | Event_OnCompartmentEntered (IEntity vehicle, BaseCompartmentManagerComponent manager, int mgrID, int slotID) |
void | Event_OnCompartmentLeft (IEntity vehicle, BaseCompartmentManagerComponent manager, int mgrID, int slotID) |
void | Event_OnGadgetStateChanged (IEntity gadget, bool isInHand, bool isOnGround) |
void | Event_OnGadgetFocusStateChanged (IEntity gadget, bool isFocused) |
void | Event_OnDamage (BaseDamageContext damageContext) |
void | Event_OnDamageEffectAdded (notnull SCR_DamageEffect dmgEffect) |
void | InitWeaponTargetSelector (IEntity owner) |
void | RecalculateEquipmentPerceptionFactor () |
Static Protected Attributes | |
static const float | ASSIGNED_TARGETS_SCORE_INCREMENT = 30.0 |
static const float | ENDANGERING_TARGETS_SCORE_INCREMENT = 15.0 |
static const float | TARGET_MAX_LAST_SEEN_DIRECT_ATTACK = 1.6 |
static const float | TARGET_MAX_LAST_SEEN_DIRECT_ATTACK_CLOSE = 4.5 |
static const float | TARGET_MIN_INDIRECT_TRACE_FRACTION_MIN = 0.5 |
Min value of TraceFraction for indirect attacks. | |
static const float | TARGET_MAX_DISTANCE_INFANTRY = 500.0 |
static const float | TARGET_MAX_DISTANCE_VEHICLE = 700.0 |
static const float | TARGET_MAX_DISTANCE_DISARMED = 0.0 |
Max distance at which disarmed targets are considered for attack. | |
static const float | TARGET_MAX_TIME_SINCE_ENDANGERED = 5.0 |
Max time since we were endangered to consider the enemy target endangering. | |
static const float | TARGET_SCORE_RETREAT = 75.0 |
Threshold for target score for retreating from that target. | |
static ref array< EWeaponType > | s_aWeaponBlacklistFragGrenades = {EWeaponType.WT_FRAGGRENADE} |
const float | PERCEPTION_FACTOR_SAFE = 1.0 |
We are safe and are good at recognising enemies. | |
const float | PERCEPTION_FACTOR_VIGILANT = 2.5 |
When vigilant and alert we are very good at recognising enemies. | |
const float | PERCEPTION_FACTOR_ALERTED = 2.5 |
const float | PERCEPTION_FACTOR_THREATENED = 0.4 |
const float | PERCEPTION_FACTOR_EQUIPMENT_BINOCULARS = 3.0 |
Looking through binoculars. | |
const float | PERCEPTION_FACTOR_EQUIPMENT_NONE = 1.0 |
Not using any special equipment, same recognition ability as usual. | |
const float | FRAG_GRENADE_MAX_THREAT = 0.6 |
const float | WEAPON_TARGET_UPDATE_PERIOD_MS = 500 |
static const float | DISMOUNT_TURRET_TARGET_LAST_SEEN_MAX_S = 100 |
static const float | TURRET_TARGET_EXCESS_ANGLE_THRESHOLD_DEG = 3.0 |
We will dismount turret when target's angle exceeds turret limits by this value. | |
const float | DISMOUNT_TURRET_TIMER_MS = 1200 |
How much time must pass until we decide to dismount a turret if enemy is out of turret limits. | |
static ref array< EVehicleType > | s_aForbidDismountTurretsOfVehicleTypes = { EVehicleType.APC } |
Array of vehicle types we should not dismount when turret cannot shoot the target. | |
static const float | DISTANCE_MAX = 22 |
static const float | DISTANCE_MIN = 6 |
const float | m_StopDistance = 30 + Math.RandomFloat(0, 10) |
void SCR_AICombatComponent.~SCR_AICombatComponent | ( | ) |
void SCR_AICombatComponent.DebugPrintToWidget | ( | TextWidget | w | ) |
Used by AIDebugInfoComponent.
bool SCR_AICombatComponent.DismountTurretCondition | ( | inout vector | targetPos, |
bool | targetPosProvided | ||
) |
Condition to dismount turret Returns true when we should dismount it immediately.
[in,out] | targetPos | |
[in] | targetPosProvided |
override void SCR_AICombatComponent.EOnInit | ( | IEntity | owner | ) |
|
protected |
void SCR_AICombatComponent.EvaluateExpectedWeapon | ( | out BaseWeaponComponent | outWeaponComp, |
out int | outMuzzleId, | ||
out BaseMagazineComponent | outMagazineComp | ||
) |
Returns weapon which combat component thinks is expected to be used this situation This should be used for selecting fallback weapon in a situation without an actively attacked target.
[out] | outWeaponComp | |
[out] | outMuzzleId | |
[out] | outMagazineComp |
bool SCR_AICombatComponent.EvaluateLowAmmo | ( | BaseWeaponComponent | weaponComp, |
int | muzzleId | ||
) |
Checks amount of magazines for given weapon, and if low on ammo, reports that to group.
[in] | weaponComp | |
[in] | muzzleId |
void SCR_AICombatComponent.EvaluateSuppressionWeapon | ( | EAIUnitType | targetUnitType, |
float | distanceToTarget, | ||
out BaseWeaponComponent | outWeaponComp, | ||
out int | outMuzzleId, | ||
out BaseMagazineComponent | outMagazineComp | ||
) |
Returns optimal weapon which can be used for suppressing target of given type at given range.
This will first of all return weapons which are configured in prefabs to cause indirect damage.
void SCR_AICombatComponent.EvaluateWeaponAndTarget | ( | out bool | outWeaponEvent, |
out bool | outSelectedTargetChanged, | ||
out BaseTarget | outPrevTarget, | ||
out BaseTarget | outCurrentTarget, | ||
out bool | outRetreatTargetChanged, | ||
out bool | outCompartmentChanged | ||
) |
[out] | outWeaponEvent | when true, selected weapon, muzzle or magazine has changed |
[out] | outSelectedTargetChanged | when true, selected target has changed |
[out] | outPrevTarget | |
[out] | outCurrentTarget | |
[out] | outRetreatTargetChanged | when true, the most dangerous target we should retreat from has changed since last evaluation |
[out] | outCompartmentChanged | when true, compartment has changed since last evaluation |
|
protected |
[in] | vehicle | |
[in] | manager | |
[in] | mgrID | |
[in] | slotID |
|
protected |
[in] | vehicle | |
[in] | manager | |
[in] | mgrID | |
[in] | slotID |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
vector SCR_AICombatComponent.FindNextCoverPosition | ( | ) |
BaseTarget SCR_AICombatComponent.FindTargetByEntity | ( | IEntity | ent | ) |
[in] | ent |
BaseWeaponComponent SCR_AICombatComponent.FindWeaponOfType | ( | EWeaponType | weaponType | ) |
[in] | weaponType |
SCR_ChimeraAIAgent SCR_AICombatComponent.GetAiAgent | ( | ) |
SCR_AIInfoComponent SCR_AICombatComponent.GetAIInfoComponent | ( | ) |
EAISkill SCR_AICombatComponent.GetAISkill | ( | ) |
EAICombatActions SCR_AICombatComponent.GetAllowedActions | ( | ) |
EAICombatType SCR_AICombatComponent.GetCombatType | ( | ) |
BaseTarget SCR_AICombatComponent.GetCurrentTarget | ( | ) |
BaseWeaponComponent SCR_AICombatComponent.GetCurrentWeapon | ( | ) |
EWeaponType SCR_AICombatComponent.GetCurrentWeaponType | ( | bool | overrideWithMuzzle = false | ) |
BaseTarget SCR_AICombatComponent.GetEndangeringEnemy | ( | ) |
float SCR_AICombatComponent.GetFireRateCoef | ( | ) |
BaseTarget SCR_AICombatComponent.GetLastSeenEnemy | ( | ) |
int SCR_AICombatComponent.GetMagazineCount | ( | TypeName | magazineWell, |
bool | countMagazineInWeapon = false |
||
) |
[in] | magazineWell | |
[in] | countMagazineInWeapon |
BaseTarget SCR_AICombatComponent.GetRetreatTarget | ( | ) |
void SCR_AICombatComponent.GetSelectedWeapon | ( | out BaseWeaponComponent | outWeaponComp, |
out int | outMuzzleId | ||
) |
[out] | outWeaponComp | |
[out] | outMuzzleId |
void SCR_AICombatComponent.GetSelectedWeaponAndMagazine | ( | out BaseWeaponComponent | outWeaponComp, |
out int | outMuzzleId, | ||
out BaseMagazineComponent | outMagazineComp | ||
) |
Getters which return the weapon which combat component thinks is best against current target If there is no current target, then there is no selected weapon as well! In that case use GetExpectedWeapon.
[out] | outWeaponComp | |
[out] | outMuzzleId | |
[out] | outMagazineComp |
bool SCR_AICombatComponent.GetSelectedWeaponDirectDamage | ( | ) |
float SCR_AICombatComponent.GetSelectedWeaponMaxDist | ( | ) |
float SCR_AICombatComponent.GetSelectedWeaponMinDist | ( | ) |
void SCR_AICombatComponent.GetSelectedWeaponProperties | ( | out float | outMinDistance, |
out float | outMaxDistance, | ||
out bool | outDirectDamage | ||
) |
[out] | outMinDistance | |
[out] | outMaxDistance | |
[out] | outDirectDamage |
ResourceName SCR_AICombatComponent.GetSelectedWeaponResource | ( | ) |
EWeaponType SCR_AICombatComponent.GetSelectedWeaponType | ( | ) |
vector SCR_AICombatComponent.GetTargetDestinationPos | ( | ) |
EAIUnitType SCR_AICombatComponent.GetUnitTypesCanAttack | ( | ) |
int SCR_AICombatComponent.GetWeaponLowMagThreshold | ( | BaseWeaponComponent | weapon | ) |
bool SCR_AICombatComponent.HasWeaponOfType | ( | EWeaponType | weaponType | ) |
[in] | weaponType |
|
protected |
bool SCR_AICombatComponent.IsActionAllowed | ( | EAICombatActions | action | ) |
[in] | action |
bool SCR_AICombatComponent.IsEnemyKnown | ( | IEntity | ent | ) |
[in] | ent |
bool SCR_AICombatComponent.IsFriendlyInAim | ( | ) |
bool SCR_AICombatComponent.IsTargetVisible | ( | notnull BaseTarget | target | ) |
Checks if given target can be considered visible.
[in] | target |
override void SCR_AICombatComponent.OnDelete | ( | IEntity | owner | ) |
override void SCR_AICombatComponent.OnPostInit | ( | IEntity | owner | ) |
|
protected |
void SCR_AICombatComponent.ResetAISkill | ( | ) |
use this to reset AI skill to default
void SCR_AICombatComponent.ResetAssignedTargets | ( | ) |
void SCR_AICombatComponent.ResetCombatType | ( | ) |
void SCR_AICombatComponent.ResetExpectedEnemyType | ( | ) |
void SCR_AICombatComponent.SetAISkill | ( | EAISkill | skill | ) |
Use this to change AIskill dynamically.
[in] | skill |
void SCR_AICombatComponent.SetAssignedTargets | ( | array< IEntity > | assignedTargets, |
SCR_AITargetClusterState | clusterState | ||
) |
Either array of targets or target cluster must be provided.
[in] | assignedTargets | |
[in] | clusterState |
void SCR_AICombatComponent.SetCombatType | ( | EAICombatType | combatType | ) |
[in] | combatType |
void SCR_AICombatComponent.SetDefaultCombatType | ( | EAICombatType | combatType | ) |
When AI use reset e.g.
after bounding overwatch it is resetted to default combat type You have to also call SetCombatType to have immediate effect.
[in] | combatType |
void SCR_AICombatComponent.SetExpectedEnemyType | ( | EAIUnitType | expectedEnemyType | ) |
[in] | expectedEnemyType |
void SCR_AICombatComponent.SetFireRateCoef | ( | float | coef = 1 , |
bool | persistent = false |
||
) |
void SCR_AICombatComponent.SetGroupFireRateCoef | ( | float | coef = 1 , |
bool | overridePersistent = false |
||
) |
void SCR_AICombatComponent.SetGroupSuppressClusterState | ( | SCR_AITargetClusterState | state | ) |
void SCR_AICombatComponent.SetHoldFire | ( | bool | isHoldFire | ) |
[in] | isHoldFire |
void SCR_AICombatComponent.SetPerceptionFactor | ( | float | value | ) |
Sets perception ability.
Affects speed at which perception detects targets. Bigger value means proportionally faster detection. Provided value must be non-negative !!! Now it only affects visual detection.
[in] | value |
void SCR_AICombatComponent.SetTargetSelectionProperties | ( | bool | closeCombat | ) |
void SCR_AICombatComponent.TryAddDismountTurretActions | ( | vector | targetPos, |
bool | addGetOut = true , |
||
bool | addInvestigate = true , |
||
bool | addGetIn = true |
||
) |
Adds action to dismount turret, investigate, and go back.
[in] | targetPos | |
[in] | addGetOut | |
[in] | addInvestigate | |
[in] | addGetIn |
void SCR_AICombatComponent.Update | ( | float | timeSliceMs | ) |
[in] | timeSliceMs |
void SCR_AICombatComponent.UpdateLastSeenPosition | ( | IEntity | entity, |
notnull SCR_AITargetInfo | targetInfo | ||
) |
[in] | entity | |
[in] | targetInfo |
void SCR_AICombatComponent.UpdateLastSeenPosition | ( | notnull BaseTarget | tgt, |
notnull SCR_AITargetInfo | targetInfo | ||
) |
[in] | tgt | |
[in] | targetInfo |
void SCR_AICombatComponent.UpdatePerceptionFactor | ( | PerceptionComponent | perceptionComp, |
SCR_AIThreatSystem | threatSystem | ||
) |
[in] | perceptionComp | |
[in] | threatSystem |
|
staticprotected |
|
static |
Within this distance AI considers combat as 'close range', used in firing times.
|
static |
|
staticprotected |
|
staticprotected |
How much time must pass until we decide to dismount a turret if enemy is out of turret limits.
|
staticprotected |
|
staticprotected |
|
static |
Multiplier of target score if target is considered endangering.
|
staticprotected |
|
staticprotected |
|
static |
Beyond this distance AI considers combat as 'long range', used for danger events and firing times.
|
protected |
Array with assigned targets.
Their score is increased.
|
protected |
|
protected |
|
protected |
True if we're exiting vehicle because of damage/fire.
|
protected |
|
protected |
True when we are in gadget focus mode (like looking through binoculars)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Current compartment slot.
|
protected |
Current turret controller (if we are in a turret)
|
protected |
Current vehicle.
It's not always same as compartment owner!
|
protected |
Vehicle's compartment manager.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Gadget state.
Used for detection when we use binoculars.
|
protected |
|
protected |
Enemy type we expect to fight.
|
protected |
|
protected |
|
protected |
How good we can spot targets based on our current equipment.
Updated by RecalculateEquipmentPerceptionFactor().
|
protected |
|
protected |
|
protected |
Perception factor which is set by SetPerceptionFactor().
It acts as multiplier.
|
protected |
|
protected |
|
protected |
|
protected |
will be initialised with default combat type
|
protected |
|
protected |
|
protected |
|
protected |
Character might currently have a different one though.
|
protected |
Target we should retreat from.
|
protected |
|
protected |
|
protected |
Weapon, muzzle and magazine which we want to equip.
|
protected |
selected weapon handle tree read from config
|
staticprotected |
|
protected |
Assigned target cluster from our group.
|
protected |
|
protected |
Compartment at previous weapon evaluation.
ref AIWeaponTargetSelector SCR_AICombatComponent.m_WeaponTargetSelector = new AIWeaponTargetSelector() |
|
protected |
|
staticprotected |
|
staticprotected |
Looking through binoculars.
|
staticprotected |
Not using any special equipment, same recognition ability as usual.
|
staticprotected |
We are safe and are good at recognising enemies.
|
staticprotected |
|
staticprotected |
When vigilant and alert we are very good at recognising enemies.
|
staticprotected |
Array of vehicle types we should not dismount when turret cannot shoot the target.
|
staticprotected |
|
static |
How long after last time target was endangering we stop treating it as such.
|
staticprotected |
Max distance at which disarmed targets are considered for attack.
Now it's 0, so they never shoot disarmed targets
|
staticprotected |
|
staticprotected |
|
static |
|
staticprotected |
|
staticprotected |
|
static |
|
static |
|
static |
|
static |
'IsTargetVisible' variable in attack tree relies on this
|
staticprotected |
Max time since we were endangered to consider the enemy target endangering.
|
staticprotected |
Min value of TraceFraction for indirect attacks.
|
static |
|
static |
Threshold for high priority attack.
|
staticprotected |
Threshold for target score for retreating from that target.
|
staticprotected |
We will dismount turret when target's angle exceeds turret limits by this value.
|
staticprotected |