6class SCR_ScenarioFrameworkLayerTaskDefend : SCR_ScenarioFrameworkLayerTask
9 protected string m_sTriggerName;
14 [
Attribute(defvalue:
"-1",
UIWidgets.Slider,
desc:
"For how long you have to Defend the objective of the task. Value -1 is for indefinitely.",
params:
"-1 86400 1",
category:
"Defend params")]
15 protected float m_fDefendTime;
17 [
Attribute(defvalue:
"1",
desc:
"When enabled, it will display the text and how much time remains for the Task Defend",
category:
"Defend params")]
18 protected bool m_bDisplayCountdownHUD;
20 [
Attribute(defvalue:
"{47864BB47AB0B1F4}UI/layouts/HUD/CampaignMP/CampaignMainHUD.layout",
category:
"Defend params")]
26 [
Attribute(uiwidget:
UIWidgets.Slider,
desc:
"When compared to the number of attackers, minimum of how much of the characters present in the task area must be from defending side to successfully complete the objective on evaluation",
params:
"0 1 0.01",
precision: 2,
category:
"Defend params")]
29 [
Attribute(uiwidget:
UIWidgets.EditBox,
desc:
"Layer containing attacker forces. Can be more layers, but these layers must include only AI units/groups and nothing else.",
category:
"Defend params")]
32 [
Attribute(
desc:
"When enabled, it will can finish the task earlier than the countdown when all attackers are eliminated",
category:
"Defend params")]
35 [
Attribute(
desc:
"When enabled, evaluation will be delayed and defenders will need to eliminate all attackers in order for the task to be succesfully completed",
category:
"Defend params")]
38 [
Attribute(
desc:
"When enabled, it will display the text to inform players that they have to eliminate all attacker units",
category:
"Defend params")]
41 [
Attribute(uiwidget:
UIWidgets.LocaleEditBox,
desc:
"Text that will be displayed to inform players that they have to eliminate all attacker units",
category:
"Defend params")]
94 SCR_ScenarioFrameworkSlotTrigger slotTrigger = SCR_ScenarioFrameworkSlotTrigger.Cast(foundEntity.
FindComponent(SCR_ScenarioFrameworkSlotTrigger));
98 SCR_CharacterTriggerEntity trigger = SCR_CharacterTriggerEntity.Cast(slotTrigger.GetSpawnedEntity());
113 SCR_ScenarioFrameworkTaskDefendDefendingFaction defender = SCR_ScenarioFrameworkTaskDefendDefendingFaction.Cast(
m_aFactionSettings[i]);
116 if (defender.GetCountOnlyPlayers())
122 SCR_ScenarioFrameworkTaskDefendAttackingFaction attacker = SCR_ScenarioFrameworkTaskDefendAttackingFaction.Cast(
m_aFactionSettings[i]);
125 if (attacker.GetCountOnlyPlayers())
142 array<SCR_Task> activeTasks = {};
170 int defenderCount = 0;
171 int attackerCount = 0;
181 float defenderRatioEval = defenderCount / attackerCount;
202 attackerLayerEntity =
GetGame().
GetWorld().FindEntityByName(layerName);
203 if (!attackerLayerEntity)
238 SCR_CharacterTriggerEntity charTrigger;
239 array<IEntity> spawnedEntities = layerBase.GetSpawnedEntities();
240 foreach (
IEntity spawnedEntity : spawnedEntities)
242 charTrigger = SCR_CharacterTriggerEntity.Cast(spawnedEntity);
254 override void RestoreToDefault(
bool includeChildren =
false,
bool reinitAfterRestoration =
false,
bool affectRandomization =
true,
bool deleteSpawnedEntities =
true)
269 super.RestoreToDefault(includeChildren, reinitAfterRestoration, affectRandomization, deleteSpawnedEntities);
284 super.AfterAllChildrenSpawned(
layer);
286 if (!m_sTriggerName.IsEmpty())
298 super.OnPostInit(owner);
330 leftFlag.SetVisible(
false);
331 rightFlag.SetVisible(
false);
332 leftScore.SetVisible(
false);
333 rightScore.SetVisible(
false);
334 winScore.SetVisible(
false);
335 winScoreSideLeft.SetVisible(
false);
336 winScoreSideRight.SetVisible(
false);
343 if (!m_bDisplayCountdownHUD)
434 if (attackerLayer.GetEnableRepeatedSpawn() && attackerLayer.GetRepeatedSpawnNumber() > 1)
437 array<IEntity> spawnedEntities = attackerLayer.GetSpawnedEntities();
438 SCR_ChimeraCharacter character;
440 foreach (
IEntity entity : spawnedEntities)
442 character = SCR_ChimeraCharacter.Cast(entity);
452 damageManager = character.GetDamageManager();
453 if (!damageManager.IsDestroyed())
480 super.EOnFrame(owner, timeSlice);
525 [
Attribute(defvalue:
"0",
UIWidgets.EditBox,
desc:
"When disabled, all units from this faction will be counted with for other Task Defend conditions",
category:
"")]
532 FactionManager factionManager =
GetGame().GetFactionManager();
564 title =
"Defending faction";
579 title =
"Attacking faction";
ArmaReforgerScripted GetGame()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
override void EOnFrame(IEntity owner, float timeSlice)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ref array< SCR_ScenarioFrameworkLayerBase > m_aChildren
bool m_bShowDebugShapesDuringRuntime
void AfterAllChildrenSpawned(SCR_ScenarioFrameworkLayerBase layer)
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
void DynamicDespawn(SCR_ScenarioFrameworkLayerBase layer)
void ProcessLayerTaskState(SCR_ETaskState state, bool forced=false, bool calledFromSubtask=false)
RichTextWidget m_wCountdown
ref array< SCR_ScenarioFrameworkLayerBase > m_aAttackerLayer
bool m_bEarlierEvaluation
void SetSecondsRemaining(float seconds)
void SetupEvaluation()
Sets up evaluation time, triggers attacker layer, and checks for character trigger entities in scenar...
LocalizedString m_sDelayedEvaluationText
string m_sFormattedCountdownTitle
SCR_CharacterTriggerEntity GetCharacterTriggerEntity()
void EvaluateStatus()
Evaluates task status.
void UpdateHUD()
Updates HUD based on task state, displays countdown or delayed evaluation text, hides HUD if task is ...
void SetupAttackerLayer()
Sets up attacker layers from given names in the world.
Widget m_wCountdownOverlay
float GetSecondsRemaining()
bool m_bDisplayDelayedEvaluationText
void SetDefendTime(float time)
SCR_CharacterTriggerEntity m_CharacterTriggerEntity
string m_sFormattedDelayedEvaluationText
UI layouts HUD CampaignMP CampaignMainHUD category
ref array< ref SCR_ScenarioFrameworkTaskDefendFactionSettings > m_aFactionSettings
bool m_bDelayedEvaluation
ref array< string > m_aAttackerLayerNames
void RemovePeriodicUpdates()
Removes periodic updates and clears debug shapes during runtime if not shown.
void RpcDo_UpdateHUD(float countdown)
void CountAttackerDefenderNumbers(out int defenderCount, out int attackerCount)
WorldTimestamp m_fEvaluateTimeEnd
SCR_ScenarioFrameworkTaskDefendAttackingFactionTitle BaseContainerCustomTitle BaseContainerProps()
void InitHUD()
Initializes HUD layout, sets visibility of widgets, sets countdown time, and sets flavor text.
void CheckAttackerLayers()
Checks if attacker layers have repeated spawns, then iterates through spawned entities,...
void FindCharacterTriggerEntity()
Finds character trigger entity by name.
RichTextWidget m_wFlavour
WorldTimestamp m_fEvaluateTimeStart
float m_fMinDefenderPercentageRatio
void SCR_Task(IEntitySource src, IEntity parent)
SCR_TaskSystem m_TaskSystem
proto external Managed FindComponent(typename typeName)
proto external BaseWorld GetWorld()
proto external EntityFlags ClearFlags(EntityFlags flags, bool recursively=false)
static SCR_HUDManagerComponent GetHUDManager()
Widget CreateLayout(ResourceName path, EHudLayers layer, int zOrder=0)
bool GetCountOnlyPlayers()
void SetFactionKey(FactionKey factionKey)
SCR_ScenarioFrameworkLayerTask GetLayerTask()
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_EditableTaskComponentClass m_Task
Editable SCR_BaseTask.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
EntityFlags
Various entity flags.
class SCR_BaseManualCameraComponent _WB_GetCustomTitle(BaseContainer source, out string title)
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.