4 override bool _WB_GetCustomTitle(BaseContainer source, out
string title)
6 title = source.GetClassName();
7 title.Replace(
"SCR_ScenarioFrameworkAction",
"");
8 string sOriginal = title;
9 SplitStringByUpperCase(sOriginal, title);
17 void SplitStringByUpperCase(
string input, out
string output)
20 bool wasPreviousUpperCase;
22 for (
int i, count = input.Length(); i < count; i++)
24 asciiChar = input.ToAscii(i);
25 bool isLowerCase = (asciiChar > 96 && asciiChar < 123);
26 if (i > 0 && !wasPreviousUpperCase && !isLowerCase)
28 output +=
" " + asciiChar.AsciiToString();
29 wasPreviousUpperCase =
true;
34 wasPreviousUpperCase =
false;
36 output += asciiChar.AsciiToString();
44 class SCR_ScenarioFrameworkActionBase
46 [
Attribute(defvalue:
"-1", uiwidget: UIWidgets.Graph,
params:
"-1 10000 1",
desc:
"How many times this action can be performed if this gets triggered? Value -1 for infinity")]
47 int m_iMaxNumberOfActivations;
50 int m_iNumberOfActivations;
55 void Init(IEntity entity)
57 if (!SCR_BaseTriggerEntity.Cast(entity))
65 ScriptInvoker pOnActivateInvoker = SCR_BaseTriggerEntity.Cast(entity).GetOnActivate();
66 if (pOnActivateInvoker)
69 ScriptInvoker pOnDeactivateInvoker = SCR_BaseTriggerEntity.Cast(entity).GetOnDeactivate();
70 if (pOnDeactivateInvoker)
79 if (m_iMaxNumberOfActivations != -1 && m_iNumberOfActivations >= m_iMaxNumberOfActivations)
82 Print(
string.Format(
"ScenarioFramework Action: Maximum number of activations reached for Action %1 attached on %2. Action won't do anything.",
this,
m_Entity.GetName()), LogLevel.ERROR);
84 Print(
string.Format(
"ScenarioFramework Action: Maximum number of activations reached for Action %1. Action won't do anything.",
this), LogLevel.ERROR);
89 m_iNumberOfActivations++;
99 if (!getter &&
object)
104 Print(
string.Format(
"ScenarioFramework Action: Action %1 attached on %2 is not called from layer and won't do anything.",
this,
object.
GetName()), LogLevel.ERROR);
108 entity = layer.GetSpawnedEntity();
112 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(getter.Get());
116 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
118 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
123 entity = IEntity.Cast(entityWrapper.GetValue());
129 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
131 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
147 void SpawnObjects(notnull array<string> aObjectsNames, SCR_ScenarioFrameworkEActivationType eActivationType)
152 foreach (
string sObjectName : aObjectsNames)
154 object =
GetGame().GetWorld().FindEntityByName(sObjectName);
157 Print(
string.Format(
"ScenarioFramework Action: Can't spawn object set in slot %1. Slot doesn't exist", sObjectName), LogLevel.ERROR);
164 Print(
string.Format(
"Can't spawn object - the slot doesn't have SCR_ScenarioFrameworkLayerBase component", sObjectName), LogLevel.ERROR);
168 layer.Init(
null, eActivationType);
169 layer.SetActivationType(SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT);
177 [
Attribute(uiwidget: UIWidgets.EditBox,
desc:
"Counter to increment")]
178 string m_sCounterName;
181 override void Init(IEntity entity)
190 override void OnActivate(IEntity
object)
198 PrintFormat(
"ScenarioFramework Action: Could not find %1 for Action %2",
m_sCounterName,
this, LogLevel.ERROR);
202 SCR_ScenarioFrameworkLogic counter = SCR_ScenarioFrameworkLogic.Cast(entity.FindComponent(SCR_ScenarioFrameworkLogic));
205 counter.OnInput(1,
object);
209 SCR_ScenarioFrameworkLogicCounter logicCounter = SCR_ScenarioFrameworkLogicCounter.Cast(entity);
211 logicCounter.OnInput(1,
object);
216 class SCR_ScenarioFrameworkActionSpawnObjects : SCR_ScenarioFrameworkActionBase
218 [
Attribute(defvalue:
"", UIWidgets.EditComboBox,
desc:
"These objects will spawn once the trigger becomes active.")]
219 ref array<string> m_aNameOfObjectsToSpawnOnActivation;
227 SpawnObjects(m_aNameOfObjectsToSpawnOnActivation, SCR_ScenarioFrameworkEActivationType.ON_TRIGGER_ACTIVATION);
232 class SCR_ScenarioFrameworkActionSetEntityPosition : SCR_ScenarioFrameworkActionBase
234 [
Attribute(
desc:
"Entity to be teleported (Optional if action is attached on Slot that spawns target entity)")]
237 [
Attribute(defvalue:
"0 0 0",
desc:
"Position that the entity will be teleported to")]
238 vector m_vDestination;
240 [
Attribute(
desc:
"Name of the entity that above selected entity will be teleported to (Optional)")]
243 [
Attribute(defvalue:
"0 0 0",
desc:
"Position that will be used in relation to the entity for the position to teleport to (Optional)")]
244 vector m_vDestinationEntityRelativePosition;
253 if (!ValidateInputEntity(
object, m_EntityGetter, entity))
256 if (!m_DestinationEntityGetter)
258 entity.SetOrigin(m_vDestination);
262 SCR_ScenarioFrameworkParam<IEntity> destinationEntityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_DestinationEntityGetter.Get());
263 if (!destinationEntityWrapper)
265 Print(
string.Format(
"ScenarioFramework Action: Destination Entity Getter has issues for action %1. Action won't do anything.",
this), LogLevel.ERROR);
269 IEntity destinationEntity = IEntity.Cast(destinationEntityWrapper.GetValue());
270 if (!destinationEntity)
272 Print(
string.Format(
"ScenarioFramework Action: Destination Entity could not be found for action %1. Action won't do anything.",
this), LogLevel.ERROR);
276 entity.SetOrigin(destinationEntity.GetOrigin() + m_vDestinationEntityRelativePosition);
281 class SCR_ScenarioFrameworkActionDeleteEntity : SCR_ScenarioFrameworkActionBase
283 [
Attribute(
desc:
"Entity to be deleted (Optional if action is attached on Slot that spawns target entity)")]
293 if (!ValidateInputEntity(
object, m_Getter, entity))
301 class SCR_ScenarioFrameworkActionChangeLayerTerminationStatus : SCR_ScenarioFrameworkActionBase
303 [
Attribute(
desc:
"Name of the layer to change the termination status")]
319 layer.SetIsTerminated(m_bTerminated);
324 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
327 Print(
string.Format(
"ScenarioFramework Action: Getter has issues for action %1. Action won't do anything.",
this), LogLevel.ERROR);
331 IEntity entity = IEntity.Cast(entityWrapper.GetValue());
334 Print(
string.Format(
"ScenarioFramework Action: Entity could not be found for action %1. Action won't do anything.",
this), LogLevel.ERROR);
341 Print(
string.Format(
"ScenarioFramework Action: Entity is not LayerBase for action %1. Action won't do anything.",
this), LogLevel.ERROR);
345 layer.SetIsTerminated(m_bTerminated);
350 class SCR_ScenarioFrameworkActionKillEntity : SCR_ScenarioFrameworkActionBase
352 [
Attribute(
desc:
"Entity to be killed (Optional if action is attached on Slot that spawns target entity)")]
355 [
Attribute(
desc:
"If target entity is Character, it will randomize ragdoll upon death")]
356 bool m_bRandomizeRagdoll;
365 if (!ValidateInputEntity(
object, m_Getter, entity))
368 SCR_DamageManagerComponent damageMananager = SCR_DamageManagerComponent.Cast(entity.FindComponent(SCR_DamageManagerComponent));
370 damageMananager.Kill(
Instigator.CreateInstigator(
object));
372 if (!m_bRandomizeRagdoll)
375 CharacterAnimationComponent animationComponent = CharacterAnimationComponent.Cast(entity.FindComponent(CharacterAnimationComponent));
376 if (!animationComponent)
378 Print(
string.Format(
"ScenarioFramework Action: Entity does not have animation component needed for action %1. Action won't randomize the ragdoll.",
this), LogLevel.ERROR);
384 vector randomDir =
"0 0 0";
385 randomDir[0] = Math.RandomIntInclusive(1, 3);
386 randomDir[1] = Math.RandomIntInclusive(1, 3);
387 randomDir[2] = Math.RandomIntInclusive(1, 3);
389 animationComponent.AddRagdollEffectorDamage(
"1 1 1", randomDir, Math.RandomFloatInclusive(0, 50), Math.RandomFloatInclusive(0, 10), Math.RandomFloatInclusive(0, 20));
394 class SCR_ScenarioFrameworkActionEndMission : SCR_ScenarioFrameworkActionBase
396 [
Attribute(UIWidgets.CheckBox,
desc:
"If true, it will override any previously set game over type with selected one down bellow")]
397 bool m_bOverrideGameOverType;
408 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
412 if (m_bOverrideGameOverType)
413 manager.SetMissionEndScreen(m_eOverriddenGameOverType);
420 class SCR_ScenarioFrameworkActionWaitAndExecute : SCR_ScenarioFrameworkActionBase
422 [
Attribute(
desc:
"How long to wait before executing action")]
423 int m_iDelayInSeconds;
425 [
Attribute(
desc:
"If this is set to a number larger than Delay In Seconds, it will randomize resulted delay between these two values")]
426 int m_iDelayInSecondsMax;
428 [
Attribute(UIWidgets.CheckBox,
desc:
"If true, it will activate actions in looped manner using Delay settings as the frequency. If randomized, it will randomize the time each time it loops.")]
431 [
Attribute(defvalue:
"1",
desc:
"Which actions will be executed once set time passes", UIWidgets.Auto)]
432 ref array<ref SCR_ScenarioFrameworkActionBase>
m_aActions;
438 void ExecuteActions(IEntity
object)
444 if (m_iDelayInSecondsMax > m_iDelayInSeconds)
445 m_iDelay = Math.RandomIntInclusive(m_iDelayInSeconds, m_iDelayInSecondsMax);
448 foreach (SCR_ScenarioFrameworkActionBase actions :
m_aActions)
450 actions.OnActivate(
object);
462 if (m_iDelayInSecondsMax > m_iDelayInSeconds)
463 m_iDelay = Math.RandomIntInclusive(m_iDelayInSeconds, m_iDelayInSecondsMax);
466 GetGame().GetCallqueue().CallLater(ExecuteActions,
m_iDelay * 1000, m_bLooped,
object);
471 class SCR_ScenarioFrameworkActionLoopOverNotRandomlySelectedLayers : SCR_ScenarioFrameworkActionBase
476 [
Attribute(defvalue:
"1",
desc:
"Which actions will be executed for each layer that was not randomly selected", UIWidgets.Auto)]
477 ref array<ref SCR_ScenarioFrameworkActionBase>
m_aActions;
487 Print(
string.Format(
"ScenarioFramework Action: Missing Getter for action %1.",
this), LogLevel.ERROR);
491 SCR_ScenarioFrameworkGetRandomLayerBase randomLayerGetter = SCR_ScenarioFrameworkGetRandomLayerBase.Cast(m_Getter);
492 if (!randomLayerGetter)
494 Print(
string.Format(
"ScenarioFramework Action: Used wrong Getter for Action %1. Use GetRandomLayerBase instead.",
this), LogLevel.ERROR);
498 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
501 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
505 IEntity entity = IEntity.Cast(entityWrapper.GetValue());
508 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
512 string excludedEntity = entity.GetName();
513 IEntity notSelectedEntity;
515 foreach (
string layer : randomLayerGetter.m_aNameOfLayers)
517 if (layer == excludedEntity)
520 notSelectedEntity = m_Getter.FindEntityByName(layer);
521 if (!notSelectedEntity)
524 foreach (SCR_ScenarioFrameworkActionBase actions :
m_aActions)
526 actions.OnActivate(notSelectedEntity);
533 class SCR_ScenarioFrameworkActionCompareCounterAndExecute : SCR_ScenarioFrameworkActionBase
536 [
Attribute(
"0", UIWidgets.ComboBox,
"Operator",
"", ParamEnumArray.FromEnum(SCR_EScenarioFrameworkComparisonOperator))]
537 SCR_EScenarioFrameworkComparisonOperator m_eComparisonOperator;
542 [
Attribute(uiwidget: UIWidgets.EditBox,
desc:
"Counter to increment")]
545 [
Attribute(defvalue:
"1",
desc:
"What to do once counter is reached", UIWidgets.Auto,
category:
"OnActivate")]
546 ref array<ref SCR_ScenarioFrameworkActionBase>
m_aActions;
557 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1 with provided name %1.",
this,
m_sCounterName), LogLevel.ERROR);
562 string className = entity.ClassName();
563 if (className ==
"SCR_ScenarioFrameworkLogicCounter")
565 SCR_ScenarioFrameworkLogicCounter logicCounter = SCR_ScenarioFrameworkLogicCounter.Cast(entity);
566 counterValue = logicCounter.m_iCnt;
570 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.LESS_THAN) && (counterValue <
m_iValue)) ||
571 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.LESS_OR_EQUAL) && (counterValue <=
m_iValue)) ||
572 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.EQUAL) && (counterValue ==
m_iValue)) ||
573 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.GREATER_OR_EQUAL) && (counterValue >=
m_iValue)) ||
574 ((m_eComparisonOperator == SCR_EScenarioFrameworkComparisonOperator.GREATER_THEN) && (counterValue >
m_iValue))
577 foreach (SCR_ScenarioFrameworkActionBase actions :
m_aActions)
579 actions.OnActivate(
object);
586 class SCR_ScenarioFrameworkActionSetMissionEndScreen : SCR_ScenarioFrameworkActionBase
604 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(gamemode.FindComponent(SCR_GameModeSFManager));
610 SCR_GameOverScreenManagerComponent gameOverScreenMgr = SCR_GameOverScreenManagerComponent.Cast(gamemode.FindComponent(SCR_GameOverScreenManagerComponent));
611 if (!gameOverScreenMgr)
615 if (!m_GameOverScreenConfig)
619 m_GameOverScreenConfig.GetGameOverScreenInfo(
m_eGameOverType, targetScreenInfo);
620 if (!targetScreenInfo)
627 optionalParams.m_sSubtitle = m_sSubtitle;
632 class SCR_ScenarioFrameworkActionSetBriefingEntryText : SCR_ScenarioFrameworkActionBase
634 [
Attribute(
desc:
"Faction key that corresponds with the SCR_Faction set in FactionManager")]
641 string m_sTargetText;
653 SCR_RespawnBriefingComponent respawnBriefing = SCR_RespawnBriefingComponent.Cast(gamemode.FindComponent(SCR_RespawnBriefingComponent));
654 if (!respawnBriefing)
658 if (!journalSetupConfig)
665 array<ref SCR_JournalEntry> journalEntries = {};
666 journalEntries = journalConfig.GetEntries();
667 if (journalEntries.IsEmpty())
673 if (journalEntry.GetEntryID() != m_iEntryID)
676 targetJournalEntry = journalEntry;
680 if (!targetJournalEntry)
683 targetJournalEntry.SetEntryText(WidgetManager.Translate(m_sTargetText));
688 class SCR_ScenarioFrameworkActionAppendBriefingEntryText : SCR_ScenarioFrameworkActionBase
690 [
Attribute(
desc:
"Faction key that corresponds with the SCR_Faction set in FactionManager")]
697 string m_sTargetText;
709 SCR_RespawnBriefingComponent respawnBriefing = SCR_RespawnBriefingComponent.Cast(gamemode.FindComponent(SCR_RespawnBriefingComponent));
710 if (!respawnBriefing)
714 if (!journalSetupConfig)
721 array<ref SCR_JournalEntry> journalEntries = {};
722 journalEntries = journalConfig.GetEntries();
723 if (journalEntries.IsEmpty())
729 if (journalEntry.GetEntryID() != m_iEntryID)
732 targetJournalEntry = journalEntry;
736 if (!targetJournalEntry)
739 string finalText = targetJournalEntry.GetEntryText() +
"<br/>" +
"<br/>" + m_sTargetText;
740 targetJournalEntry.SetEntryText(finalText);
745 class SCR_ScenarioFrameworkActionAppendBriefingEntryTextBasedOnTask : SCR_ScenarioFrameworkActionBase
747 [
Attribute(
desc:
"Faction key that corresponds with the SCR_Faction set in FactionManager")]
759 if (!m_Getter || !CanActivate())
762 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
774 SCR_RespawnBriefingComponent respawnBriefing = SCR_RespawnBriefingComponent.Cast(gamemode.FindComponent(SCR_RespawnBriefingComponent));
775 if (!respawnBriefing)
779 if (!journalSetupConfig)
786 array<ref SCR_JournalEntry> journalEntries = {};
787 journalEntries = journalConfig.GetEntries();
788 if (journalEntries.IsEmpty())
794 if (journalEntry.GetEntryID() != m_iEntryID)
797 targetJournalEntry = journalEntry;
801 if (!targetJournalEntry)
804 array<string> previousStrings = {};
805 array<string> taskStrings = {};
806 previousStrings = respawnBriefing.GetBriefingStringParamByID(m_iEntryID);
808 taskStrings.InsertAll(previousStrings);
810 taskStrings.Insert(task.GetTaskExecutionBriefing());
811 taskStrings.Insert(task.GetSpawnedEntityName());
813 respawnBriefing.RewriteEntry_SA(
m_sFactionKey, m_iEntryID, targetJournalEntry.GetEntryText(), taskStrings);
818 class SCR_ScenarioFrameworkActionSetBriefingEntryTextBasedOnGeneratedTasks : SCR_ScenarioFrameworkActionBase
820 [
Attribute(
desc:
"Faction key that corresponds with the SCR_Faction set in FactionManager",
category:
"Asset")]
826 [
Attribute(
desc:
"Text that you want to use. Leave empty if you want to utilize the one set in config.")]
827 string m_sTargetText;
839 SCR_RespawnBriefingComponent respawnBriefing = SCR_RespawnBriefingComponent.Cast(gamemode.FindComponent(SCR_RespawnBriefingComponent));
840 if (!respawnBriefing)
844 if (!journalSetupConfig)
851 array<ref SCR_JournalEntry> journalEntries = {};
852 journalEntries = journalConfig.GetEntries();
853 if (journalEntries.IsEmpty())
859 if (journalEntry.GetEntryID() != m_iEntryID)
862 targetJournalEntry = journalEntry;
870 array<SCR_BaseTask> tasks = {};
871 taskManager.GetTasks(tasks);
873 array<string> taskStrings = {};
876 taskStrings.Insert(task.GetTitle());
877 taskStrings.Insert(
"");
883 tasksToShow = tasksToShow +
"<br/>" +
string.Format(task.GetTitle());
886 if (!targetJournalEntry)
889 if (m_sTargetText.IsEmpty())
890 m_sTargetText = targetJournalEntry.GetEntryText();
892 respawnBriefing.RewriteEntry_SA(
m_sFactionKey, m_iEntryID, m_sTargetText, taskStrings);
897 class SCR_ScenarioFrameworkActionSetExecutionEntryTextBasedOnGeneratedTasks : SCR_ScenarioFrameworkActionBase
899 [
Attribute(
desc:
"Faction key that corresponds with the SCR_Faction set in FactionManager",
category:
"Asset")]
905 [
Attribute(
desc:
"Text that you want to use. Leave empty if you want to utilize the one set in config.")]
906 string m_sTargetText;
918 SCR_RespawnBriefingComponent respawnBriefing = SCR_RespawnBriefingComponent.Cast(gamemode.FindComponent(SCR_RespawnBriefingComponent));
919 if (!respawnBriefing)
923 if (!journalSetupConfig)
930 array<ref SCR_JournalEntry> journalEntries = {};
931 journalEntries = journalConfig.GetEntries();
932 if (journalEntries.IsEmpty())
938 if (journalEntry.GetEntryID() != m_iEntryID)
941 targetJournalEntry = journalEntry;
945 if (!targetJournalEntry)
952 array<SCR_BaseTask> tasks = {};
953 taskManager.GetTasks(tasks);
955 array<SCR_ScenarioFrameworkTask> frameworkTasks = {};
963 array<string> taskStrings = {};
966 taskStrings.Insert(frameworkTask.GetTaskExecutionBriefing());
967 taskStrings.Insert(frameworkTask.GetSpawnedEntityName());
970 if (m_sTargetText.IsEmpty())
971 m_sTargetText = targetJournalEntry.GetEntryText();
973 respawnBriefing.RewriteEntry_SA(
m_sFactionKey, m_iEntryID, m_sTargetText, taskStrings);
978 class SCR_ScenarioFrameworkActionFeedParamToTaskDescription : SCR_ScenarioFrameworkActionBase
980 [
Attribute(
desc:
"Name of the slot task to influence the description parameter")]
983 [
Attribute(
desc:
"Which Prefabs and how many of them will be converted to a description string")]
993 if (!m_Getter &&
object)
999 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
1003 entity = IEntity.Cast(entityWrapper.GetValue());
1008 SCR_ScenarioFrameworkSlotTask slotTask = SCR_ScenarioFrameworkSlotTask.Cast(entity.FindComponent(SCR_ScenarioFrameworkSlotTask));
1012 string descriptionExtension;
1015 IEntitySource entitySource;
1017 IEntityComponentSource editableEntitySource;
1018 IEntityComponentSource weaponEntitySource;
1019 IEntityComponentSource inventoryEntitySource;
1023 resource = Resource.Load(filter.m_sSpecificPrefabName);
1024 if (!resource || !resource.IsValid())
1033 inventoryEntitySource =
SCR_ComponentHelper.GetInventoryItemComponentSource(entitySource);
1035 if (editableEntitySource)
1038 if (editableEntityUiInfo)
1039 displayName = editableEntityUiInfo.GetName();
1041 else if (weaponEntitySource)
1044 if (weaponEntityUiInfo)
1045 displayName = weaponEntityUiInfo.GetName();
1047 else if (inventoryEntitySource)
1050 if (inventoryEntityUiInfo)
1052 UIInfo uiInfo = inventoryEntityUiInfo.GetUIInfo();
1054 displayName = uiInfo.GetName();
1064 int count = filter.m_iPrefabCount;
1066 descriptionExtension += count.ToString() +
"x " + displayName;
1068 descriptionExtension +=
", " + count.ToString() +
"x " + displayName;
1071 slotTask.m_TaskLayer.m_SupportEntity.SetSpawnedEntityName(slotTask.m_TaskLayer.m_Task, descriptionExtension);
1076 class SCR_ScenarioFrameworkActionShowHint : SCR_ScenarioFrameworkActionBase
1090 [
Attribute(
desc:
"Getter to get either a specific player or array of player entities")]
1099 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
1109 playerID = playerManager.GetPlayerIdFromControlledEntity(
object);
1111 array<IEntity> aEntities;
1118 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
1121 SCR_ScenarioFrameworkParam<array<IEntity>> arrayOfEntitiesWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
1122 if (!arrayOfEntitiesWrapper)
1125 aEntities = array<IEntity>.Cast(arrayOfEntitiesWrapper.GetValue());
1131 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
1133 playerID = playerManager.GetPlayerIdFromControlledEntity(entityFrom);
1143 foreach (IEntity entity : aEntities)
1148 playerID = playerManager.GetPlayerIdFromControlledEntity(entity);
1156 class SCR_ScenarioFrameworkActionShowPopupNotification : SCR_ScenarioFrameworkActionBase
1167 [
Attribute(
desc:
"Getter to get either a specific player or array of player entities")]
1176 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
1186 playerID = playerManager.GetPlayerIdFromControlledEntity(
object);
1188 array<IEntity> aEntities;
1195 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
1198 SCR_ScenarioFrameworkParam<array<IEntity>> arrayOfEntitiesWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
1199 if (!arrayOfEntitiesWrapper)
1202 aEntities = array<IEntity>.Cast(arrayOfEntitiesWrapper.GetValue());
1208 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
1210 playerID = playerManager.GetPlayerIdFromControlledEntity(entityFrom);
1220 foreach (IEntity entity : aEntities)
1225 playerID = playerManager.GetPlayerIdFromControlledEntity(entity);
1233 class SCR_ScenarioFrameworkActionSpawnClosestObjectFromList : SCR_ScenarioFrameworkActionBase
1238 [
Attribute(defvalue:
"", UIWidgets.EditComboBox,
desc:
"The closest one from the list will be spawned")]
1239 ref array<string> m_aListOfObjects;
1256 Print(
string.Format(
"ScenarioFramework Action: The object the distance is calculated from is missing!"), LogLevel.ERROR);
1263 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
1266 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
1270 entity = IEntity.Cast(entityWrapper.GetValue());
1273 IEntity entityInList;
1277 Print(
string.Format(
"ScenarioFramework Action: Getter returned null object. Random object spawned instead."), LogLevel.WARNING);
1278 array<string> aRandomObjectToSpawn = {};
1279 aRandomObjectToSpawn.Insert(m_aListOfObjects[m_aListOfObjects.GetRandomIndex()]);
1281 entityInList =
GetGame().GetWorld().FindEntityByName(aRandomObjectToSpawn[0]);
1284 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
1288 SpawnObjects(aRandomObjectToSpawn, SCR_ScenarioFrameworkEActivationType.ON_TRIGGER_ACTIVATION);
1292 IEntity closestEntity;
1293 float fDistance =
float.MAX;
1294 foreach (
string sObjectName : m_aListOfObjects)
1296 entityInList =
GetGame().GetWorld().FindEntityByName(sObjectName);
1299 Print(
string.Format(
"ScenarioFramework Action: Object %1 doesn't exist", sObjectName), LogLevel.ERROR);
1307 float fActualDistance = Math.AbsFloat(vector.Distance(entity.GetOrigin(), entityInList.GetOrigin()));
1309 if (fActualDistance < fDistance)
1311 closestEntity = entityInList;
1312 fDistance = fActualDistance;
1323 selectedLayer.Init(
null, SCR_ScenarioFrameworkEActivationType.ON_TRIGGER_ACTIVATION);
1324 selectedLayer.SetActivationType(SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT);
1328 Print(
string.Format(
"ScenarioFramework Action: Can't spawn slot %1 - the slot doesn't have SCR_ScenarioFrameworkLayerBase component", closestEntity.GetName()), LogLevel.ERROR);
1334 class SCR_ScenarioFrameworkActionSpawnObjectBasedOnDistance : SCR_ScenarioFrameworkActionBase
1336 [
Attribute(
desc:
"Measure distance from what - use getter")]
1339 [
Attribute(
desc:
"It will select only objects that are at least x amount of meters away")]
1342 [
Attribute(
desc:
"You can also set max distance to setup the hard limit of the max distance - but be aware that there might be a situation where it would not spawn anything.")]
1345 [
Attribute(defvalue:
"", UIWidgets.EditComboBox,
desc:
"List of objects that are to be compared")]
1346 ref array<string> m_aListOfObjects;
1351 [
Attribute(defvalue:
"100",
desc:
"If the RANDOM_MULTIPLE option is selected, what's the percentage? ", UIWidgets.Graph,
"0 100 1")]
1355 void SpawnRandomObject(notnull array<string> aObjectsNames)
1357 IEntity
object =
GetGame().GetWorld().FindEntityByName(aObjectsNames.GetRandomElement());
1360 Print(
string.Format(
"ScenarioFramework Action: Can't spawn object set in slot %1. Slot doesn't exist",
object), LogLevel.ERROR);
1367 Print(
string.Format(
"ScenarioFramework Action: Can't spawn object - the slot doesn't have SCR_ScenarioFrameworkLayerBase component",
object), LogLevel.ERROR);
1371 layer.Init(
null, SCR_ScenarioFrameworkEActivationType.ON_TRIGGER_ACTIVATION);
1375 void SpawnRandomMultipleObjects(notnull array<string> aObjectsNames)
1377 array<SCR_ScenarioFrameworkLayerBase> aChildren = {};
1381 foreach (
string objectName : aObjectsNames)
1383 object =
GetGame().GetWorld().FindEntityByName(objectName);
1386 Print(
string.Format(
"ScenarioFramework Action: Can't spawn object set in slot %1. Slot doesn't exist", objectName), LogLevel.ERROR);
1393 Print(
string.Format(
"ScenarioFramework Action: Can't spawn object - the slot doesn't have SCR_ScenarioFrameworkLayerBase component", objectName), LogLevel.ERROR);
1398 cachedLayer = layer;
1400 if (!aChildren.Contains(layer))
1401 aChildren.Insert(layer);
1404 if (aChildren.IsEmpty())
1408 m_iRandomPercent = Math.Ceil(cachedLayer.GetPlayersCount() / cachedLayer.GetMaxPlayersForGameMode() * 100);
1410 int randomMultipleNumber = Math.Round(aObjectsNames.Count() * 0.01 *
m_iRandomPercent);
1412 for (
int i = 1; i <= randomMultipleNumber; i++)
1414 if (aChildren.IsEmpty())
1418 child = aChildren.GetRandomElement();
1419 child.Init(
null, SCR_ScenarioFrameworkEActivationType.ON_TRIGGER_ACTIVATION);
1420 child.SetActivationType(SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT);
1421 aChildren.RemoveItem(child);
1436 entityFrom = object;
1440 Print(
string.Format(
"ScenarioFramework Action: The object the distance is calculated from is missing!"), LogLevel.ERROR);
1445 array<IEntity> aEntities = {};
1449 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
1452 SCR_ScenarioFrameworkParam<array<IEntity>> arrayOfEntitiesWrapper = SCR_ScenarioFrameworkParam<array<IEntity>>.Cast(m_Getter.Get());
1453 if (!arrayOfEntitiesWrapper)
1455 Print(
string.Format(
"ScenarioFramework Action: Issue with Array Getter detected for Action %1.",
this), LogLevel.ERROR);
1459 aEntities = array<IEntity>.Cast(arrayOfEntitiesWrapper.GetValue());
1462 Print(
string.Format(
"ScenarioFramework Action: Issue with retrieved array detected for Action %1.",
this), LogLevel.ERROR);
1466 if (!entityFrom && entityWrapper)
1467 entityFrom = IEntity.Cast(entityWrapper.GetValue());
1471 bool entitiesAreEmpty = aEntities.IsEmpty();
1474 IEntity entityInList;
1476 if (!entityFrom && entitiesAreEmpty)
1478 Print(
string.Format(
"ScenarioFramework Action: Getter returned null object. Random object spawned instead."), LogLevel.WARNING);
1479 array<string> aRandomObjectToSpawn = {};
1480 aRandomObjectToSpawn.Insert(m_aListOfObjects[m_aListOfObjects.GetRandomIndex()]);
1482 entityInList =
GetGame().GetWorld().FindEntityByName(aRandomObjectToSpawn[0]);
1485 Print(
string.Format(
"ScenarioFramework Action: Object %1 doesn't exist", aRandomObjectToSpawn[0]), LogLevel.ERROR);
1489 SpawnObjects(aRandomObjectToSpawn, SCR_ScenarioFrameworkEActivationType.ON_TRIGGER_ACTIVATION);
1493 array<string> aObjectsNames = {};
1495 foreach (
string objectName : m_aListOfObjects)
1497 entityInList =
GetGame().GetWorld().FindEntityByName(objectName);
1500 Print(
string.Format(
"ScenarioFramework Action: Object %1 doesn't exist", objectName), LogLevel.ERROR);
1504 if (entitiesAreEmpty)
1506 float fActualDistance = Math.AbsFloat(vector.Distance(entityFrom.GetOrigin(), entityInList.GetOrigin()));
1508 if (fActualDistance <= m_iMaxDistance && fActualDistance >= m_iMinDistance)
1509 aObjectsNames.Insert(objectName)
1514 foreach (IEntity targetEntity : aEntities)
1516 float fActualDistance = Math.AbsFloat(vector.Distance(targetEntity.GetOrigin(), entityInList.GetOrigin()));
1518 if (fActualDistance <= m_iMaxDistance && fActualDistance >= m_iMinDistance)
1520 entityInRange =
true;
1524 entityInRange =
false;
1530 aObjectsNames.Insert(objectName)
1537 GetGame().GetCallqueue().CallLater(SpawnRandomObject, Math.RandomInt(1, 10),
false, aObjectsNames);
1543 foreach (
string objectName : aObjectsNames)
1545 entityInList =
GetGame().GetWorld().FindEntityByName(objectName);
1553 area.SetAreaSelected(
true);
1554 SCR_ScenarioFrameworkLayerTask layerTask = SCR_ScenarioFrameworkLayerTask.Cast(selectedLayer);
1556 selectedLayer.GetParentArea().SetLayerTask(layerTask);
1558 selectedLayer.Init(area, SCR_ScenarioFrameworkEActivationType.ON_TRIGGER_ACTIVATION);
1559 selectedLayer.SetActivationType(SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT);
1563 Print(
string.Format(
"ScenarioFramework Action: Can't spawn slot %1 - the slot doesn't have SCR_ScenarioFrameworkLayerBase component", selectedLayer.GetName()), LogLevel.ERROR);
1570 SpawnRandomMultipleObjects(aObjectsNames);
1575 class SCR_ScenarioFrameworkActionItemSafeguard : SCR_ScenarioFrameworkActionBase
1577 [
Attribute(
desc:
"Target entity (Optional if action is attached on Slot that spawns target entity)")]
1580 [
Attribute(
desc:
"Actions that will be executed when target item is dropped", UIWidgets.Auto)]
1581 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnItemDropped;
1583 [
Attribute(
desc:
"Actions that will be executed when target item is possesed by someone/something", UIWidgets.Auto)]
1584 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsOnItemPossessed;
1586 protected IEntity m_ItemEntity;
1589 void OnItemPossessed(IEntity item, BaseInventoryStorageComponent pStorageOwner)
1591 if(!item || item != m_ItemEntity)
1594 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnItemPossessed)
1596 action.OnActivate(pStorageOwner.GetOwner());
1601 void OnItemDropped(IEntity item, BaseInventoryStorageComponent pStorageOwner)
1603 if(!item || item != m_ItemEntity)
1606 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsOnItemDropped)
1608 action.OnActivate(pStorageOwner.GetOwner());
1615 EventHandlerManagerComponent eventHandlerMgr;
1618 eventHandlerMgr = EventHandlerManagerComponent.Cast(oldSlot.GetOwner().FindComponent(EventHandlerManagerComponent));
1619 if (eventHandlerMgr)
1620 eventHandlerMgr.RemoveScriptHandler(
"OnDestroyed",
this,
OnDestroyed);
1625 eventHandlerMgr = EventHandlerManagerComponent.Cast(newSlot.GetOwner().FindComponent(EventHandlerManagerComponent));
1626 if (eventHandlerMgr)
1627 eventHandlerMgr.RegisterScriptHandler(
"OnDestroyed",
this,
OnDestroyed);
1633 protected void OnDestroyed(IEntity destroyedEntity)
1635 if (!destroyedEntity)
1650 if (!inventoryComponent)
1653 if (!inventoryComponent.Contains(m_ItemEntity))
1656 inventoryComponent.TryRemoveItemFromStorage(m_ItemEntity, parentSlot.GetStorage());
1657 m_ItemEntity.SetOrigin(destroyedEntity.GetOrigin());
1663 IEntity player =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
1671 protected void RegisterPlayer(
int playerID, IEntity playerEntity)
1673 IEntity player =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
1677 SCR_InventoryStorageManagerComponent inventoryComponent = SCR_InventoryStorageManagerComponent.Cast(player.FindComponent(SCR_InventoryStorageManagerComponent));
1678 if (!inventoryComponent)
1681 inventoryComponent.m_OnItemAddedInvoker.Insert(OnItemPossessed);
1682 inventoryComponent.m_OnItemRemovedInvoker.Insert(OnItemDropped);
1684 EventHandlerManagerComponent eventHandlerMgr = EventHandlerManagerComponent.Cast(player.FindComponent(EventHandlerManagerComponent));
1685 if (eventHandlerMgr)
1686 eventHandlerMgr.RegisterScriptHandler(
"OnDestroyed",
this,
OnDestroyed);
1695 if (!ValidateInputEntity(
object, m_Getter, m_ItemEntity))
1702 invComp.m_OnParentSlotChangedInvoker.Insert(OnItemCarrierChanged);
1704 array<int> aPlayerIDs = {};
1705 int iNrOfPlayersConnected =
GetGame().GetPlayerManager().GetPlayers(aPlayerIDs);
1707 foreach (
int playerID : aPlayerIDs)
1709 RegisterPlayer(playerID,
null);
1716 gameMode.GetOnPlayerSpawned().Insert(RegisterPlayer);
1722 class SCR_ScenarioFrameworkActionAddItemToInventory : SCR_ScenarioFrameworkActionBase
1724 [
Attribute(
desc:
"Target entity (Optional if action is attached on Slot that spawns target entity)")]
1727 [
Attribute(
desc:
"Which Prefabs and how many out of each will be added to the inventory of target entity")]
1728 ref array<ref SCR_ScenarioFrameworkPrefabFilterCountNoInheritance>
m_aPrefabFilter
1737 if (!ValidateInputEntity(
object, m_Getter, entity))
1741 if (!inventoryComponent)
1744 Print(
string.Format(
"ScenarioFramework Action: Inventory Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
1746 Print(
string.Format(
"ScenarioFramework Action: Inventory Component not found for Action %1.",
this), LogLevel.ERROR);
1751 EntitySpawnParams spawnParams =
new EntitySpawnParams();
1752 entity.GetWorldTransform(spawnParams.Transform);
1753 spawnParams.TransformMode = ETransformMode.WORLD;
1755 vector angles = Math3D.MatrixToAngles(spawnParams.Transform);
1756 Math3D.AnglesToMatrix(angles, spawnParams.Transform);
1758 foreach (SCR_ScenarioFrameworkPrefabFilterCountNoInheritance prefabFilter :
m_aPrefabFilter)
1760 for (
int i = 0; i < prefabFilter.m_iPrefabCount; i++)
1762 Resource resource = Resource.Load(prefabFilter.m_sPrefabName);
1766 IEntity item =
GetGame().SpawnEntityPrefab(resource,
GetGame().GetWorld(), spawnParams);
1770 SCR_InvCallBackCheck pInvCallback =
new SCR_InvCallBackCheck();
1771 pInvCallback.m_sNameMaster = entity.GetName();
1772 pInvCallback.m_sNameItem = item.GetName();
1774 inventoryComponent.TryInsertItem(item,
EStoragePurpose.PURPOSE_ANY, pInvCallback)
1781 class SCR_ScenarioFrameworkActionRemoveItemFromInventory : SCR_ScenarioFrameworkActionBase
1783 [
Attribute(
desc:
"Target entity (Optional if action is attached on Slot that spawns target entity)")]
1786 [
Attribute(
desc:
"Which Prefabs and how many out of each will be added to the inventory of target entity")]
1787 ref array<ref SCR_ScenarioFrameworkPrefabFilterCount>
m_aPrefabFilter;
1793 GetGame().GetCallqueue().CallLater(OnActivateCalledLater, 1000,
false,
object);
1798 void OnActivateCalledLater(IEntity
object)
1804 if (!ValidateInputEntity(
object, m_Getter, entity))
1808 if (!inventoryComponent)
1811 Print(
string.Format(
"ScenarioFramework Action: Inventory Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
1813 Print(
string.Format(
"ScenarioFramework Action: Inventory Component not found for Action %1.",
this), LogLevel.ERROR);
1818 array<IEntity> items = {};
1819 inventoryComponent.GetItems(items);
1820 if (items.IsEmpty())
1824 BaseContainer prefabContainer;
1825 array<IEntity> itemsToRemove = {};
1828 resource = Resource.Load(prefabFilter.m_sSpecificPrefabName);
1829 if (!resource.IsValid())
1832 prefabContainer = resource.GetResource().ToBaseContainer();
1833 if (!prefabContainer)
1837 int targetCount = prefabFilter.m_iPrefabCount;
1839 bool includeInheritance = prefabFilter.m_bIncludeChildren;
1841 foreach (IEntity item : items)
1846 EntityPrefabData prefabData = item.GetPrefabData();
1850 BaseContainer container = prefabData.GetPrefab();
1854 if (!includeInheritance)
1856 if (container != prefabContainer)
1859 itemsToRemove.Insert(item);
1861 if (count == targetCount)
1868 if (container == prefabContainer)
1870 itemsToRemove.Insert(item);
1875 container = container.GetAncestor();
1879 if (count == targetCount)
1883 for (
int i = itemsToRemove.Count() - 1; i >= 0; i--)
1885 inventoryComponent.TryDeleteItem(itemsToRemove[i]);
1892 class SCR_ScenarioFrameworkActionCountInventoryItemsAndExecuteAction : SCR_ScenarioFrameworkActionBase
1894 [
Attribute(
desc:
"Target entity (Optional if action is attached on Slot that spawns target entity)")]
1897 [
Attribute(
desc:
"Which Prefabs and how many out of each will be added to the inventory of target entity")]
1898 ref array<ref SCR_ScenarioFrameworkPrefabFilterCount>
m_aPrefabFilter;
1900 [
Attribute(UIWidgets.Auto,
desc:
"If conditions from Prefab Filter are true, it will execute these actions")]
1901 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActionsToExecute;
1910 if (!ValidateInputEntity(
object, m_Getter, entity))
1914 if (!inventoryComponent)
1917 Print(
string.Format(
"ScenarioFramework Action: Inventory Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
1919 Print(
string.Format(
"ScenarioFramework Action: Inventory Component not found for Action %1.",
this), LogLevel.ERROR);
1924 array<IEntity> items = {};
1925 inventoryComponent.GetItems(items);
1926 if (items.IsEmpty())
1929 bool countCondition;
1931 BaseContainer prefabContainer;
1934 resource = Resource.Load(prefabFilter.m_sSpecificPrefabName);
1935 if (!resource.IsValid())
1938 prefabContainer = resource.GetResource().ToBaseContainer();
1939 if (!prefabContainer)
1943 int targetCount = prefabFilter.m_iPrefabCount;
1944 bool includeInheritance = prefabFilter.m_bIncludeChildren;
1945 countCondition =
false;
1947 foreach (IEntity item : items)
1952 EntityPrefabData prefabData = item.GetPrefabData();
1956 BaseContainer container = prefabData.GetPrefab();
1960 if (!includeInheritance)
1962 if (container != prefabContainer)
1966 if (count == targetCount)
1968 countCondition =
true;
1976 if (container == prefabContainer)
1982 container = container.GetAncestor();
1986 if (count == targetCount)
1988 countCondition =
true;
1994 if (!countCondition)
2000 foreach (SCR_ScenarioFrameworkActionBase action : m_aActionsToExecute)
2002 action.OnActivate(
object);
2009 class SCR_ScenarioFrameworkActionLockOrUnlockAllTargetVehiclesInTrigger : SCR_ScenarioFrameworkActionBase
2014 [
Attribute(defvalue:
"true",
desc:
"If set to true, it will lock all vehicles, if set to false it will unlock all vehicles")]
2025 if (m_iMaxNumberOfActivations != -1 && m_iNumberOfActivations >= m_iMaxNumberOfActivations)
2030 trigger.GetOnDeactivate().Remove(
OnActivate);
2036 m_iNumberOfActivations++;
2048 array<IEntity> entitesInside = {};
2049 trigger.GetEntitiesInside(entitesInside);
2050 if (entitesInside.IsEmpty())
2053 foreach (IEntity entity : entitesInside)
2055 if (!Vehicle.Cast(entity))
2058 SCR_VehicleSpawnProtectionComponent spawnProtectionComponent = SCR_VehicleSpawnProtectionComponent.Cast(entity.FindComponent(SCR_VehicleSpawnProtectionComponent));
2061 spawnProtectionComponent.SetProtectOnlyDriverSeat(
false);
2062 spawnProtectionComponent.SetReasonText(
"#AR-Campaign_Action_BuildBlocked-UC");
2063 spawnProtectionComponent.SetVehicleOwner(-2);
2067 spawnProtectionComponent.SetProtectOnlyDriverSeat(
true);
2068 spawnProtectionComponent.SetReasonText(
"#AR-Campaign_Action_CannotEnterVehicle-UC");
2069 spawnProtectionComponent.ReleaseProtection();
2078 if (!CanActivateTriggerVariant(
object, trigger))
2083 LockOrUnlockAllVehicles(trigger);
2089 Print(
string.Format(
"ScenarioFramework Action: Getter not found for Action %1.",
this), LogLevel.ERROR);
2093 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
2096 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
2100 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
2103 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
2110 LockOrUnlockAllVehicles(trigger);
2117 class SCR_ScenarioFrameworkActionLockOrUnlockVehicle : SCR_ScenarioFrameworkActionBase
2119 [
Attribute(
desc:
"Target entity (Optional if action is attached on Slot that spawns target entity)")]
2122 [
Attribute(defvalue:
"true",
desc:
"If set to true, it will lock the vehicle, if set to false it will unlock the vehicle")]
2132 if (!ValidateInputEntity(
object, m_Getter, entity))
2135 if (!Vehicle.Cast(entity))
2138 SCR_VehicleSpawnProtectionComponent spawnProtectionComponent = SCR_VehicleSpawnProtectionComponent.Cast(entity.FindComponent(SCR_VehicleSpawnProtectionComponent));
2139 if (!spawnProtectionComponent)
2142 Print(
string.Format(
"ScenarioFramework Action: Spawn Protection Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2144 Print(
string.Format(
"ScenarioFramework Action: Spawn Protection Component Component not found for Action %1.",
this), LogLevel.ERROR);
2151 spawnProtectionComponent.SetProtectOnlyDriverSeat(
false);
2152 spawnProtectionComponent.SetReasonText(
"#AR-Campaign_Action_BuildBlocked-UC");
2153 spawnProtectionComponent.SetVehicleOwner(-2);
2157 spawnProtectionComponent.SetProtectOnlyDriverSeat(
true);
2158 spawnProtectionComponent.SetReasonText(
"#AR-Campaign_Action_CannotEnterVehicle-UC");
2159 spawnProtectionComponent.ReleaseProtection();
2165 class SCR_ScenarioFrameworkActionFailTaskIfVehiclesInTriggerDestroyed : SCR_ScenarioFrameworkActionBase
2170 [
Attribute(
desc:
"Target Layer Task. If this is attached to the Layer Task you intend to work with, you can leave it empty")]
2171 string m_sTargetLayerTask;
2173 [
Attribute(defvalue:
"false",
desc:
"If set to true, it will fail the task only when player caused the destruction")]
2174 bool m_bCausedByPlayer;
2176 bool m_bAlreadyDestroyed;
2178 ref array<IEntity> m_aTargetEntities = {};
2188 if (m_iMaxNumberOfActivations != -1 && m_iNumberOfActivations >= m_iMaxNumberOfActivations)
2193 trigger.GetOnDeactivate().Remove(
OnActivate);
2199 m_iNumberOfActivations++;
2215 SCR_ScenarioFrameworkLayerTask layerTask = SCR_ScenarioFrameworkLayerTask.Cast(
object.FindComponent(SCR_ScenarioFrameworkLayerTask));
2219 m_Task = layerTask.GetTask();
2223 array<IEntity> entitesInside = {};
2224 trigger.GetEntitiesInside(entitesInside);
2225 if (entitesInside.IsEmpty())
2228 foreach (IEntity entity : entitesInside)
2230 if (!Vehicle.Cast(entity))
2233 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(entity.FindComponent(SCR_DamageManagerComponent));
2234 if (objectDmgManager)
2236 m_aTargetEntities.Insert(entity);
2237 objectDmgManager.GetOnDamageStateChanged().Insert(
OnObjectDamage);
2246 if (state !=
EDamageState.DESTROYED || m_bAlreadyDestroyed)
2249 if (m_bCausedByPlayer)
2251 bool destroyedByPlayer;
2252 foreach (IEntity entity : m_aTargetEntities)
2254 SCR_DamageManagerComponent objectDmgManager = SCR_DamageManagerComponent.Cast(entity.FindComponent(SCR_DamageManagerComponent));
2255 if (!objectDmgManager)
2258 if (objectDmgManager.GetState() ==
EDamageState.DESTROYED)
2261 Instigator instigator = objectDmgManager.GetInstigator();
2266 if (instigatorType && instigatorType ==
InstigatorType.INSTIGATOR_PLAYER)
2268 destroyedByPlayer =
true;
2274 if (!destroyedByPlayer)
2282 m_bAlreadyDestroyed =
true;
2284 supportEntity.FailTask(
m_Task);
2290 if (!m_sTargetLayerTask.IsEmpty())
2292 IEntity entity =
GetGame().GetWorld().FindEntityByName(m_sTargetLayerTask);
2298 if (!CanActivateTriggerVariant(
object, trigger))
2303 AddListener(
object, trigger);
2309 Print(
string.Format(
"ScenarioFramework Action: Getter not found for Action %1.",
this), LogLevel.ERROR);
2313 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
2316 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
2320 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
2323 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
2330 AddListener(
object, trigger);
2335 class SCR_ScenarioFrameworkActionOnCompartmentEnteredOrLeft : SCR_ScenarioFrameworkActionBase
2337 [
Attribute(defvalue:
"1", UIWidgets.CheckBox,
desc:
"If true, we execute actions On Compartmented Entered. Otherwise On Compartment Left")]
2338 bool m_bEnteredOrLeft;
2340 [
Attribute(
desc:
"Target entity (Optional if action is attached on Slot that spawns target entity)")]
2343 [
Attribute(
desc:
"(Optional) If used, it will get executed only when specific entity enters the compartment")]
2346 [
Attribute(
desc:
"(Optional) If used, it will get executed only when specific compartment slots are entered")]
2347 ref array<int> m_aSlotIDs;
2349 [
Attribute(
desc:
"Actions that will be executed on compartment entered", UIWidgets.Auto)]
2350 ref array<ref SCR_ScenarioFrameworkActionBase>
m_aActions;
2352 IEntity m_OccupantEntity;
2360 void OnCompartmentEnteredOrLeft(IEntity vehicle, BaseCompartmentManagerComponent mgr, IEntity occupant,
int managerId,
int slotID)
2362 if (m_OccupantEntity && occupant != m_OccupantEntity)
2365 if (m_aSlotIDs && !m_aSlotIDs.IsEmpty() && !m_aSlotIDs.Contains(slotID))
2368 foreach (SCR_ScenarioFrameworkActionBase actions :
m_aActions)
2381 if (!ValidateInputEntity(
object, m_Getter, entity))
2384 if (m_OccupantGetter)
2386 SCR_ScenarioFrameworkParam<IEntity> occupantWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_OccupantGetter.Get());
2387 if (!occupantWrapper)
2390 m_OccupantEntity = IEntity.Cast(occupantWrapper.GetValue());
2391 if (!m_OccupantEntity)
2395 if (Vehicle.Cast(entity))
2397 EventHandlerManagerComponent ehManager = EventHandlerManagerComponent.Cast(entity.FindComponent(EventHandlerManagerComponent));
2401 Print(
string.Format(
"ScenarioFramework Action: Event Handler Manager Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2403 Print(
string.Format(
"ScenarioFramework Action: Event Handler Manager Component not found for Action %1.",
this), LogLevel.ERROR);
2408 if (m_bEnteredOrLeft)
2409 ehManager.RegisterScriptHandler(
"OnCompartmentEntered",
this, OnCompartmentEnteredOrLeft,
true,
false);
2411 ehManager.RegisterScriptHandler(
"OnCompartmentLeft",
this, OnCompartmentEnteredOrLeft,
true,
false);
2417 class SCR_ScenarioFrameworkActionOnEngineStartedOrStop : SCR_ScenarioFrameworkActionBase
2419 [
Attribute(defvalue:
"1", UIWidgets.CheckBox,
desc:
"If true, we execute actions On Engine Started. Otherwise On Engine Stop")]
2420 bool m_bStartedOrStop;
2422 [
Attribute(
desc:
"Target entity (Optional if action is attached on Slot that spawns target entity)")]
2425 [
Attribute(
desc:
"Actions that will be executed on one of these circumstances", UIWidgets.Auto)]
2426 ref array<ref SCR_ScenarioFrameworkActionBase>
m_aActions;
2429 void OnEngineStartedOrStop()
2431 foreach (SCR_ScenarioFrameworkActionBase actions :
m_aActions)
2444 if (!ValidateInputEntity(
object, m_Getter, entity))
2447 VehicleControllerComponent_SA vehicleController = VehicleControllerComponent_SA.Cast(entity.FindComponent(VehicleControllerComponent_SA));
2448 if (!vehicleController)
2451 Print(
string.Format(
"ScenarioFramework Action: Vehicle Controller Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2453 Print(
string.Format(
"ScenarioFramework Action: Vehicle Controller Component not found for Action %1.",
this), LogLevel.ERROR);
2458 if (m_bStartedOrStop)
2459 vehicleController.GetOnEngineStart().Insert(OnEngineStartedOrStop);
2461 vehicleController.GetOnEngineStop().Insert(OnEngineStartedOrStop);
2466 class SCR_ScenarioFrameworkActionToggleLights : SCR_ScenarioFrameworkActionBase
2468 [
Attribute(
desc:
"Target entity to manipulate lights with (Optional if action is attached on Slot that spawns target entity)")]
2474 [
Attribute(defvalue:
"1",
desc:
"If true, light will be turned on. Otherwise it will turn it off.")]
2484 if (!ValidateInputEntity(
object, m_Getter, entity))
2487 BaseLightManagerComponent lightManager = BaseLightManagerComponent.Cast(entity.FindComponent(BaseLightManagerComponent));
2491 Print(
string.Format(
"ScenarioFramework Action: Light Manager Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2493 Print(
string.Format(
"ScenarioFramework Action: Light Manager Component not found for Action %1.",
this), LogLevel.ERROR);
2498 lightManager.SetLightsState(m_eLightType, m_bTurnedOn);
2503 class SCR_ScenarioFrameworkActionToggleEngine : SCR_ScenarioFrameworkActionBase
2505 [
Attribute(
desc:
"Target entity to turn on/off the engine (Optional if action is attached on Slot that spawns target entity")]
2508 [
Attribute(defvalue:
"1",
desc:
"If true, engine will be turned on. Otherwise it will turn it off.")]
2518 if (!ValidateInputEntity(
object, m_Getter, entity))
2521 VehicleWheeledSimulation_SA vehicleSimulation = VehicleWheeledSimulation_SA.Cast(entity.FindComponent(VehicleWheeledSimulation_SA));
2522 if (!vehicleSimulation)
2525 Print(
string.Format(
"ScenarioFramework Action: Vehicle Wheeled Simulation Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2527 Print(
string.Format(
"ScenarioFramework Action: Vehicle Wheeled Simulation Component not found for Action %1.",
this), LogLevel.ERROR);
2533 vehicleSimulation.EngineStart();
2535 vehicleSimulation.EngineStop();
2540 class SCR_ScenarioFrameworkActionDamageWheel : SCR_ScenarioFrameworkActionBase
2542 [
Attribute(
desc:
"Target entity to manipulate fuel (Optional if action is attached on Slot that spawns target entity")]
2545 [
Attribute(defvalue:
"",
desc:
"Name of Slots that are defined on the SlotManagerComponent on target vehicle")]
2546 ref array<string> m_aSlotNamesOnSlotManager;
2548 [
Attribute(defvalue:
"100",
desc:
"Health Percentage to be set for target wheels", UIWidgets.Graph,
"0 100 1")]
2549 int m_iHealthPercentage;
2558 if (!ValidateInputEntity(
object, m_Getter, entity))
2561 SlotManagerComponent slotManager = SlotManagerComponent.Cast(entity.FindComponent(SlotManagerComponent));
2565 Print(
string.Format(
"ScenarioFramework Action: Slot Manager Component not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2567 Print(
string.Format(
"ScenarioFramework Action: Slot Manager Component not found for Action %1.",
this), LogLevel.ERROR);
2572 foreach (
string slotName : m_aSlotNamesOnSlotManager)
2578 Print(
string.Format(
"ScenarioFramework Action: Name of the slot %1 not found on target entity for Action %2 attached on %3.", slotName,
this,
object.
GetName()), LogLevel.ERROR);
2580 Print(
string.Format(
"ScenarioFramework Action: Name of the slot %1 not found on target entity for Action %1.", slotName,
this), LogLevel.ERROR);
2585 IEntity wheelEntity = slotInfo.GetAttachedEntity();
2589 Print(
string.Format(
"ScenarioFramework Action: Retrieving target wheel entity failed for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2591 Print(
string.Format(
"ScenarioFramework Action: Retrieving target wheel entity failed for Action %1.",
this), LogLevel.ERROR);
2596 SCR_DamageManagerComponent damageManager = SCR_DamageManagerComponent.GetDamageManager(wheelEntity);
2600 Print(
string.Format(
"ScenarioFramework Action: Retrieving Damage Manager of target entity failed for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2602 Print(
string.Format(
"ScenarioFramework Action: Retrieving Damage Manager of target entity failed for Action %1.",
this), LogLevel.ERROR);
2607 damageManager.SetHealthScaled(m_iHealthPercentage * 0.01);
2613 class SCR_ScenarioFrameworkActionSetFuelPercentage : SCR_ScenarioFrameworkActionBase
2615 [
Attribute(
desc:
"Target entity to manipulate fuel (Optional if action is attached on Slot that spawns target entity")]
2618 [
Attribute(defvalue:
"75",
desc:
"Percentage of a fuel to be set.", UIWidgets.Graph,
"0 100 1")]
2619 int m_iFuelPercentage;
2628 if (!ValidateInputEntity(
object, m_Getter, entity))
2631 array<SCR_FuelManagerComponent> fuelManagers = {};
2633 if (fuelManagers.IsEmpty())
2636 Print(
string.Format(
"ScenarioFramework Action: No Fuel Managers found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
2638 Print(
string.Format(
"ScenarioFramework Action: No Fuel Managers found for Action %1.",
this), LogLevel.ERROR);
2643 SCR_FuelManagerComponent.SetTotalFuelPercentageOfFuelManagers(fuelManagers, m_iFuelPercentage * 0.01, 0, SCR_EFuelNodeTypeFlag.IS_FUEL_STORAGE);
2648 class SCR_ScenarioFrameworkActionChangeTriggerActivationPresence : SCR_ScenarioFrameworkActionBase
2653 [
Attribute(
"0", UIWidgets.ComboBox,
"By whom the trigger is activated",
"", ParamEnumArray.FromEnum(TA_EActivationPresence),
category:
"Trigger")]
2664 if (m_iMaxNumberOfActivations != -1 && m_iNumberOfActivations >= m_iMaxNumberOfActivations)
2669 trigger.GetOnDeactivate().Remove(
OnActivate);
2675 m_iNumberOfActivations++;
2683 if (!CanActivateTriggerVariant(
object, trigger))
2694 Print(
string.Format(
"ScenarioFramework Action: Getter not found for Action %1.",
this), LogLevel.ERROR);
2698 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
2701 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
2705 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
2708 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
2715 Print(
string.Format(
"ScenarioFramework Action: Entity is not Layer Base for Action %1.",
this), LogLevel.ERROR);
2726 IEntity entity = layer.GetSpawnedEntity();
2727 if (!BaseGameTriggerEntity.Cast(entity))
2729 Print(
string.Format(
"ScenarioFramework Action: SlotTrigger - The selected prefab is not trigger!"), LogLevel.ERROR);
2740 class SCR_ScenarioFrameworkActionChangeLayerActivationType : SCR_ScenarioFrameworkActionBase
2745 [
Attribute(
"0", uiwidget: UIWidgets.ComboBox,
"",
"", ParamEnumArray.FromEnum(SCR_ScenarioFrameworkEActivationType),
category:
"Activation")]
2756 Print(
string.Format(
"ScenarioFramework Action: Getter not found for Action %1.",
this), LogLevel.ERROR);
2760 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
2763 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
2767 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
2770 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
2777 Print(
string.Format(
"ScenarioFramework Action: Entity is not Layer Base for Action %1.",
this), LogLevel.ERROR);
2786 class SCR_ScenarioFrameworkActionRestoreLayerToDefault : SCR_ScenarioFrameworkActionBase
2788 [
Attribute(
desc:
"Layer to be restored to default (Optional if action is attached on layer that is supposed to be restored to default)")]
2791 [
Attribute(defvalue:
"true",
desc:
"If checked, it will also restore child layers to default state as well.")]
2794 [
Attribute(
desc:
"If checked, it will reinit the layer after the restoration")]
2795 bool m_bReinitAfterRestoration;
2804 if (!ValidateInputEntity(
object, m_Getter, entity))
2810 Print(
string.Format(
"ScenarioFramework Action: Entity is not Layer Base for Action %1.",
this), LogLevel.ERROR);
2819 class SCR_ScenarioFrameworkActionPrepareAreaFromDynamicDespawn : SCR_ScenarioFrameworkActionBase
2824 [
Attribute(
desc:
"If set to false, area will be despawned")]
2825 bool m_bStaySpawned;
2827 [
Attribute(defvalue:
"750",
desc:
"How close at least one observer camera must be in order to trigger dynamic spawn/despawn")]
2828 int m_iDynamicDespawnRange;
2838 Print(
string.Format(
"ScenarioFramework Action: Getter not found for Action %1.",
this), LogLevel.ERROR);
2842 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
2846 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
2849 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
2853 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
2856 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
2863 Print(
string.Format(
"ScenarioFramework Action: Entity is not Area for Action %1.",
this), LogLevel.ERROR);
2867 area.SetDynamicDespawnRange(m_iDynamicDespawnRange);
2868 manager.PrepareAreaSpecificDynamicDespawn(area, m_bStaySpawned);
2873 class SCR_ScenarioFrameworkActionRemoveAreaFromDynamicDespawn : SCR_ScenarioFrameworkActionBase
2878 [
Attribute(
desc:
"If set to false, area will be despawned")]
2879 bool m_bStaySpawned;
2889 Print(
string.Format(
"ScenarioFramework Action: Getter not found for Action %1.",
this), LogLevel.ERROR);
2893 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
2897 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
2900 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
2904 IEntity entityFrom = IEntity.Cast(entityWrapper.GetValue());
2907 Print(
string.Format(
"ScenarioFramework Action: Entity not found for Action %1.",
this), LogLevel.ERROR);
2914 Print(
string.Format(
"ScenarioFramework Action: Entity is not Area for Action %1.",
this), LogLevel.ERROR);
2918 manager.RemoveAreaSpecificDynamicDespawn(area, m_bStaySpawned);
2923 class SCR_ScenarioFrameworkActionPlaySound : SCR_ScenarioFrameworkActionBase
2934 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
2938 GetGame().GetCallqueue().CallLater(manager.PlaySoundOnEntity, 2000,
false,
null, m_sSound);
2943 class SCR_ScenarioFrameworkActionPlaySoundOnEntity : SCR_ScenarioFrameworkActionBase
2945 [
Attribute(
desc:
"Entity to play the sound on (Optional if action is attached on Slot that spawns target entity")]
2958 if (!ValidateInputEntity(
object, m_Getter, entity))
2961 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
2965 GetGame().GetCallqueue().CallLater(manager.PlaySoundOnEntity, 2000,
false, entity, m_sSound);
2970 class SCR_ScenarioFrameworkActionIntroVoicelineBasedOnTasks : SCR_ScenarioFrameworkActionBase
2975 [
Attribute(
desc:
"(Optional) If getter is provided, sound will come from the provided entity")]
2978 ref array<int> m_aAffectedPlayers = {};
2990 int playerID = playerManager.GetPlayerIdFromControlledEntity(
object);
2991 if (m_aAffectedPlayers.Contains(playerID))
2994 m_aAffectedPlayers.Insert(playerID);
2996 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
3003 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
3006 IEntity entity = IEntity.Cast(entityWrapper.GetValue());
3008 entityID = entity.GetID();
3012 manager.PlayIntroVoiceline(playerID, m_sSound, entityID);
3017 class SCR_ScenarioFrameworkActionProcessVoicelineEnumAndString : SCR_ScenarioFrameworkActionBase
3020 string m_sTargetEnum;
3028 SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(
GetGame().
GetGameMode().FindComponent(SCR_GameModeSFManager));
3036 array<SCR_BaseTask> tasks = {};
3037 taskManager.GetTasks(tasks);
3039 typename targetEnum = m_sTargetEnum.ToType();
3044 manager.ProcessVoicelineEnumAndString(targetEnum, frameworkTask.m_sTaskIntroVoiceline)
3051 class SCR_ScenarioFrameworkActionChangeTaskState : SCR_ScenarioFrameworkActionBase
3067 Print(
string.Format(
"ScenarioFramework Action: Getter not found for Action %1.",
this), LogLevel.ERROR);
3071 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_Getter.Get());
3074 Print(
string.Format(
"ScenarioFramework Action: Issue with Getter detected for Action %1.",
this), LogLevel.ERROR);
3082 Print(
string.Format(
"ScenarioFramework Action: Task not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
3084 Print(
string.Format(
"ScenarioFramework Action: Task not found for Action %1.",
this), LogLevel.ERROR);
3093 Print(
string.Format(
"ScenarioFramework Action: Task support entity not found for Action %1 attached on %2.",
this,
object.
GetName()), LogLevel.ERROR);
3095 Print(
string.Format(
"ScenarioFramework Action: Task not found for Action %1.",
this), LogLevel.ERROR);
3102 supportEntity.FinishTask(task);
3104 supportEntity.FailTask(task);
3106 supportEntity.CancelTask(task.GetTaskID());
3108 task.SetState(m_eTaskState);
3110 SCR_ScenarioFrameworkLayerTask layerTask = task.GetLayerTask();
3114 layerTask.SetLayerTaskState(m_eTaskState);
3119 class SCR_ScenarioFrameworkActionResetCounter : SCR_ScenarioFrameworkActionBase
3129 Print(
string.Format(
"ScenarioFramework Action: Object not found for Action %1.",
this), LogLevel.ERROR);
3133 SCR_ScenarioFrameworkLogicCounter counter = SCR_ScenarioFrameworkLogicCounter.Cast(
object.FindComponent(SCR_ScenarioFrameworkLogicCounter));
3136 Print(
string.Format(
"ScenarioFramework Action: Counter not found for Action %1.",
this), LogLevel.ERROR);
3145 class SCR_ScenarioFrameworkActionExecuteFunction : SCR_ScenarioFrameworkActionBase
3151 string m_sMethodToCall;
3154 string m_sParameter;
3157 string m_sParameter2;
3160 string m_sParameter3;
3163 string m_sParameter4;
3166 string m_sParameter5;
3174 SCR_ScenarioFrameworkParam<IEntity> entityWrapper = SCR_ScenarioFrameworkParam<IEntity>.Cast(m_ObjectToCallTheMethodFrom.Get());
3180 SCR_ScenarioFrameworkLayerTask layer = SCR_ScenarioFrameworkLayerTask.Cast(entityWrapper.GetValue().FindComponent(SCR_ScenarioFrameworkLayerTask));
3182 GetGame().GetCallqueue().CallByName(layer, m_sMethodToCall, m_sParameter, m_sParameter2, m_sParameter3, m_sParameter4, m_sParameter5);
3184 GetGame().GetCallqueue().CallByName(layerBase, m_sMethodToCall, m_sParameter, m_sParameter2, m_sParameter3, m_sParameter4, m_sParameter5);
3186 GetGame().GetCallqueue().CallByName(area, m_sMethodToCall, m_sParameter, m_sParameter2, m_sParameter3, m_sParameter4, m_sParameter5);
3188 GetGame().GetCallqueue().CallByName(entityWrapper.GetValue(), m_sMethodToCall, m_sParameter, m_sParameter2, m_sParameter3, m_sParameter4, m_sParameter5);