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_AIVehicleBehavior.c
Go to the documentation of this file.
1
enum
EAICompartmentType
2
{
3
None = -1,
4
Pilot
,
5
Turret
,
6
Cargo
,
7
}
8
9
class
SCR_AIVehicleBehavior
:
SCR_AIBehaviorBase
10
{
11
ref SCR_BTParam<IEntity>
m_Vehicle
=
new
SCR_BTParam<IEntity>(
SCR_AIActionTask
.ENTITY_PORT);
12
13
//------------------------------------------------------------------------------------------------
14
void
SCR_AIVehicleBehavior
(SCR_AIUtilityComponent utility,
SCR_AIActivityBase
groupActivity,
IEntity
vehicleEntity)
15
{
16
m_Vehicle
.Init(
m_aParams
, vehicleEntity);
17
}
18
19
//---------------------------------------------------------------------------------------------------------------------------------
20
override
int
GetCause
()
21
{
22
// Most of the time we get into vehicle because group told so
23
return
SCR_EAIBehaviorCause
.GROUP_GOAL;
24
}
25
26
//------------------------------------------------------------------------------------------------
27
override
void
OnActionSelected
()
28
{
29
super.OnActionSelected();
30
m_Utility
.m_AIInfo.SetAIState(EUnitAIState.BUSY);
31
}
32
33
//------------------------------------------------------------------------------------------------
34
override
void
OnActionCompleted
()
35
{
36
m_Utility
.m_AIInfo.SetAIState(EUnitAIState.AVAILABLE);
37
super.OnActionCompleted();
38
}
39
40
//------------------------------------------------------------------------------------------------
41
override
void
OnActionFailed
()
42
{
43
m_Utility
.m_AIInfo.SetAIState(EUnitAIState.AVAILABLE);
44
super.OnActionFailed();
45
}
46
};
47
48
class
SCR_AIGetInVehicle :
SCR_AIVehicleBehavior
49
{
50
ref SCR_BTParam<EAICompartmentType> m_eRoleInVehicle =
new
SCR_BTParam<EAICompartmentType>(
SCR_AIActionTask
.ROLEINVEHICLE_PORT);
51
ref SCR_BTParam<BaseCompartmentSlot> m_CompartmentToGetIn =
new
SCR_BTParam<BaseCompartmentSlot>(
SCR_AIActionTask
.COMPARTMENT_PORT);
52
53
//------------------------------------------------------------------------------------------------
54
void
SCR_AIGetInVehicle(SCR_AIUtilityComponent utility,
SCR_AIActivityBase
groupActivity,
IEntity
vehicleEntity,
BaseCompartmentSlot
compartmentSlot,
EAICompartmentType
roleInVehicle =
EAICompartmentType
.Cargo,
float
priority = PRIORITY_BEHAVIOR_GET_IN_VEHICLE,
float
priorityLevel =
PRIORITY_LEVEL_NORMAL
)
55
{
56
m_CompartmentToGetIn.Init(
this
, compartmentSlot);
57
m_eRoleInVehicle.Init(
this
, roleInVehicle);
58
m_sBehaviorTree
=
"AI/BehaviorTrees/Chimera/Soldier/GetInVehicle.bt"
;
59
SetPriority(priority);
60
m_fPriorityLevel
.m_Value = priorityLevel;
61
}
62
63
//------------------------------------------------------------------------------------------------
64
override
void
OnActionCompleted
()
65
{
66
if
(m_CompartmentToGetIn.m_Value)
67
{
68
m_CompartmentToGetIn.m_Value.SetCompartmentAccessible(
true
);
69
m_CompartmentToGetIn.m_Value.SetReserved(null);
70
};
71
super.OnActionCompleted();
72
}
73
74
//------------------------------------------------------------------------------------------------
75
override
void
OnActionFailed
()
76
{
77
if
(m_CompartmentToGetIn.m_Value)
78
{
79
ChimeraCharacter
chimchar =
ChimeraCharacter
.Cast(
m_Utility
.m_OwnerEntity);
80
CompartmentAccessComponent compMan = chimchar.GetCompartmentAccessComponent();
81
IEntity
vehicle = m_CompartmentToGetIn.m_Value.GetVehicle();
82
if
(compMan.IsGettingIn())
83
{
84
SCR_AIGetOutVehicle
getOutBehavior =
new
SCR_AIGetOutVehicle
(
m_Utility
, null , vehicle,
85
priority : PRIORITY_BEHAVIOR_GET_OUT_VEHICLE_HIGH_PRIORITY, priorityLevel :
EvaluatePriorityLevel
());
86
m_Utility
.AddAction(getOutBehavior);
87
}
88
else
if
(vehicle && vehicle == compMan.GetVehicleIn(chimchar))
89
compMan.GetOutVehicle(
EGetOutType
.TELEPORT, 0,
ECloseDoorAfterActions
.LEAVE_OPEN,
true
);
90
else
91
compMan.InterruptVehicleActionQueue(
true
,
true
,
true
);
92
m_CompartmentToGetIn.m_Value.SetCompartmentAccessible(
true
);
93
m_CompartmentToGetIn.m_Value.SetReserved(null);
94
};
95
super.OnActionFailed();
96
}
97
98
//------------------------------------------------------------------------------------------------
99
override
string
GetActionDebugInfo
()
100
{
101
return
this.
ToString
() +
" moving to "
+
m_Vehicle
.m_Value.ToString() +
" inside "
+ m_CompartmentToGetIn.m_Value.ToString();
102
}
103
};
104
105
class
SCR_AIGetOutVehicle :
SCR_AIVehicleBehavior
106
{
107
ref SCR_BTParam<float> m_fDelay =
new
SCR_BTParam<float>(
"Delay"
);
108
109
//------------------------------------------------------------------------------------------------
110
void
SCR_AIGetOutVehicle(SCR_AIUtilityComponent utility,
SCR_AIActivityBase
groupActivity,
IEntity
vehicleEntity,
float
delay_s = 0,
float
priority = PRIORITY_BEHAVIOR_GET_OUT_VEHICLE,
float
priorityLevel =
PRIORITY_LEVEL_NORMAL
)
111
{
112
m_sBehaviorTree
=
"AI/BehaviorTrees/Chimera/Soldier/GetOutVehicle.bt"
;
113
SetPriority(priority);
114
m_fPriorityLevel
.m_Value = priorityLevel;
115
m_fDelay.Init(
this
, delay_s);
116
}
117
118
//------------------------------------------------------------------------------------------------
119
override
string
GetActionDebugInfo
()
120
{
121
return
this.
ToString
() +
" leaving "
+
m_Vehicle
.m_Value.ToString();
122
}
123
};
m_aParams
ref array< SCR_BTParamBase > m_aParams
Definition
SCR_AIAction.c:96
m_fPriorityLevel
ref SCR_BTParam< float > m_fPriorityLevel
Definition
SCR_AIAction.c:87
OnActionCompleted
void OnActionCompleted()
Definition
SCR_AIAction.c:202
PRIORITY_LEVEL_NORMAL
enum EAIActionFailReason PRIORITY_LEVEL_NORMAL
EvaluatePriorityLevel
override float EvaluatePriorityLevel()
Definition
SCR_AIAction.c:101
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
GetActionDebugInfo
string GetActionDebugInfo()
Definition
SCR_AIAction.c:185
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
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
EAICompartmentType
EAICompartmentType
Definition
SCR_AIVehicleBehavior.c:2
Cargo
@ Cargo
Definition
SCR_AIVehicleBehavior.c:6
Turret
@ Turret
Definition
SCR_AIVehicleBehavior.c:5
Pilot
@ Pilot
Definition
SCR_AIVehicleBehavior.c:4
m_Vehicle
enum EAICompartmentType m_Vehicle
SCR_AIVehicleBehavior
void SCR_AIVehicleBehavior(SCR_AIUtilityComponent utility, SCR_AIActivityBase groupActivity, IEntity vehicleEntity)
Definition
SCR_AIVehicleBehavior.c:14
OnActionCompleted
override void OnActionCompleted()
Definition
SCR_AIVehicleBehavior.c:34
OnActionFailed
override void OnActionFailed()
Definition
SCR_AIVehicleBehavior.c:41
BaseCompartmentSlot
Definition
BaseCompartmentSlot.c:2
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
SCR_AIActionTask
Definition
SCR_AIBehaviorTask.c:2
SCR_AIGetOutVehicle
Definition
SCR_AIVehicleBehavior.c:106
ToString
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
ECloseDoorAfterActions
ECloseDoorAfterActions
Definition
ECloseDoorAfterActions.c:13
EGetOutType
EGetOutType
Definition
EGetOutType.c:13
scripts
Game
AI
Behavior
SCR_AIVehicleBehavior.c
Generated by
1.17.0