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_TutorialLogic_Commanding.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
2
class
SCR_TutorialLogic_SquadLeadership
:
SCR_BaseTutorialCourseLogic
3
{
4
protected
const
ResourceName
GROUP_PREFAB
=
"{3BF36BDEEB33AEC9}Prefabs/Groups/BLUFOR/Group_US_SentryTeam.et"
;
5
6
//------------------------------------------------------------------------------------------------
7
protected
void
OnEntitySpawned
(
IEntity
ent)
8
{
9
if
(!ent || ent.
GetPrefabData
().GetPrefabName() !=
GROUP_PREFAB
)
10
return
;
11
12
ent.
SetName
(
"REQUESTING_GROUP"
);
13
SCR_AIGroup
group =
SCR_AIGroup
.Cast(ent);
14
if
(group)
15
group.RemoveWaypoint(group.GetCurrentWaypoint());
16
}
17
18
//------------------------------------------------------------------------------------------------
19
override
void
OnCourseStart
()
20
{
21
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
22
IEntity
playerVeh =
GetGame
().
GetWorld
().FindEntityByName(
"PlayerVehicle"
);
23
if
(tutorial && playerVeh)
24
{
25
tutorial.ChangeVehicleLockState(playerVeh,
true
);
26
tutorial.GetOnEntitySpawned().Insert(
OnEntitySpawned
);
27
}
28
29
IEntity
ent =
GetGame
().
GetWorld
().FindEntityByName(
"UNIT_REQUESTING_SUPPLIES"
);
30
if
(!ent)
31
return
;
32
33
SCR_ResourceComponent resComp = SCR_ResourceComponent.FindResourceComponent(ent);
34
if
(!resComp)
35
return
;
36
37
SCR_ResourceContainer
resourceContainer = resComp.GetContainer(
EResourceType
.SUPPLIES);
38
if
(resourceContainer)
39
resourceContainer.
IncreaseResourceValue
(150);
40
41
HandleRemnantGroup
(
"OldGroup"
);
42
43
SCR_CommandingManagerComponent
commandingManager =
SCR_CommandingManagerComponent
.GetInstance();
44
if
(commandingManager)
45
commandingManager.SetMaxAIPerGroup(2);
46
}
47
48
//------------------------------------------------------------------------------------------------
49
void
HandleRemnantGroup
(
string
groupName)
50
{
51
IEntity
oldGroupEnt =
GetGame
().
GetWorld
().FindEntityByName(groupName);
52
53
SCR_AIGroup
group =
SCR_AIGroup
.Cast(oldGroupEnt);
54
if
(!group)
55
return
;
56
57
array <AIAgent> agents = {};
58
group.GetAgents(agents);
59
60
if
(!agents || agents.IsEmpty())
61
return
;
62
63
for
(
int
i = agents.Count()-1; i >= 0; i--)
64
{
65
SCR_EntityHelper
.DeleteEntityAndChildren(agents[i].
GetControlledEntity
());
66
}
67
}
68
69
//------------------------------------------------------------------------------------------------
70
override
void
OnCourseEnd
()
71
{
72
SCR_ResourceComponent resComp = SCR_ResourceComponent.FindResourceComponent(
GetGame
().GetWorld().FindEntityByName(
"UNIT_REQUESTING_SUPPLIES"
));
73
if
(resComp)
74
{
75
SCR_ResourceContainer
resourceContainer = resComp.GetContainer(
EResourceType
.SUPPLIES);
76
if
(resourceContainer)
77
resourceContainer.
DecreaseResourceValue
(resourceContainer.
GetResourceValue
());
78
}
79
80
HandleRemnantGroup
(
"REQUESTING_GROUP"
);
81
82
SCR_CommandingManagerComponent
commandingManager =
SCR_CommandingManagerComponent
.GetInstance();
83
if
(commandingManager)
84
commandingManager.SetMaxAIPerGroup(0);
85
86
SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
87
IEntity
playerVeh =
GetGame
().
GetWorld
().FindEntityByName(
"PlayerVehicle"
);
88
if
(tutorial && playerVeh)
89
{
90
tutorial.ChangeVehicleLockState(playerVeh,
false
);
91
tutorial.GetOnEntitySpawned().Remove(
OnEntitySpawned
);
92
}
93
94
//TODO: GIVE group name and use HandleRemnantGroup, to get rid of redundant code
95
SCR_PlayerController
playerController =
SCR_PlayerController
.Cast(
GetGame
().
GetPlayerController
());
96
if
(!playerController)
97
return
;
98
99
SCR_PlayerControllerGroupComponent playerGroupComp = SCR_PlayerControllerGroupComponent.Cast(playerController.FindComponent(SCR_PlayerControllerGroupComponent));
100
if
(!playerGroupComp)
101
return
;
102
103
SCR_GroupsManagerComponent
groupsManager =
SCR_GroupsManagerComponent
.GetInstance();
104
if
(!groupsManager)
105
return
;
106
107
SCR_AIGroup
group = groupsManager.FindGroup(playerGroupComp.GetGroupID());
108
if
(!group)
109
return
;
110
111
group = group.
GetSlave
();
112
if
(!group)
113
return
;
114
115
group.RemoveWaypoint(group.GetCurrentWaypoint());
116
117
array <AIAgent> agents = {};
118
group.GetAgents(agents);
119
120
if
(!agents || agents.IsEmpty())
121
return
;
122
123
for
(
int
i = agents.Count()-1; i >= 0; i--)
124
{
125
SCR_EntityHelper
.DeleteEntityAndChildren(agents[i].
GetControlledEntity
());
126
}
127
}
128
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_CommandingManagerComponent
void SCR_CommandingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_CommandingManagerComponent.c:46
SCR_GroupsManagerComponent
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_GroupsManagerComponent.c:1747
EResourceType
EResourceType
Definition
SCR_ResourceContainer.c:2
IEntity
Definition
IEntity.c:13
IEntity::GetWorld
proto external BaseWorld GetWorld()
IEntity::SetName
proto external void SetName(string name)
IEntity::GetPrefabData
proto external EntityPrefabData GetPrefabData()
ResourceName
Definition
ResourceName.c:13
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_AIGroup::GetSlave
SCR_AIGroup GetSlave()
Definition
SCR_AIGroup.c:2604
SCR_BaseTutorialCourseLogic
Definition
SCR_BaseTutorialCourseLogic.c:3
SCR_EntityHelper
Definition
SCR_EntityHelper.c:2
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_ResourceContainer
Definition
SCR_ResourceContainer.c:35
SCR_ResourceContainer::GetResourceValue
float GetResourceValue()
Definition
SCR_ResourceContainer.c:95
SCR_ResourceContainer::DecreaseResourceValue
bool DecreaseResourceValue(float value, bool notifyChange=true)
Definition
SCR_ResourceContainer.c:535
SCR_ResourceContainer::IncreaseResourceValue
bool IncreaseResourceValue(float value, bool notifyChange=true)
Definition
SCR_ResourceContainer.c:529
SCR_TutorialLogic_SquadLeadership
Definition
SCR_TutorialLogic_Commanding.c:3
SCR_TutorialLogic_SquadLeadership::GROUP_PREFAB
const ResourceName GROUP_PREFAB
Definition
SCR_TutorialLogic_Commanding.c:4
SCR_TutorialLogic_SquadLeadership::OnCourseEnd
override void OnCourseEnd()
Definition
SCR_TutorialLogic_Commanding.c:70
SCR_TutorialLogic_SquadLeadership::OnEntitySpawned
void OnEntitySpawned(IEntity ent)
Definition
SCR_TutorialLogic_Commanding.c:7
SCR_TutorialLogic_SquadLeadership::OnCourseStart
override void OnCourseStart()
Definition
SCR_TutorialLogic_Commanding.c:19
SCR_TutorialLogic_SquadLeadership::HandleRemnantGroup
void HandleRemnantGroup(string groupName)
Definition
SCR_TutorialLogic_Commanding.c:49
GetControlledEntity
SCR_EditableEntityComponent GetControlledEntity()
Definition
SCR_EditablePlayerDelegateComponent.c:90
GetPlayerController
proto external PlayerController GetPlayerController()
Definition
SCR_PlayerDeployMenuHandlerComponent.c:307
scripts
Game
GameMode
Tutorial
Stages
Commanding
SCR_TutorialLogic_Commanding.c
Generated by
1.17.0