Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AIRetreatBehavior.c
Go to the documentation of this file.
1
class
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
//----------------------------------------------------------------------------------------------------------------------------------------------------------
55
class
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
87
class
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
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
m_fPriorityLevel
ref SCR_BTParam< float > m_fPriorityLevel
Definition
SCR_AIAction.c:87
PRIORITY_LEVEL_NORMAL
enum EAIActionFailReason PRIORITY_LEVEL_NORMAL
GetPortNames
TStringArray GetPortNames()
Definition
SCR_AIAction.c:238
m_sBehaviorTree
ResourceName m_sBehaviorTree
Definition
SCR_AIAction.c:89
GetCause
int GetCause()
Definition
SCR_AIAction.c:129
Fail
void Fail(bool doNotCompleteWaypoint)
Definition
SCR_AIActivity.c:75
SCR_AIActivityBase
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
Definition
SCR_AIActivity.c:44
SCR_AIBehaviorBase
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
Definition
SCR_AIBehavior.c:23
SCR_EAIBehaviorCause
SCR_EAIBehaviorCause
Definition
SCR_AIBehavior.c:2
GetVariablesOut
override TStringArray GetVariablesOut()
Definition
SCR_AIFindFirePositionBehavior.c:133
CustomEvaluate
override float CustomEvaluate()
Definition
SCR_AIMoveFromDanger.c:135
BaseTarget
Definition
BaseTarget.c:13
SCR_AIGetActionParameters
Definition
SCR_AIGetActionParameters.c:23
SCR_AIGetActionParameters::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AIGetActionParameters.c:38
SCR_AIRetreatFromTargetBehavior
Definition
SCR_AIRetreatBehavior.c:56
vector
Definition
vector.c:13
GetPriority
int GetPriority()
Definition
SCR_BaseManualCameraComponent.c:247
ETargetCategory
ETargetCategory
Definition
ETargetCategory.c:13
TStringArray
array< string > TStringArray
Definition
Types.c:385
scripts
Game
AI
Behavior
SCR_AIRetreatBehavior.c
Generated by
1.17.0