Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIMoveBehavior.c
Go to the documentation of this file.
2 {
3  ref SCR_BTParam<vector> m_vPosition = new SCR_BTParam<vector>(SCR_AIActionTask.POSITION_PORT);
4 
5  //-----------------------------------------------------------------------------------------------------
6  void SCR_AIMoveBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, vector pos, float priority = PRIORITY_BEHAVIOR_MOVE, float priorityLevel = PRIORITY_LEVEL_NORMAL)
7  {
8  m_vPosition.Init(this, pos);
9  SetPriority(priority);
10  m_fPriorityLevel.m_Value = priorityLevel;
11  }
12 };
13 
14 //-----------------------------------------------------------------------------------------------------
16 {
17  //-----------------------------------------------------------------------------------------------------
18  void SCR_AIMoveInFormationBehavior(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, vector pos, float priority = PRIORITY_BEHAVIOR_MOVE_IN_FORMATION, float priorityLevel = PRIORITY_LEVEL_NORMAL)
19  {
20  m_sBehaviorTree = "AI/BehaviorTrees/Chimera/Soldier/KeepInFormation.bt";
21  if (priorityLevel > 0)
22  {
23  m_bAllowLook = false;
24  m_bResetLook = true;
25  }
26  }
27 };
28 
29 //-----------------------------------------------------------------------------------------------------
31 {
32  ref SCR_BTParamAssignable<IEntity> m_Entity = new SCR_BTParamAssignable<IEntity>(SCR_AIActionTask.ENTITY_PORT);
33  ref SCR_BTParamAssignable<float> m_Radius = new SCR_BTParamAssignable<float>(SCR_AIActionTask.RADIUS_PORT);
34 
35  //-----------------------------------------------------------------------------------------------------
36  void SCR_AIMoveIndividuallyBehavior(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, vector pos, float priority = PRIORITY_BEHAVIOR_MOVE_INDIVIDUALLY, float priorityLevel = PRIORITY_LEVEL_NORMAL, IEntity ent = null, float radius = 1.0)
37  {
38  m_sBehaviorTree = "AI/BehaviorTrees/Chimera/Soldier/MoveIndividually.bt";
39  m_Entity.Init(this, ent);
40  if (ent)
41  m_vPosition.m_Value = ent.GetOrigin();
42  m_Radius.Init(this, radius);
43  }
44 
45  //-----------------------------------------------------------------------------------------------------
46  override string GetActionDebugInfo()
47  {
48  return this.ToString() + " moving to " + m_vPosition.ValueToString();
49  }
50 };
51 
52 //-----------------------------------------------------------------------------------------------------
54 {
55  ref SCR_BTParam<bool> m_bIsDangerous = new SCR_BTParam<bool>(SCR_AIActionTask.IS_DANGEROUS_PORT);
56  ref SCR_BTParam<float> m_fRadius = new SCR_BTParam<float>(SCR_AIActionTask.RADIUS_PORT);
57  ref SCR_BTParam<bool> m_bResetTimer = new SCR_BTParam<bool>(SCR_AIActionTask.RESET_TIMER_PORT);
58  ref SCR_BTParam<float> m_fTimeOut = new SCR_BTParam<float>(SCR_AIActionTask.TIMEOUT_PORT);
59  ref SCR_BTParam<float> m_fDuration = new SCR_BTParam<float>("Duration"); // How much to investigate once we have arrived
60 
61  EAIUnitType m_eTargetUnitType;
62  float m_fTimeStamp; // world time when constructor of behavior is called
63  bool m_bCanTimeout = true; // can timeout when not executed?
64  protected static const float INVESTIGATION_TIMEOUT_MS = 20000; // how long it can take NOT to investigate before the investigation becomes obsolete in ms
65 
66  //-----------------------------------------------------------------------------------------------------
67  void SCR_AIMoveAndInvestigateBehavior(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, vector pos, float priority = PRIORITY_BEHAVIOR_MOVE_AND_INVESTIGATE, float priorityLevel = PRIORITY_LEVEL_NORMAL, float radius = 10, bool isDangerous = true, EAIUnitType targetUnitType = EAIUnitType.UnitType_Infantry, float duration = 10.0)
68  {
69  m_bIsDangerous.Init(this, isDangerous);
70  m_fRadius.Init(this, radius);
71  m_bResetTimer.Init(this, false);
72  //m_fTimeOut.Init(this, Math.RandomFloat(20,50));
73  m_fTimeOut.Init(this, 5.0 * 60.0); // For now it's a reasonable long enough time
74  m_fDuration.Init(this, Math.RandomFloat(0.8*duration, 1.2*duration));
75  m_eTargetUnitType = targetUnitType;
76 
77  m_sBehaviorTree = "AI/BehaviorTrees/Chimera/Soldier/MoveAndInvestigate.bt";
78  if (m_Utility)
79  {
80  // marking time of creation of this move and investigate (world time)
81  m_fTimeStamp = GetGame().GetWorld().GetWorldTime();
82  }
83 
84  // If target is dangerous, during execution of this action we will increase our threat level
85  // Aim of this is to be in alerted state through the action, so that when we encounter enemy again,
86  // We are not 'surprised' by enemy and there will be no extra delay added
87  if (isDangerous)
88  m_fThreat = 1.01 * SCR_AIThreatSystem.VIGILANT_THRESHOLD;
89  }
90 
91  //-----------------------------------------------------------------------------------------------------
92  override void OnActionSelected()
93  {
94  super.OnActionSelected();
95  m_bCanTimeout = false;
96  m_Utility.m_CombatComponent.SetExpectedEnemyType(m_eTargetUnitType);
97  }
98 };
99 
100 //-----------------------------------------------------------------------------------------------------
102 {
103  protected static ref TStringArray s_aVarsIn = (new SCR_AIMoveAndInvestigateBehavior(null, null, vector.Zero)).GetPortNames();
104  override TStringArray GetVariablesIn() { return s_aVarsIn; }
105  override bool VisibleInPalette() { return true; }
106 };
m_fDuration
float m_fDuration
Definition: SendGoalMessage.c:437
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
m_bIsDangerous
bool m_bIsDangerous
Definition: SendGoalMessage.c:431
m_fPriorityLevel
float m_fPriorityLevel
Definition: SendGoalMessage.c:3
m_Entity
enum EAITargetInfoCategory m_Entity
SCR_AIMoveInFormationBehavior
Definition: SCR_AIMoveBehavior.c:15
SCR_AIActivityBase
Definition: SCR_AIActivity.c:1
SCR_AISetInvestigateBehaviorParameters
Definition: SCR_AIMoveBehavior.c:101
m_fRadius
float m_fRadius
Definition: SCR_AITargetClusterState.c:30
EAIUnitType
EAIUnitType
Definition: EAIUnitType.c:12
SCR_AISetActionParameters
Definition: SCR_AISetActionParameters.c:7
SCR_AIMoveIndividuallyBehavior
Definition: SCR_AIMoveBehavior.c:30
m_vPosition
vector m_vPosition
Definition: SCR_AITalkRequest.c:23
SCR_AIMoveBehaviorBase
Definition: SCR_AIMoveBehavior.c:1
SCR_AIActionTask
Definition: SCR_AIBehaviorTask.c:1
SCR_AIBehaviorBase
Definition: SCR_AIBehavior.c:1
SCR_AIMoveAndInvestigateBehavior
Definition: SCR_AIMoveBehavior.c:53
SCR_AIThreatSystem
Definition: SCR_AIThreatSystem.c:17
m_eTargetUnitType
EAIUnitType m_eTargetUnitType
Definition: SendGoalMessage.c:434