Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkActionWaitAndExecute.c
Go to the documentation of this file.
3{
4 [Attribute(desc: "How long to wait before executing action")]
5 int m_iDelayInSeconds;
6
7 [Attribute(desc: "If this is set to a number larger than Delay In Seconds, it will randomize resulted delay between these two values")]
8 int m_iDelayInSecondsMax;
9
10 [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.")]
11 bool m_bLooped;
12
13 [Attribute(defvalue: "1", desc: "Which actions will be executed once set time passes", UIWidgets.Auto)]
14 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActions;
15
16 //------------------------------------------------------------------------------------------------
17 void ExecuteActions(IEntity object)
18 {
19 if (!CanActivate())
20 return;
21
22 int activatableActions;
23 foreach (SCR_ScenarioFrameworkActionBase actions : m_aActions)
24 {
25 if (actions.m_iMaxNumberOfActivations == -1 || actions.m_iNumberOfActivations < actions.m_iMaxNumberOfActivations)
26 activatableActions++;
27
28 actions.OnActivate(object);
29 }
30
32
33 if (m_bLooped && activatableActions > 0)
34 {
35 int delay = m_iDelayInSeconds;
36 if (m_iDelayInSecondsMax > m_iDelayInSeconds)
37 delay = Math.RandomIntInclusive(m_iDelayInSeconds, m_iDelayInSecondsMax);
38
39 SCR_ScenarioFrameworkSystem.GetCallQueuePausable().CallLater(ExecuteActions, delay * 1000, false, object);
40 }
41 }
42
43 //------------------------------------------------------------------------------------------------
44 override void OnActivate(IEntity object)
45 {
46 if (!CanActivate())
47 return;
48
49 int delay = m_iDelayInSeconds;
50 if (m_iDelayInSecondsMax > m_iDelayInSeconds)
51 delay = Math.RandomIntInclusive(m_iDelayInSeconds, m_iDelayInSecondsMax);
52
53 if (m_aActions.IsEmpty())
54 return;
55
56 m_Entity = object;
57
58 //Used to delay the call as it is the feature of this action
59 SCR_ScenarioFrameworkSystem.GetCallQueuePausable().CallLater(ExecuteActions, delay * 1000, false, object);
60 }
61
62 //------------------------------------------------------------------------------------------------
63 override array<ref SCR_ScenarioFrameworkActionBase> GetSubActions()
64 {
65 return m_aActions;
66 }
67
68 //------------------------------------------------------------------------------------------------
69 override void RestoreToDefault()
70 {
71 super.RestoreToDefault();
72
74 }
75}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
override void OnActivate()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
void RestoreToDefault()
Definition Math.c:13
static ScriptCallQueue GetCallQueuePausable()
SCR_FieldOfViewSettings Attribute