3 [
Attribute(
"{35BD6541CBB8AC08}Prefabs/AI/Waypoints/AIWaypoint_Cycle.et",
UIWidgets.ResourceNamePicker,
"Cycle waypoint to be used for waypoints in hierarchy.",
"et")]
6 [
Attribute(
"{93291E72AC23930F}Prefabs/AI/Waypoints/AIWaypoint_Defend.et",
UIWidgets.ResourceNamePicker,
"Waypoint to be used if no waypoints are found in hierarchy.",
"et")]
32 [
Attribute(
"-1",
desc:
"Overrides the system’s spawn distance for this spawn point (in meters). Use -1 to inherit the default. Value is clamped by min/max spawn distances.")]
35 [
Attribute(
"-1",
desc:
"Overrides the system’s despawn distance for this spawn point (in meters). Use -1 to inherit the default. Value is clamped by min/max despawn distances.")]
38 [
Attribute(
"0",
UIWidgets.EditBox,
"How often will the group respawn. (seconds, 0 = no respawn)",
"0 inf 1")]
41 [
Attribute(
"0.95",
desc:
"If (CurrentAIs / AILimit) > this value, the group will not be spawned.",
params:
"0 0.95 0.01")]
177 float highestProbability;
178 array<ResourceName> prefabs = {};
179 array<int> eligiblePrefabIds = {};
180 array<float> probabilities = {};
185 for (
int i = 0, count =
data.Count(); i < count; i++)
187 int catalogIndex =
data[i].GetCatalogIndex();
188 catalogEntry = entityCatalog.GetCatalogEntry(catalogIndex);
200 prefabs.Insert(catalogEntry.
GetPrefab());
201 probabilities.Insert(probability);
203 if (probability > highestProbability)
204 highestProbability = probability
207 if (prefabs.IsEmpty())
210 float rand =
Math.RandomFloat(0, highestProbability);
212 for (
int i = 0, count = probabilities.Count(); i < count; i++)
214 if (probabilities[i] >= rand)
215 eligiblePrefabIds.Insert(i);
218 if (eligiblePrefabIds.IsEmpty())
221 return prefabs[eligiblePrefabIds.GetRandomElement()];
238 array<SCR_EntityCatalogEntry>
data = {};
250 for (
int i = 0, count =
data.Count(); i < count; i++)
252 int catalogIndex =
data[i].GetCatalogIndex();
272 array<AIWaypoint> waypoints = {};
273 array<IEntity> queue = {
GetOwner()};
278 while (!queue.IsEmpty())
280 processedEntity = queue[0];
283 waypoint = AIWaypoint.Cast(processedEntity);
286 waypoints.Insert(waypoint);
290 while (nextInHierarchy)
292 queue.Insert(nextInHierarchy);
293 nextInHierarchy = nextInHierarchy.
GetSibling();
297 if (waypoints.IsEmpty())
300 if (waypoints.Count() == 1)
314 wp.SetWaypoints(waypoints);
324 params.TransformMode = ETransformMode.WORLD;
328 if (predefinedWaypoint)
359 faction =
SCR_Faction.Cast(comp.GetDefaultAffiliatedFaction());
371 params.TransformMode = ETransformMode.WORLD;
376 AIWaypointCycle cycleWP = AIWaypointCycle.Cast(
m_Waypoint);
379 array<AIWaypoint> waypoints = {};
380 cycleWP.GetWaypoints(waypoints);
381 params.Transform[3] = waypoints.GetRandomElement().GetOrigin();
391 if (!
m_Group.GetSpawnImmediately())
415 array<AIAgent> units = {};
417 int count =
m_Group.GetAgentsCount();
419 RplComponent.DeleteRplEntity(
m_Group,
false);
439 m_Group.DeactivateAllMembers();
470 if (!factionComponent)
472 Print(
"SCR_AmbientPatrolSpawnPointComponent: SCR_FactionAffiliationComponent not found on owner entity. Patrol spawning will not be available.",
LogLevel.WARNING);
IEntity SpawnEntityPrefabEx(ResourceName prefab, bool randomizeEditableVariant, BaseWorld world=null, EntitySpawnParams params=null)
ArmaReforgerScripted GetGame()
SCR_AIGroupSettingsComponentClass m_Group
void OnAgentRemoved(AIGroup group, AIAgent agent)
bool m_bPickRandomGroupType
int GetSpawnDistanceOverride()
WorldTimestamp m_RespawnTimestamp
SCR_AIGroup GetSpawnedGroup()
WorldTimestamp GetDespawnTimestamp()
void SetWaypoint(AIWaypoint wp)
void SetDespawnTimestamp(WorldTimestamp time)
void SetIsSpawned(bool spawned)
void SetRespawnTimestamp(WorldTimestamp timestamp)
int m_iDespawnDistanceOverride
void SetIsPaused(bool paused)
void SetMembersAlive(int count)
float m_fAILimitThreshold
AIWaypointCycle SpawnCycleWaypoint(notnull EntitySpawnParams params)
ResourceName GetRandomPrefabByProbability(notnull SCR_EntityCatalog entityCatalog, notnull array< SCR_EntityCatalogEntry > data)
int m_iSpawnDistanceOverride
int GetDespawnDistanceOverride()
float GetAILimitThreshold()
void SetspawnedGroup(SCR_AIGroup group)
WorldTimestamp GetRespawnTimestamp()
WorldTimestamp m_DespawnTimestamp
SCR_CharacterSoundComponentClass GetComponentData()
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external GenericComponent FindComponent(typename typeName)
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external IEntity GetChildren()
proto external BaseWorld GetWorld()
proto external IEntity GetSibling()
ResourceName GetDefaultWaypointPrefab()
ResourceName GetCycleWaypointPrefab()
ResourceName m_sDefaultWaypointPrefab
ResourceName m_sCycleWaypointPrefab
void RegisterPatrol(notnull SCR_AmbientPatrolSpawnPointComponent patrol)
static SCR_AmbientPatrolSystem GetInstance()
void UnregisterPatrol(notnull SCR_AmbientPatrolSpawnPointComponent patrol)
SCR_EGroupType GetGroupType()
float GetProbabilityOfPresence()
Get prefab entity Data of type Ignores disabled Data s param dataType class of Data type you with to obtain return Entity Data of given type Null if not found *SCR_BaseEntityCatalogData GetEntityDataOfType(typename dataType)
Get Prefab data return Prefab data *ResourceName GetPrefab()
Get Catalog Entry of index Can ignores disabled entries param Index of entry within list return Catalog Entry Null if entry is disabled *SCR_EntityCatalogEntry GetCatalogEntry(int index)
SCR_EntityCatalog GetFactionEntityCatalogOfType(EEntityCatalogType catalogType, bool printNotFound=true)
proto external GenericEntity GetOwner()
Get owner entity.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute