5 override bool _WB_GetCustomTitle(BaseContainer source, out
string title)
7 title = source.GetClassName();
8 title.Replace(
"SCR_ScenarioFrameworkAIAction",
"");
9 string sOriginal = title;
10 SplitStringByUpperCase(sOriginal, title);
15 protected void SplitStringByUpperCase(
string input, out
string output)
18 bool wasPreviousUpperCase;
20 for (
int i, count = input.Length(); i < count; i++)
22 asciiChar = input.ToAscii(i);
23 bool isLowerCase = (asciiChar > 96 && asciiChar < 123);
24 if (i > 0 && !wasPreviousUpperCase && !isLowerCase)
26 output +=
" " + asciiChar.AsciiToString();
27 wasPreviousUpperCase =
true;
32 wasPreviousUpperCase =
false;
33 output += asciiChar.AsciiToString();
42 class SCR_ScenarioFrameworkActionAI : SCR_ScenarioFrameworkActionBase
44 [
Attribute(
desc:
"Target entity for AI Action - if left empty, it will attempt to retrieve it from the ")];
47 [
Attribute(
desc:
"AI actions that will be executed on target AI")];
48 ref array<ref SCR_ScenarioFrameworkAIAction> m_aAIActions;
61 IEntity entity = layer.GetSpawnedEntity();
64 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
71 Print(
string.Format(
"ScenarioFramework Action: AI Group not found for Action %1.",
this), LogLevel.ERROR);
75 foreach (SCR_ScenarioFrameworkAIAction AIAction : m_aAIActions)
77 AIAction.Init(targetAIGroup,
object);
84 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
87 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
91 IEntity entity = IEntity.Cast(entityWrapper.GetValue());
94 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
101 Print(
string.Format(
"ScenarioFramework Action: AI Group not found for Action %1.",
this), LogLevel.ERROR);
105 foreach (SCR_ScenarioFrameworkAIAction AIAction : m_aAIActions)
107 AIAction.Init(targetAIGroup,
object);
115 class SCR_ScenarioFrameworkAIAction
139 class SCR_ScenarioFrameworkAIAddWaypoint : SCR_ScenarioFrameworkAIAction
152 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
155 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
159 IEntity entity = IEntity.Cast(entityWrapper.GetValue());
162 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
169 Print(
string.Format(
"ScenarioFramework Action: Entity is not Layer Base for Action %1.",
this), LogLevel.ERROR);
173 IEntity spawnedEntity = layer.GetSpawnedEntity();
176 layer.GetOnAllChildrenSpawned().Insert(OnWaypointSpawned);
183 Print(
string.Format(
"ScenarioFramework Action: Waypoint not found for Action %1.",
this), LogLevel.ERROR);
193 layer.GetOnAllChildrenSpawned().Remove(OnWaypointSpawned);
195 IEntity spawnedEntity = layer.GetSpawnedEntity();
202 Print(
string.Format(
"ScenarioFramework Action: Waypoint not found for Action %1.",
this), LogLevel.ERROR);
213 class SCR_ScenarioFrameworkAIActionOnWaypointCompleted : SCR_ScenarioFrameworkAIAction
218 [
Attribute(
desc:
"Actions that will be executed upon provided waypoint is completed for provided AI group")];
219 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnWaypointCompleted;
228 Print(
string.Format(
"ScenarioFramework Action: Getter not found for Action %1.",
this), LogLevel.ERROR);
232 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
235 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
239 IEntity entity = IEntity.Cast(entityWrapper.GetValue());
242 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
249 Print(
string.Format(
"ScenarioFramework Action: Entity is not Layer Base for Action %1.",
this), LogLevel.ERROR);
253 IEntity spawnedEntity = layer.GetSpawnedEntity();
256 layer.GetOnAllChildrenSpawned().Insert(OnWaypointSpawned);
263 Print(
string.Format(
"ScenarioFramework Action: Waypoint not found for Action %1.",
this), LogLevel.ERROR);
274 layer.GetOnAllChildrenSpawned().Remove(OnWaypointSpawned);
276 IEntity spawnedEntity = layer.GetSpawnedEntity();
279 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
286 Print(
string.Format(
"ScenarioFramework Action: Waypoint not found for Action %1.",
this), LogLevel.ERROR);
301 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnWaypointCompleted)
303 action.Init(m_IEntity);
311 class SCR_ScenarioFrameworkAIActionOnThreatStateChanged : SCR_ScenarioFrameworkAIAction
313 [
Attribute(defvalue: EAIThreatState.THREATENED.ToString(), UIWidgets.ComboBox,
"On what Threat State will actions be activated",
"", ParamEnumArray.FromEnum(EAIThreatState),
category:
"Common")]
314 EAIThreatState m_eAIThreatState;
316 [
Attribute(
desc:
"Actions that will be executed upon provided waypoint is completed for provided AI group")];
317 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnThreatStateChanged;
319 ref array<ref SCR_AIThreatSystem> m_aAIThreatSystems = {};
324 array<AIAgent> agents = {};
327 foreach (
int i, AIAgent agent : agents)
329 IEntity agentEntity = agent.GetControlledEntity();
333 SCR_AICombatComponent combatComponent = SCR_AICombatComponent.Cast(agentEntity.FindComponent(SCR_AICombatComponent));
334 if (!combatComponent)
337 SCR_AIInfoComponent infoComponent = combatComponent.GetAIInfoComponent();
345 m_aAIThreatSystems.Insert(threatSystem);
346 threatSystem.GetOnThreatStateChanged().Insert(OnThreatStateChanged);
351 void OnThreatStateChanged(EAIThreatState prevState, EAIThreatState newState)
353 if (newState != m_eAIThreatState)
358 threatSystem.GetOnThreatStateChanged().Remove(OnThreatStateChanged);
361 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnThreatStateChanged)
363 action.Init(m_IEntity);
371 class SCR_ScenarioFrameworkAIActionSetSkill : SCR_ScenarioFrameworkAIAction
373 [
Attribute(defvalue: EAISkill.REGULAR.ToString(), UIWidgets.ComboBox,
"AI skill in combat",
"", ParamEnumArray.FromEnum(EAISkill),
category:
"Common")]
379 array<AIAgent> agents = {};
382 foreach (AIAgent agent : agents)
384 IEntity agentEntity = agent.GetControlledEntity();
388 SCR_AICombatComponent combatComponent = SCR_AICombatComponent.Cast(agentEntity.FindComponent(SCR_AICombatComponent));
398 class SCR_ScenarioFrameworkAIActionSetCombatType : SCR_ScenarioFrameworkAIAction
400 [
Attribute(defvalue: EAICombatType.NORMAL.ToString(), UIWidgets.ComboBox,
"AI combat type",
"", ParamEnumArray.FromEnum(EAICombatType),
category:
"Common")]
406 array<AIAgent> agents = {};
409 foreach (AIAgent agent : agents)
411 IEntity agentEntity = agent.GetControlledEntity();
415 SCR_AICombatComponent combatComponent = SCR_AICombatComponent.Cast(agentEntity.FindComponent(SCR_AICombatComponent));
425 class SCR_ScenarioFrameworkAIActionSetHoldFire : SCR_ScenarioFrameworkAIAction
427 [
Attribute(defvalue:
"1",
desc:
"If AI in the group should hold fire")]
433 array<AIAgent> agents = {};
436 foreach (AIAgent agent : agents)
438 IEntity agentEntity = agent.GetControlledEntity();
442 SCR_AICombatComponent combatComponent = SCR_AICombatComponent.Cast(agentEntity.FindComponent(SCR_AICombatComponent));
444 combatComponent.SetHoldFire(m_bHoldFire);
452 class SCR_ScenarioFrameworkAIActionSetPerceptionFactor : SCR_ScenarioFrameworkAIAction
454 [
Attribute(defvalue:
"1", uiwidget: UIWidgets.EditBox,
desc:
"Sets perception ability. Affects speed at which perception detects targets. Bigger value means proportionally faster detection.",
params:
"0 100 0.001",
category:
"Common")]
460 array<AIAgent> agents = {};
463 foreach (AIAgent agent : agents)
465 IEntity agentEntity = agent.GetControlledEntity();
469 SCR_AICombatComponent combatComponent = SCR_AICombatComponent.Cast(agentEntity.FindComponent(SCR_AICombatComponent));
479 class SCR_ScenarioFrameworkAIActionSetFormation : SCR_ScenarioFrameworkAIAction
487 AIFormationComponent formComp = AIFormationComponent.Cast(
m_AIGroup.FindComponent(AIFormationComponent));
490 Print(
string.Format(
"ScenarioFramework Action: AI Formation Component not found for Action %1.",
this), LogLevel.ERROR);
501 class SCR_ScenarioFrameworkAIActionSetCharacterStance : SCR_ScenarioFrameworkAIAction
509 array<AIAgent> agents = {};
512 foreach (AIAgent agent : agents)
514 IEntity agentEntity = agent.GetControlledEntity();
518 SCR_AIInfoComponent infoComponent = SCR_AIInfoComponent.Cast(agentEntity.FindComponent(SCR_AIInfoComponent));
520 infoComponent.SetStance(m_eAICharacterStance);
528 class SCR_ScenarioFrameworkAIActionSetMovementType : SCR_ScenarioFrameworkAIAction
536 array<AIAgent> agents = {};
539 foreach (AIAgent agent : agents)
541 IEntity agentEntity = agent.GetControlledEntity();
545 SCR_AIInfoComponent infoComponent = SCR_AIInfoComponent.Cast(agentEntity.FindComponent(SCR_AIInfoComponent));
547 infoComponent.SetMovementType(m_eAIMovementType);