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_AIThrowGrenadeToBehavior.c
Go to the documentation of this file.
1
class
SCR_AIThrowGrenadeToBehavior :
SCR_AIBehaviorBase
2
{
3
//Target Position of the behavior
4
ref SCR_BTParam<vector> m_vTargetPosition =
new
SCR_BTParam<vector>(
SCR_AIActionTask
.TARGETPOSITION_PORT);
5
ref SCR_BTParam<EWeaponType> e_WeaponType =
new
SCR_BTParam<EWeaponType>(
SCR_AIActionTask
.WEAPON_TYPE_PORT);
6
ref SCR_BTParam<float> m_fDelay =
new
SCR_BTParam<float>(
SCR_AIActionTask
.DELAY_PORT);
7
8
BaseWorld
m_World;
9
float
m_fStartTime;
10
11
#ifdef WORKBENCH
12
//Diagnostic visualization
13
ref array<ref Shape> m_aDbgShapes = {};
14
#endif
15
private
static
vector
CHARACTER_HEIGHT_OFFSET = {0, 1.6, 0};
16
17
//---------------------------------------------------------------------------------------------------------------------------------
18
void
SCR_AIThrowGrenadeToBehavior(SCR_AIUtilityComponent utility,
SCR_AIActivityBase
groupActivity,
vector
position
,
EWeaponType
weaponType,
float
delay,
float
priority = PRIORITY_BEHAVIOR_THROW_GRENADE,
float
priorityLevel =
PRIORITY_LEVEL_NORMAL
)
19
{
20
m_vTargetPosition.Init(
this
,
position
);
21
e_WeaponType.Init(
this
, weaponType);
22
m_fDelay.Init(
this
, delay);
23
24
if
(utility)
25
{
26
m_World = utility.m_OwnerEntity.GetWorld();
27
m_fStartTime = m_World.GetWorldTime() + delay;
28
}
29
30
m_sBehaviorTree
=
"{3187CAE77AAF1A35}AI/BehaviorTrees/Chimera/Soldier/ThrowGrenadeTo.bt"
;
31
SetPriority(priority);
32
m_fPriorityLevel
.m_Value = priorityLevel;
33
m_bAllowLook
=
false
;
34
35
#ifdef WORKBENCH
36
if
(
DiagMenu
.GetBool(
SCR_DebugMenuID
.DEBUGUI_AI_SHOW_GRENADE_POSITIONS))
37
DrawPositionDebug(
false
);
38
#endif
39
}
40
41
//---------------------------------------------------------------------------------------------------------------------------------
42
override
int
GetCause
()
43
{
44
return
SCR_EAIBehaviorCause
.COMBAT;
45
}
46
47
//------------------------------------------------------------------------------------------------------------------------------------
48
override
float
CustomEvaluate
()
49
{
50
if
(m_World && m_World.GetWorldTime() < m_fStartTime)
51
return
0;
52
53
return
GetPriority
();
54
}
55
56
//----------------------------------------------------------------------------------
57
override
void
OnActionSelected
()
58
{
59
m_Utility
.m_AIInfo.SetAIState(EUnitAIState.BUSY);
60
61
#ifdef WORKBENCH
62
m_aDbgShapes.Clear();
63
if
(
DiagMenu
.GetBool(
SCR_DebugMenuID
.DEBUGUI_AI_SHOW_GRENADE_POSITIONS))
64
DrawPositionDebug(
true
);
65
#endif
66
}
67
68
//----------------------------------------------------------------------------------
69
override
void
OnActionCompleted
()
70
{
71
super.OnActionCompleted();
72
m_Utility
.m_AIInfo.SetAIState(EUnitAIState.AVAILABLE);
73
#ifdef WORKBENCH
74
SCR_AIDebugVisualization
.
VisualizeMessage
(
m_Utility
.m_OwnerEntity,
"Grenade thrown"
,
EAIDebugCategory
.INFO, 5);
75
m_aDbgShapes.Clear();
76
#endif
77
}
78
79
//----------------------------------------------------------------------------------
80
override
void
OnActionFailed
()
81
{
82
super.OnActionFailed();
83
m_Utility
.m_AIInfo.SetAIState(EUnitAIState.AVAILABLE);
84
#ifdef WORKBENCH
85
SCR_AIDebugVisualization
.
VisualizeMessage
(
m_Utility
.m_OwnerEntity,
"Grenade throw failed"
,
EAIDebugCategory
.INFO, 5);
86
m_aDbgShapes.Clear();
87
#endif
88
}
89
90
//----------------------------------------------------------------------------------
91
override
string
GetActionDebugInfo
()
92
{
93
return
this.
ToString
() +
" throwing grenade to "
+ m_vTargetPosition.m_Value.ToString();
94
}
95
96
//------------------------------------------------------------------------------------------------------------------------------------
97
void
DrawPositionDebug(
bool
selected)
98
{
99
int
shapeColor =
Color
.RED;
100
if
(selected)
101
shapeColor =
Color
.GREEN;
102
#ifdef WORKBENCH
103
m_aDbgShapes.Insert(
Shape
.CreateCylinder(
Color
.WHITE,
ShapeFlags
.DEFAULT, m_vTargetPosition.m_Value, 0.3, 100));
104
m_aDbgShapes.Insert(
Shape
.CreateSphere(shapeColor,
ShapeFlags
.DEFAULT, m_vTargetPosition.m_Value, 0.6));
105
#endif
106
}
107
};
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition
DebugMenuID.c:4
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
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
m_bAllowLook
bool m_bAllowLook
Definition
SCR_AIBehavior.c:18
CustomEvaluate
override float CustomEvaluate()
Definition
SCR_AIMoveFromDanger.c:135
EAIDebugCategory
EAIDebugCategory
Definition
SCR_AIWorld.c:12
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
BaseWorld
Definition
BaseWorld.c:13
Color
Definition
Color.c:13
DiagMenu
Diagnostic and developer menu system.
Definition
DiagMenu.c:18
SCR_AIActionTask
Definition
SCR_AIBehaviorTask.c:2
SCR_AIDebugVisualization
Definition
SCR_AIDebugVisualization.c:10
SCR_AIDebugVisualization::VisualizeMessage
static void VisualizeMessage(IEntity entity, string message, EAIDebugCategory category, float showTime, Color color=Color.White, float fontSize=16, bool ignoreCategory=false)
Definition
SCR_AIDebugVisualization.c:34
Shape
Instance of created debug visualizer.
Definition
Shape.c:14
vector
Definition
vector.c:13
ShapeFlags
ShapeFlags
Definition
ShapeFlags.c:13
GetPriority
int GetPriority()
Definition
SCR_BaseManualCameraComponent.c:247
ToString
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
EWeaponType
EWeaponType
Definition
EWeaponType.c:13
scripts
Game
AI
Behavior
SCR_AIThrowGrenadeToBehavior.c
Generated by
1.17.0