11 [
Attribute(
desc:
"(OBSOLETE - use Waypoint Set instead) Waypoint Groups if applicable",
category:
"Waypoints")]
12 ref array<ref SCR_WaypointSet> m_aWaypointGroupNames;
15 bool m_bSpawnAIOnWPPos;
17 [
Attribute(
desc:
"Default waypoint if any WP group is defined",
"{93291E72AC23930F}Prefabs/AI/Waypoints/AIWaypoint_Defend.et",
category:
"Waypoints")]
18 ResourceName m_sWPToSpawn;
20 [
Attribute(defvalue:
"0",
desc:
"Balancing group sizes based on number of players",
category:
"Balance")]
23 [
Attribute(defvalue:
"1",
desc:
"Least amount of AIs in the group after balancing occurs. Will not exceed maximum number of units defined in the group prefab.",
category:
"Balance")]
35 [
Attribute(defvalue: EAISkill.REGULAR.ToString(), UIWidgets.ComboBox,
"AI skill in combat",
"", ParamEnumArray.FromEnum(EAISkill),
category:
"Common")]
38 [
Attribute(defvalue: EAICombatType.NORMAL.ToString(), UIWidgets.ComboBox,
"AI combat type",
"", ParamEnumArray.FromEnum(EAICombatType),
category:
"Common")]
41 [
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")]
44 [
Attribute(defvalue:
"{000CD338713F2B5A}Prefabs/AI/Groups/Group_Base.et",
category:
"Common")]
73 override void RestoreToDefault(
bool includeChildren =
false,
bool reinitAfterRestoration =
false)
82 super.RestoreToDefault(includeChildren, reinitAfterRestoration);
123 override void Init(
SCR_ScenarioFrameworkArea area =
null, SCR_ScenarioFrameworkEActivationType activation = SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT)
147 if (!activationCondition.Init(
GetOwner()))
157 if (
m_eActivationType == SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT && m_WaypointSet && !m_WaypointSet.m_aLayerName.IsEmpty())
160 super.Init(area, activation);
164 super.Init(area, activation);
222 for (
int i =
m_AIGroup.m_aUnitPrefabSlots.Count() - 1; i >= 0; i--)
224 if (
m_AIGroup.m_aUnitPrefabSlots[i] != prefabToRemove)
234 int iMaxUnitsInGroup =
m_AIGroup.m_aUnitPrefabSlots.Count();
240 m_AIGroup.SetMaxUnitsToSpawn(iUnitsToSpawn);
278 array<AIAgent> agents = {};
281 AIFormationComponent formComp = AIFormationComponent.Cast(
m_AIGroup.FindComponent(AIFormationComponent));
286 AIFormationDefinition formDef = formComp.GetFormation();
289 foreach (
int i, AIAgent agent : agents)
291 IEntity agentEntity = agent.GetControlledEntity();
295 agentEntity.SetOrigin(
m_vPosition + formDef.GetOffsetPosition(i));
297 SCR_AICombatComponent combatComponent = SCR_AICombatComponent.Cast(agentEntity.FindComponent(SCR_AICombatComponent));
309 foreach (AIAgent agent : agents)
311 IEntity agentEntity = agent.GetControlledEntity();
315 SCR_AICombatComponent combatComponent = SCR_AICombatComponent.Cast(agentEntity.FindComponent(SCR_AICombatComponent));
330 array<string> WaypointSetLayers = {};
331 WaypointSetLayers = m_WaypointSet.m_aLayerName;
332 array<SCR_ScenarioFrameworkLayerBase> layerBases = {};
333 array<SCR_ScenarioFrameworkLayerBase> layerChildren = {};
337 foreach (
string waypointSetLayer : WaypointSetLayers)
339 IEntity layerEntity =
GetGame().GetWorld().FindEntityByName(waypointSetLayer);
346 if (layerBases.Contains(layerBase))
349 layerChildren = layerBase.GetChildrenEntities();
368 if (waypoint.GetIsInitiated())
388 if (!cycleWP.m_bInitiated)
393 else if (cycleWP.m_OnAllWaypointsSpawned)
426 Print(
string.Format(
"ScenarioFramework: Trying to add waypoints to non existing entity! Did you select the object to spawn for %1?",
GetOwner().
GetName()), LogLevel.ERROR);
440 waypoint = AIWaypoint.Cast(waypointSlot.GetSpawnedEntity());
470 EntitySpawnParams spawnParams =
new EntitySpawnParams();
471 spawnParams.TransformMode = ETransformMode.WORLD;
472 spawnParams.Transform[3] =
m_Entity.GetOrigin();
474 Resource resWP = Resource.Load(m_sWPToSpawn);
475 if (!resWP || !resWP.IsValid())
478 AIWaypoint waypoint = AIWaypoint.Cast(
GetGame().SpawnEntityPrefab(resWP,
GetGame().GetWorld(), spawnParams));
492 if (group.GetAgentsCount() == 0)
505 IEntity agentEntity = agent.GetControlledEntity();
508 Print(
"ScenarioFramework: Decreasing AI member count failed due to not getting AI entity!", LogLevel.ERROR);
512 EntityPrefabData prefabData = agentEntity.GetPrefabData();
515 Print(
"ScenarioFramework: Decreasing AI member count failed due to not getting entity prefab data", LogLevel.ERROR);
519 ResourceName resource = prefabData.GetPrefabName();
528 EntitySpawnParams paramsPatrol =
new EntitySpawnParams();
529 paramsPatrol.TransformMode = ETransformMode.WORLD;
531 paramsPatrol.Transform[3] =
m_Entity.GetOrigin();
533 if (!groupResource.IsValid())
540 FactionAffiliationComponent facComp = FactionAffiliationComponent.Cast(
m_Entity.FindComponent(FactionAffiliationComponent));
544 m_AIGroup.SetFaction(facComp.GetAffiliatedFaction());
568 [
Attribute(defvalue:
"",
desc:
"Name of a Layer that contains SlotWaypoints or directly the name of the SlotWaypoint. It will be added into the queue of waypoints for AIs attached to this Slot.")]
569 ref array<string> m_aLayerName;
572 void Init (AIGroup group, IEntity entity)
581 class SCR_WaypointSet
587 bool m_bUseRandomOrder;
590 bool m_bCycleWaypoints;