48 IEntity FindEntityByName(
string name)
50 IEntity entity =
GetGame().GetWorld().FindEntityByName(name);
64 SCR_GameModeSFManager gameModeManager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
68 return new SCR_ScenarioFrameworkParam<SCR_ScenarioFrameworkLayerTask>(SCR_ScenarioFrameworkLayerTask.Cast(gameModeManager.GetLastFinishedTaskLayer()));
78 SCR_GameModeSFManager gameModeManager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
82 return new SCR_ScenarioFrameworkParam<IEntity>(gameModeManager.GetLastFinishedTask());
116 return new SCR_ScenarioFrameworkParam<IEntity>(layer.GetSpawnedEntity());
124 string m_sLayerTaskName;
133 SCR_ScenarioFrameworkLayerTask layer = SCR_ScenarioFrameworkLayerTask.Cast(entity.FindComponent(SCR_ScenarioFrameworkLayerTask));
137 return new SCR_ScenarioFrameworkParam<IEntity>(layer.GetTask());
145 string m_sLayerTaskName;
154 SCR_ScenarioFrameworkLayerTask layer = SCR_ScenarioFrameworkLayerTask.Cast(entity.FindComponent(SCR_ScenarioFrameworkLayerTask));
158 return new SCR_ScenarioFrameworkParam<IEntity>(entity);
166 string m_sLayerBaseName;
179 return new SCR_ScenarioFrameworkParam<IEntity>(entity);
186 [
Attribute(defvalue:
"", UIWidgets.EditComboBox,
desc:
"From this list, random layer will be selected")]
187 ref array<string> m_aNameOfLayers;
192 if (m_aNameOfLayers.IsEmpty())
196 string selectedLayer = m_aNameOfLayers.GetRandomElement();
206 return new SCR_ScenarioFrameworkParam<IEntity>(entity);
227 return new SCR_ScenarioFrameworkParam<IEntity>(entity);
252 return new SCR_ScenarioFrameworkParam<IEntity>(entity);
260 string m_sTriggerName;
262 ref array<IEntity> m_aEntities = {};
267 GetEntitiesInTrigger(m_aEntities);
269 return new SCR_ScenarioFrameworkParam<array<IEntity>>(m_aEntities);
274 void GetEntitiesInTrigger(out notnull array<IEntity> aEntities)
276 BaseGameTriggerEntity trigger = BaseGameTriggerEntity.Cast(
GetGame().GetWorld().
FindEntityByName(m_sTriggerName));
280 trigger.GetEntitiesInside(aEntities);
285 class SCR_ScenarioFrameworkGetCountEntitiesInTrigger : SCR_ScenarioFrameworkGetListEntitiesInTrigger
290 array<IEntity> aEntities = {};
291 GetEntitiesInTrigger(aEntities);
293 return new SCR_ScenarioFrameworkParam<int>(aEntities.Count());
304 array<int> playerIDs = {};
305 GetGame().GetPlayerManager().GetPlayers(playerIDs);
307 foreach (
int playerID : playerIDs)
309 entity =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
313 return new SCR_ScenarioFrameworkParam<IEntity>(entity);
332 Print(
"ScenarioFramework: GetClosestPlayerEntity - The object the distance is calculated from is missing!", LogLevel.ERROR);
336 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
340 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
344 array<int> playerIDs = {};
345 GetGame().GetPlayerManager().GetPlayers(playerIDs);
347 IEntity closestEntity;
348 IEntity entityToBeChecked;
349 float fDistance =
float.MAX;
350 foreach (
int playerID : playerIDs)
352 entityToBeChecked =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
353 if (!entityToBeChecked)
356 float fActualDistance = vector.DistanceSqXZ(entityFrom.GetOrigin(), entityToBeChecked.GetOrigin());
358 if (fActualDistance < fDistance)
360 closestEntity = entityToBeChecked;
361 fDistance = fActualDistance;
368 return new SCR_ScenarioFrameworkParam<IEntity>(closestEntity);
375 ref array<IEntity> m_aEntities = {};
381 GetPlayerEntities(m_aEntities);
383 return new SCR_ScenarioFrameworkParam<array<IEntity>>(m_aEntities);
388 void GetPlayerEntities(out notnull array<IEntity> aEntities)
390 array<int> playerIDs = {};
391 GetGame().GetPlayerManager().GetPlayers(playerIDs);
393 IEntity playerEntity;
394 foreach (
int playerID : playerIDs)
396 playerEntity =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
400 aEntities.Insert(playerEntity);