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_ScenarioFrameworkAIActionSplitGroup.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_ContainerAIActionTitle
()]
2
class
SCR_ScenarioFrameworkAIActionSplitGroup
:
SCR_ScenarioFrameworkAIAction
3
{
4
[
Attribute
(
desc
:
"SlotAI for new group"
)];
5
ref
SCR_ScenarioFrameworkGetLayerBase
m_Getter;
6
7
[
Attribute
(defvalue:
"0"
,
desc
:
"Determines, how much AI's should split to new group"
,
params
:
"0 inf"
)]
8
int
m_iSplitCount;
9
10
[
Attribute
(defvalue:
""
,
desc
:
"Prefabs to transfer (optional)"
)]
11
ref array<ResourceName> m_aPrefabFilter;
12
13
[
Attribute
(defvalue:
"{000CD338713F2B5A}Prefabs/AI/Groups/Group_Base.et"
)]
14
ResourceName
m_sGroupPrefab;
15
16
//------------------------------------------------------------------------------------------------
17
override
void
OnActivate
()
18
{
19
SCR_ScenarioFrameworkSlotAI
slotAI =
GetSlotAI
();
20
if
(!slotAI)
21
{
22
Print
(
string
.Format(
"ScenarioFramework Action: No SlotAI found on for %1."
,
this
),
LogLevel
.ERROR);
23
return
;
24
}
25
26
array<AIAgent> agents = {};
27
m_AIGroup.GetAgents(agents);
28
if
(agents.IsEmpty())
29
return
;
30
31
int
ageitnCount = agents.Count();
32
33
//filter out unallowed prefabs
34
if
(!m_aPrefabFilter)
35
{
36
IEntity
controlledEntity;
37
for
(
int
i = agents.Count()-1; i >= 0; i--)
38
{
39
controlledEntity = agents[i].GetControlledEntity();
40
if
(!controlledEntity)
41
continue
;
42
43
if
(!m_aPrefabFilter.Contains(controlledEntity.
GetPrefabData
().GetPrefabName()))
44
agents.Remove(i);
45
}
46
}
47
48
ageitnCount = agents.Count();
49
if
(agents.Count() <= m_iSplitCount)
50
{
51
Print
(
"SCR_ScenarioFrameworkAIActionSplitGroup: Original group doesn't have enough AI's"
,
LogLevel
.ERROR);
52
return
;
53
}
54
55
agents.Resize(m_iSplitCount);
56
57
AIGroup group = AIGroup.Cast(
GetGame
().SpawnEntityPrefab(
Resource
.Load(m_sGroupPrefab)));
58
if
(!group)
59
return
;
60
61
foreach
(AIAgent agent : agents)
62
{
63
group.AddAgent(agent);
64
}
65
66
slotAI.m_Entity = group;
67
slotAI.m_AIGroup =
SCR_AIGroup
.Cast(group);
68
}
69
70
//------------------------------------------------------------------------------------------------
71
protected
SCR_ScenarioFrameworkSlotAI
GetSlotAI
()
72
{
73
if
(!m_Getter)
74
return
null;
75
76
SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
77
if
(!entityWrapper)
78
{
79
Print
(
string
.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1."
,
this
),
LogLevel
.ERROR);
80
return
null;
81
}
82
83
IEntity
entity = entityWrapper.GetValue();
84
if
(!entity)
85
{
86
Print
(
string
.Format(
"ScenarioFramework Action: Entity not found for Action %1."
,
this
),
LogLevel
.ERROR);
87
return
null;
88
}
89
90
return
SCR_ScenarioFrameworkSlotAI
.Cast(entity.
FindComponent
(
SCR_ScenarioFrameworkSlotAI
));
91
}
92
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
OnActivate
override void OnActivate()
Definition
SCR_CharacterCommandLoiter.c:31
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetPrefabData
proto external EntityPrefabData GetPrefabData()
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
ResourceName
Definition
ResourceName.c:13
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_ContainerAIActionTitle
Definition
SCR_ContainerAIActionTitle.c:2
SCR_ScenarioFrameworkAIAction
Definition
SCR_ScenarioFrameworkAIAction.c:3
SCR_ScenarioFrameworkAIActionSplitGroup
Definition
SCR_ScenarioFrameworkAIActionSplitGroup.c:3
SCR_ScenarioFrameworkAIActionSplitGroup::GetSlotAI
SCR_ScenarioFrameworkSlotAI GetSlotAI()
Definition
SCR_ScenarioFrameworkAIActionSplitGroup.c:71
SCR_ScenarioFrameworkGetLayerBase
Definition
SCR_ScenarioFrameworkGetLayerBase.c:3
SCR_ScenarioFrameworkSlotAI
Definition
SCR_ScenarioFrameworkSlotAI.c:12
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
ScenarioFramework
Actions
AIActions
SCR_ScenarioFrameworkAIActionSplitGroup.c
Generated by
1.17.0