Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIRetreatBehavior.c
Go to the documentation of this file.
1class SCR_AIRetreatWhileLookAtBehavior : SCR_AIBehaviorBase
2{
3 ref SCR_BTParamAssignable<vector> m_Target = new SCR_BTParamAssignable<vector>("RetreatToPoint");
4 ref SCR_BTParamAssignable<vector> m_LookAt = new SCR_BTParamAssignable<vector>("LookAt");
5
6 bool m_TimeSet = false;
7 float m_Timestamp = 0;
8 const float m_MaxTime = 3;
9
10 //---------------------------------------------------------------------------------------------------------------------------------
11 void SCR_AIRetreatWhileLookAtBehavior(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, float priorityLevel = PRIORITY_LEVEL_NORMAL)
12 {
13 vector tempPos;
14 m_Target.Init(this, tempPos);
15 m_LookAt.Init(this, tempPos);
16
17 m_sBehaviorTree = "{9673533977BD9950}AI/BehaviorTrees/Chimera/Soldier/RetreatWhileLookAt.bt";
18 SetPriority(PRIORITY_BEHAVIOR_RETREAT_MELEE);
19 m_fPriorityLevel.m_Value = priorityLevel;
20 }
21
22 //---------------------------------------------------------------------------------------------------------------------------------
23 override int GetCause()
24 {
25 return SCR_EAIBehaviorCause.COMBAT;
26 }
27
28 //---------------------------------------------------------------------------------------------------------------------------------
29 override float CustomEvaluate()
30 {
31 if(!m_TimeSet)
32 {
33 m_Timestamp = GetGame().GetWorld().GetWorldTime();
34 m_TimeSet = true;
35 }
36
37 //get timeslice
38 float current = GetGame().GetWorld().GetWorldTime();
39
40 float secondsPassed = (current - m_Timestamp)/1000;
41
42 //if the timer has passed, call Fail()
43 if(secondsPassed >= m_MaxTime)
44 {
45 Fail();
46 }
47
48 return GetPriority();
49 }
50};
51
52
53
54//----------------------------------------------------------------------------------------------------------------------------------------------------------
55class SCR_AIRetreatFromTargetBehavior : SCR_AIBehaviorBase
56{
57 ref SCR_BTParamRef<BaseTarget> m_RetreatFromTarget = new SCR_BTParamRef<BaseTarget>("RetreatFromTarget");
58
59 //---------------------------------------------------------------------------------------------------------------------------------
60 void SCR_AIRetreatFromTargetBehavior(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, notnull BaseTarget retreatFromTarget, float priorityLevel = PRIORITY_LEVEL_NORMAL)
61 {
62 m_RetreatFromTarget.Init(this, retreatFromTarget);
63 m_sBehaviorTree = "{91B8D5FDB60C1C80}AI/BehaviorTrees/Chimera/Soldier/RetreatFromTarget.bt";
64 SetPriority(PRIORITY_BEHAVIOR_RETREAT_FROM_TARGET);
65 m_fPriorityLevel.m_Value = priorityLevel;
66 }
67
68 //---------------------------------------------------------------------------------------------------------------------------------
69 override int GetCause()
70 {
71 return SCR_EAIBehaviorCause.COMBAT;
72 }
73
74 //---------------------------------------------------------------------------------------------------------------------------------
75 override float CustomEvaluate()
76 {
77 if (m_RetreatFromTarget.m_Value.GetTargetCategory() != ETargetCategory.ENEMY)
78 {
79 Complete();
80 return 0;
81 }
82 else
83 return GetPriority();
84 }
85}
86
87class SCR_AIGetRetreatFromTargetBehaviorParameters: SCR_AIGetActionParameters
88{
89 static ref TStringArray s_aVarsOut = (new SCR_AIRetreatFromTargetBehavior(null, null, null)).GetPortNames();
90 override TStringArray GetVariablesOut() { return s_aVarsOut; }
91
92 static override bool VisibleInPalette() { return true; }
93};
ArmaReforgerScripted GetGame()
Definition game.c:1398
ref SCR_BTParam< float > m_fPriorityLevel
enum EAIActionFailReason PRIORITY_LEVEL_NORMAL
TStringArray GetPortNames()
ResourceName m_sBehaviorTree
int GetCause()
void Fail(bool doNotCompleteWaypoint)
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
SCR_EAIBehaviorCause
override TStringArray GetVariablesOut()
override float CustomEvaluate()
static override bool VisibleInPalette()
ETargetCategory
array< string > TStringArray
Definition Types.c:385