6void ScriptInvokerTriggerUpdated(
float activationCountdownTimer,
float tempWaitTime,
int playersCountByFactionInside,
int playersCountByFaction,
string playerActivationNotificationTitle,
bool triggerConditionsStatus,
float minimumPlayersNeededPercentage);
11 [
Attribute(
desc:
"Faction which is used for area control calculation. Leave empty for any faction.",
category:
"Trigger")]
14 [
Attribute(
"0",
UIWidgets.ComboBox,
"By whom the trigger is activated",
"", ParamEnumArray.FromEnum(SCR_EScenarioFrameworkTriggerActivation),
category:
"Trigger")]
17 [
Attribute(
desc:
"Fill the entity names here for detection. Is combined with other filters using OR.",
category:
"Trigger")]
20 [
Attribute(
desc:
"Fill the class names here for detection. Is combined with other filters using OR.",
category:
"Trigger")]
23 [
Attribute(
desc:
"Which Prefabs and if their children will be detected by the trigger. Is combined with other filters using OR.",
category:
"Trigger")]
26 [
Attribute(
desc:
"Here you can input custom trigger conditions that you can create by extending the SCR_CustomTriggerConditions", uiwidget:
UIWidgets.Object)]
32 [
Attribute(defvalue:
"1",
UIWidgets.CheckBox,
desc:
"If you set some vehicle to be detected by the trigger, it will also search the inventory for vehicle prefabs/classes that are set",
category:
"Trigger")]
35 [
Attribute(defvalue:
"1",
UIWidgets.CheckBox,
desc:
"Activate the trigger once or everytime the activation condition is true?",
category:
"Trigger")]
44 [
Attribute(defvalue:
"0",
UIWidgets.Slider,
desc:
"For how long the trigger conditions must be true in order for the trigger to activate. If conditions become false, timer resets",
params:
"0 86400 1",
category:
"Trigger")]
50 [
Attribute(defvalue:
"{47864BB47AB0B1F4}UI/layouts/HUD/CampaignMP/CampaignMainHUD.layout",
category:
"Trigger")]
53 [
Attribute(
desc:
"Notification title text that will be displayed when the PLAYER Activation presence is selected",
category:
"Trigger")]
80 static ref ScriptInvokerBase<ScriptInvokerTriggerUpdated>
s_OnTriggerUpdated =
new ScriptInvokerBase<ScriptInvokerTriggerUpdated>();
118 prefabFilter.SetPrefab(prefabFilterInput.m_sSpecificPrefabName);
119 prefabFilter.SetCheckPrefabHierarchy(prefabFilterInput.m_bIncludeChildren);
203 if (!triggerCondition)
206 triggerCondition.Prepare(
this);
251 FactionManager factionManager =
GetGame().GetFactionManager();
260 RplComponent comp = RplComponent.Cast(FindComponent(RplComponent));
261 return comp && comp.IsMaster();
340 array<int> aPlayerIDs = {};
342 GetGame().GetPlayerManager().GetPlayers(aPlayerIDs);
343 foreach (
int iPlayerID : aPlayerIDs)
352 if (!playerController)
367 if (className.IsEmpty())
372 array<IEntity> aItemsToAdd = {};
382 if (!inventoryComponent)
385 array<IEntity> aItems = {};
386 inventoryComponent.GetItems(aItems);
387 if (!aItems.IsEmpty())
388 aItemsToAdd.InsertAll(aItems);
391 if (!aItemsToAdd.IsEmpty())
402 if (entity.IsInherited(className.ToType()))
405 if (iCnt == targetCount)
421 array<IEntity> aItemsToAdd = {};
431 if (!inventoryComponent)
434 array<IEntity> aItems = {};
435 inventoryComponent.GetItems(aItems);
436 if (!aItems.IsEmpty())
437 aItemsToAdd.InsertAll(aItems);
440 if (!aItemsToAdd.IsEmpty())
457 if (!includeInheritance)
459 if (container != prefabContainer)
468 if (container == prefabContainer)
474 container = container.GetAncestor();
478 if (iCnt == targetCount)
490 SCR_ChimeraCharacter chimeraCharacter;
497 chimeraCharacter = SCR_ChimeraCharacter.Cast(entity);
498 if (!chimeraCharacter)
501 if (faction && chimeraCharacter.GetFaction() != faction)
505 if (iCnt == targetCount)
519 SCR_ChimeraCharacter chimeraCharacter;
525 chimeraCharacter = SCR_ChimeraCharacter.Cast(entity);
526 if (!chimeraCharacter)
529 if (faction && chimeraCharacter.GetFaction() != faction)
546 SCR_ChimeraCharacter chimeraCharacter;
553 chimeraCharacter = SCR_ChimeraCharacter.Cast(entity);
554 if (!chimeraCharacter)
578 array<int> aPlayerIDs = {};
580 GetGame().GetPlayerManager().GetPlayers(aPlayerIDs);
581 foreach (
int iPlayerID : aPlayerIDs)
584 if (!playerController)
598 SCR_ChimeraCharacter chimeraCharacter = SCR_ChimeraCharacter.Cast(ent);
599 if (!chimeraCharacter)
630 FactionAffiliationComponent factionAffiliation = FactionAffiliationComponent.Cast(ent.
FindComponent(FactionAffiliationComponent));
631 if (!factionAffiliation)
634 return factionAffiliation.GetAffiliatedFaction() ==
m_OwnerFaction;
652 finishedActions.OnActivate(
this);
707 int playerId = playerManager.GetPlayerIdFromControlledEntity(entity);
709 if (!playerController)
712 SCR_ScenarioFrameworkTriggerNetworkComponent triggerNetwork = SCR_ScenarioFrameworkTriggerNetworkComponent.Cast(playerController.FindComponent(SCR_ScenarioFrameworkTriggerNetworkComponent));
716 triggerNetwork.ReplicateTriggerState(
this, leftTrigger);
760 enteredActions.OnActivate(
this);
768 super.OnQueryFinished(bIsEmpty);
834 leftActions.OnActivate(
this);
942 SCR_ScenarioFrameworkParam<IEntity> param =
new SCR_ScenarioFrameworkParam<IEntity>(ent);
976 if (!triggerCondition)
979 triggerCondition.Prepare(
this);
986 prefabFilter.SetPrefab(prefabFilterInput.m_sSpecificPrefabName);
987 prefabFilter.SetCheckPrefabHierarchy(prefabFilterInput.m_bIncludeChildren);
ArmaReforgerScripted GetGame()
SCR_BaseTriggerEntityClass m_OnActivate
Basic scripted trigger which offers external invoekrs for major events like activation or deactivatio...
ref ScriptInvoker m_OnDeactivate
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
SCR_EScenarioFrameworkLogicOperators
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
func ScriptInvokerTriggerUpdated
ScriptInvokerBase< ScriptInvokerIntMethod > ScriptInvokerInt
proto external Managed FindComponent(typename typeName)
static Faction GetLocalControlledEntityFaction()
static IEntity GetLocalMainEntity()
static ScriptCallQueue GetCallQueuePausable()
int GetPlayersCountByFaction()
Returns number of players in game by the faction set for this trigger.
ref array< ref SCR_ScenarioFrameworkPrefabFilter > m_aPrefabFilter
void SetInitSequenceDone(bool init)
Sets Init sequence as done or not.
void SetSpecificClassName(notnull array< string > aClassName)
Sets specific classnames to be searched in the trigger.
ref array< IEntity > m_aEntitiesInside
void AddSpecificEntityNameFilter(notnull array< string > aEntityName)
Adds specific entity name to be searched in the trigger.
void SetCountdownAudio(string sAudioName)
Sets which audio can be played from activating this trigger.
FactionKey m_sOwnerFactionKey
int GetPlayersCountByFactionInsideTrigger(Faction faction)
Returns number of players from the selected faction that are inside this trigger.
float m_fMinimumPlayersNeededPercentage
void SetFinishedActions(array< ref SCR_ScenarioFrameworkActionBase > finishedActions)
SCR_EScenarioFrameworkTriggerActivation m_eActivationPresence
float GetActivationCountdownTimerTemp()
Returns activation countdown timer temporary value which is calculated by the trigger but changes ove...
bool m_bSearchVehicleInventory
bool GetNotificationEnabled()
Returns if HUD notifications are enabled.
bool m_bTriggerConditionsStatus
void SetOnce(bool bOnce)
Sets if trigger can be finished just once.
void SetPlayerActivationNotificationTitle(string sTitle)
Sets HUD activation notification title.
string GetPlayerActivationNotificationTitle()
Returns player activation notification title.
event void OnActivate(IEntity ent)
int m_iCountInsideTrigger
int GetCharacterCountByFactionInsideTrigger(Faction faction, int targetCount=-1)
Returns number of characters from the selected faction that are inside this trigger.
override bool ScriptedEntityFilterForQuery(IEntity ent)
Override this method in inherited class to define a new filter.
void FinishTrigger(IEntity ent)
Finishes trigger.
ref array< ref SCR_ScenarioFrameworkActionBase > m_aEntityEnteredActions
bool m_bNotificationEnabled
void SetEntityEnteredActions(array< ref SCR_ScenarioFrameworkActionBase > entityEnteredActions)
void SetOwnerFaction(FactionKey sFaction)
Sets faction that "owns" this trigger.
string m_sPlayerActivationNotificationTitle
void SetEntityLefActions(array< ref SCR_ScenarioFrameworkActionBase > entityLefActions)
ref array< string > m_aSpecificEntityNames
static ref ScriptInvokerBase< ScriptInvokerTriggerUpdated > s_OnTriggerUpdated
ref array< IEntity > m_aPlayersInside
void SetPrefabFilters(notnull array< ref SCR_ScenarioFrameworkPrefabFilter > aPrefabFilter)
Sets specific prefab filters to be searched in the trigger.
ref array< ref SCR_ScenarioFrameworkActionBase > m_aEntityLeftActions
bool GetTriggerConditionsStatus()
Returns trigger conditions status.
MusicManager m_MusicManager
int GetCountInsideTrigger()
Returns number of all the entities that are inside this trigger.
void RpcDo_PlayMusic(string sAudio)
ref array< ref SCR_ScenarioFrameworkActivationConditionBase > m_aCustomTriggerConditions
int GetSpecificClassCountInsideTrigger(string className, int targetCount=-1)
Returns number of specific class that is inside of this trigger.
float GetActivationCountdownTimer()
Returns activation countdown timer.
void SetTriggerConditionsStatus(bool status)
Sets trigger conditions status.
static ref ScriptInvokerInt s_OnTriggerUpdatedPlayerNotPresent
void HandleNetworkComponentForPlayersInside(IEntity ent)
Handles players inside the trigger or those who left it.
void GetPlayersByFactionInsideTrigger(notnull out array< IEntity > aOut)
Returns all the players by the faction set for this trigger.
Faction GetOwnerFaction()
Returns trigger faction owner.
float m_fActivationCountdownTimer
int GetSpecificPrefabCountInsideTrigger(BaseContainer prefabContainer, int targetCount=-1, bool includeInheritance=false)
Returns number of specific prefab that is inside of this trigger.
ResourceName m_sCountdownHUD
void ProcessPlayerNetworkComponent(IEntity entity, bool leftTrigger=false)
Processes the entity and its Network component to replicate only for each player inside the trigger.
void StopMusic(string sAudio)
ref array< string > m_aSpecificClassNames
void HandleAudio()
Checks if trigger conditions are met, plays countdown music if true, stops if false.
void SetActivationPresence(SCR_EScenarioFrameworkTriggerActivation EActivationPresence)
Sets Activation Presence.
ref array< ref SCR_ScenarioFrameworkActionBase > m_aFinishedActions
void SetMinimumPlayersNeeded(float minimumPlayersNeededPercentage)
Sets minimum player percentage needed to finish this trigger.
void UpdateTimer()
Updates the timer value and passes info to HUD.
void SetCustomTriggerConditionLogic(SCR_EScenarioFrameworkLogicOperators customTriggerConditionLogic)
Sets Custom Trigger Condition Logic.
ref set< BaseContainer > m_aPrefabContainerSet
float GetMinimumPlayersNeededPercentage()
Returns minimum players needed percentage.
void SetEnableAudio(bool enableAudio)
Sets if audio features from this trigger are enabled.
void PlayMusic(string sAudio)
void ActivationPresenceConditions()
Checks activation presesence conditions.
void SetCustomTriggerConditions(notnull array< ref SCR_ScenarioFrameworkActivationConditionBase > triggerConditions)
bool m_bCountdownMusicPlaying
ResourceName GetCountdownHUD()
Returns the countdown HUD resource name.
void RpcDo_StopMusic(string sAudio)
void SetSearchVehicleInventory(bool search)
Sets if trigger should also search vehicle inventory when looking for prefabs/classnames inside.
void HandleTimer()
Handles if timer should be ticking or not.
ScriptInvoker GetOnChange()
void SetActivationCountdownTimer(float activationCountdownTimer)
Sets activation coundown timer.
event void OnDeactivate(IEntity ent)
void CustomTriggerConditions()
This method handles custom conditions.
void EOnInit(IEntity owner)
Initializes the trigger.
void SetNotificationEnabled(bool notificationEnabled)
Sets if HUD notifications are enabled.
void OnDeactivateCalledLater(IEntity ent)
SCR_EScenarioFrameworkLogicOperators m_eCustomTriggerConditionLogic
void OnChange(IEntity ent)
void OnQueryFinished(bool bIsEmpty)
bool IsMaster()
Returns if this is executed in a server environment.
ref ScriptInvoker m_OnChange
void GetPlayersByFaction(notnull out array< IEntity > aOut)
Returns all the players in the game.
void SetActivateOnEmpty(bool activateOnEmpty)
int GetCountEntitiesInside()
Returns all entities that are inside this trigger.
enum EPhysicsLayerPresets Vehicle
SCR_FieldOfViewSettings Attribute
proto external PlayerController GetPlayerController()
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
proto external void AddClassType(typename classType)
Add a class type to the filter.
proto external int GetEntitiesInside(out notnull array< IEntity > outEntities)
proto external void AddFilterName(string name)
Add a name to the filter.
proto external void EnablePeriodicQueries(bool enable)
proto external void AddPrefabFilter(PrefabFilter prefabFilter)
Add a prefab filter to the filters.