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_AIBehavior.c
Go to the documentation of this file.
1
enum
SCR_EAIBehaviorCause
2
{
3
SAFE
= 10,
// There's nothing better to do and we are safe
4
SELF_AID
= 20,
// Minor actions related to caring about ourselves
5
GROUP_GOAL
= 30,
// Doing something on behalf of group
6
DANGER_LOW
= 40,
// Reacting to dangers of not immediate potential death, like gunshots
7
COMBAT
= 50,
// Combat related behaviors
8
DANGER_MEDIUM
= 60,
// Avoiding non-immediate certain death (healing injury)
9
DANGER_HIGH
= 70,
// Avoiding immediate certain death (car, grenade)
10
ALWAYS
= 1000
// Special value for settings to run in all behaviors
11
}
12
13
class
SCR_AIBehaviorBase
: SCR_AIActionBase
14
{
15
SCR_AIUtilityComponent
m_Utility
;
16
17
float
m_fThreat
= 0.0;
// This threat value will be added to the calculated threat level in threat system
18
bool
m_bAllowLook
=
true
;
19
bool
m_bResetLook
=
false
;
20
bool
m_bUseCombatMove
=
false
;
21
22
//---------------------------------------------------------------------------------------------------------------------------------
23
void
SCR_AIBehaviorBase
(SCR_AIUtilityComponent utility,
SCR_AIActivityBase
groupActivity)
24
{
25
m_Utility
= utility;
26
SetRelatedGroupActivity(groupActivity);
27
if
(groupActivity)
28
groupActivity.OnChildBehaviorCreated(
this
);
29
}
30
31
//---------------------------------------------------------------------------------------------------------------------------------
32
SCR_AIActivityBase
GetGroupActivityContext
()
33
{
34
return
SCR_AIActivityBase
.Cast(GetRelatedGroupActivity());
35
}
36
37
//---------------------------------------------------------------------------------------------------------------------------------
38
override
void
OnActionSelected
()
39
{
40
super.OnActionSelected();
41
if
(
m_bResetLook
)
42
m_Utility
.m_LookAction.Cancel();
43
}
44
45
//---------------------------------------------------------------------------------------------------------------------------------
46
#ifdef AI_DEBUG
47
override
protected
void
AddDebugMessage(
string
str)
48
{
49
if
(!
m_Utility
)
50
return
;
51
52
AIAgent ownerAgent =
m_Utility
.GetOwner();
53
if
(!ownerAgent)
54
return
;
55
56
SCR_AIInfoBaseComponent infoComp = SCR_AIInfoBaseComponent.Cast(ownerAgent.FindComponent(SCR_AIInfoBaseComponent));
57
if
(!infoComp)
58
return
;
59
60
infoComp.AddDebugMessage(
string
.Format(
"%1: %2"
,
this
, str), msgType:
EAIDebugMsgType
.ACTION);
61
}
62
#endif
63
64
//---------------------------------------------------------------------------------------------------------------------------------
65
override
void
OnActionFailed
()
66
{
67
super.OnActionFailed();
68
SCR_AIActivityBase
relatedActivity =
SCR_AIActivityBase
.Cast(GetRelatedGroupActivity());
69
if
(relatedActivity)
70
relatedActivity.OnChildBehaviorFinished(
this
);
71
}
72
73
//----------------------------------------------------------------------------------------------------------------------------------
74
override
void
OnActionCompleted
()
75
{
76
super.OnActionCompleted();
77
SCR_AIActivityBase
relatedActivity =
SCR_AIActivityBase
.Cast(GetRelatedGroupActivity());
78
if
(relatedActivity)
79
relatedActivity.OnChildBehaviorFinished(
this
);
80
}
81
82
};
83
84
//---------------------------------------------------------------------------------------------------------------------------------
85
class
SCR_AIWaitBehavior :
SCR_AIBehaviorBase
86
{
87
void
SCR_AIWaitBehavior(SCR_AIUtilityComponent utility,
SCR_AIActivityBase
groupActivity)
88
{
89
m_sBehaviorTree
=
"AI/BehaviorTrees/Chimera/Soldier/Wait.bt"
;
90
SetPriority(PRIORITY_BEHAVIOR_WAIT);
91
}
92
93
//---------------------------------------------------------------------------------------------------------------------------------
94
override
int
GetCause
()
95
{
96
return
SCR_EAIBehaviorCause
.SAFE;
97
}
98
};
99
100
//---------------------------------------------------------------------------------------------------------------------------------
101
class
SCR_AIIdleBehavior :
SCR_AIBehaviorBase
102
{
103
void
SCR_AIIdleBehavior(SCR_AIUtilityComponent utility,
SCR_AIActivityBase
groupActivity)
104
{
105
if
(!utility)
106
return
;
107
m_sBehaviorTree
=
"AI/BehaviorTrees/Chimera/Soldier/Idle.bt"
;
108
SetPriority(PRIORITY_BEHAVIOR_IDLE);
109
}
110
111
override
void
OnActionSelected
()
112
{
113
super.OnActionSelected();
114
115
// Temporary solution to make AI select some generic weapon suitable against infantry, like a rifle.
116
m_Utility
.m_CombatComponent.SetExpectedEnemyType(
EAIUnitType
.UnitType_Infantry);
117
}
118
119
//---------------------------------------------------------------------------------------------------------------------------------
120
override
int
GetCause
()
121
{
122
return
SCR_EAIBehaviorCause
.SAFE;
123
}
124
};
OnActionCompleted
void OnActionCompleted()
Definition
SCR_AIAction.c:202
m_sBehaviorTree
ResourceName m_sBehaviorTree
Definition
SCR_AIAction.c:89
OnActionSelected
override void OnActionSelected()
Definition
SCR_AIAction.c:193
OnActionFailed
void OnActionFailed()
Definition
SCR_AIAction.c:205
GetCause
int GetCause()
Definition
SCR_AIAction.c:129
SCR_AIActivityBase
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
Definition
SCR_AIActivity.c:44
m_Utility
enum SCR_EAIActivityCause m_Utility
ALWAYS
@ ALWAYS
Definition
SCR_AIActivity.c:8
SAFE
@ SAFE
Definition
SCR_AIActivity.c:7
m_fThreat
float m_fThreat
Definition
SCR_AIBehavior.c:17
SCR_AIBehaviorBase
void SCR_AIBehaviorBase(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity)
Definition
SCR_AIBehavior.c:23
m_bResetLook
bool m_bResetLook
Definition
SCR_AIBehavior.c:19
m_bUseCombatMove
bool m_bUseCombatMove
Definition
SCR_AIBehavior.c:20
m_Utility
enum SCR_EAIBehaviorCause m_Utility
GetGroupActivityContext
SCR_AIActivityBase GetGroupActivityContext()
Definition
SCR_AIBehavior.c:32
OnActionSelected
override void OnActionSelected()
Definition
SCR_AIBehavior.c:38
SCR_EAIBehaviorCause
SCR_EAIBehaviorCause
Definition
SCR_AIBehavior.c:2
DANGER_LOW
@ DANGER_LOW
Definition
SCR_AIBehavior.c:6
DANGER_MEDIUM
@ DANGER_MEDIUM
Definition
SCR_AIBehavior.c:8
GROUP_GOAL
@ GROUP_GOAL
Definition
SCR_AIBehavior.c:5
COMBAT
@ COMBAT
Definition
SCR_AIBehavior.c:7
SELF_AID
@ SELF_AID
Definition
SCR_AIBehavior.c:4
DANGER_HIGH
@ DANGER_HIGH
Definition
SCR_AIBehavior.c:9
m_bAllowLook
bool m_bAllowLook
Definition
SCR_AIBehavior.c:18
EAIDebugMsgType
EAIDebugMsgType
Definition
SCR_AIDebugMessage.c:2
EAIUnitType
EAIUnitType
Definition
EAIUnitType.c:13
scripts
Game
AI
Behavior
SCR_AIBehavior.c
Generated by
1.17.0