Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkAIActionJoinGroup.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "SlotAI with group to join (optional)")];
6
7 [Attribute(defvalue:"0", desc: "Id of Player in group to join (optional)", params:"0 inf 1")];
8 int m_iPlayerId;
9
10 //------------------------------------------------------------------------------------------------
11 override void OnActivate()
12 {
13 SCR_AIGroup group;
14 SCR_PlayerControllerGroupComponent pControllerGroupComponent;
15
16 //Get target group
17 if (m_Getter)
18 {
19 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
20 if (!entityWrapper)
21 {
22 PrintFormat("ScenarioFramework Action: Issue with Getter detected for Action %1.", this, level: LogLevel.ERROR);
23 return;
24 }
25
26 IEntity entity = entityWrapper.GetValue();
27 if (!entity)
28 {
29 PrintFormat("ScenarioFramework Action: Entity not found for Action %1", this, level: LogLevel.ERROR);
30 return;
31 }
32
34 if (slotAI)
35 group = slotAI.m_AIGroup;
36 }
37 else if (m_iPlayerId > 0)
38 {
39 pControllerGroupComponent = SCR_PlayerControllerGroupComponent.GetPlayerControllerComponent(m_iPlayerId);
40 if (!pControllerGroupComponent)
41 {
42 PrintFormat("ScenarioFramework Action: SCR_PlayerControllerGroupComponent not found for Action %1.", this, level: LogLevel.ERROR);
43 return;
44 }
45
46 group = pControllerGroupComponent.GetPlayersGroup();
47 }
48
49 if (!group)
50 {
51 PrintFormat("ScenarioFramework Action: No SCR_AIGroup found for %1.", this, level: LogLevel.ERROR);
52 return;
53 }
54
55 //get all agents from the group
56 array<AIAgent> agents = {};
57 m_AIGroup.GetAgents(agents);
58
59 if (group.IsPlayable())
60 {
61 int leaderId = group.GetLeaderID();
62 pControllerGroupComponent = SCR_PlayerControllerGroupComponent.GetPlayerControllerComponent(leaderId);
63 if (!pControllerGroupComponent)
64 {
65 PrintFormat("ScenarioFramework Action: SCR_PlayerControllerGroupComponent not found for Action %1.", this, level: LogLevel.ERROR);
66 return;
67 }
68
69 foreach (AIAgent agent : agents)
70 {
71 pControllerGroupComponent.RequestAddAIAgent(SCR_ChimeraCharacter.Cast(agent.GetControlledEntity()), leaderId);
72 }
73 }
74 else
75 {
76 foreach (AIAgent agent : agents)
77 {
78 group.AddAIEntityToGroup(agent.GetControlledEntity());
79 }
80 }
81 }
82}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
int GetLeaderID()
bool AddAIEntityToGroup(IEntity entity)
bool IsPlayable()
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute