Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_TriggerTask.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Tasks", description: "")]
3 {
4 };
6 {
7  [Attribute(desc: "When enabled, task will fail upon activation instead of being completed.", category: "Trigger Task")]
8  protected bool m_bToFail;
9 
10  [Attribute(desc: "When enabled, task will change state when its trigger is deactivated instead of activated.", category: "Trigger Task")]
11  protected bool m_bOnTriggerDeactivate;
12 
13  protected SCR_BaseFactionTriggerEntity m_Trigger;
14 
15  protected void OnTriggerActivate()
16  {
17  if (!GetTaskManager())
18  return;
19 
21  if (!supportEntity)
22  return;
23 
24  if (m_iTaskCompletionType != EEditorTaskCompletionType.AUTOMATIC)
25  return;
26 
27  if (!m_bOnTriggerDeactivate)
28  {
29  if (m_bToFail)
30  supportEntity.FailTask(this);
31  else
32  supportEntity.FinishTask(this);
33  }
34  }
35  protected void OnTriggerDeactivate()
36  {
37  if (!GetTaskManager())
38  return;
39 
41  if (!supportEntity)
42  return;
43 
44  if (m_iTaskCompletionType != EEditorTaskCompletionType.AUTOMATIC)
45  return;
46 
47  if (m_bOnTriggerDeactivate)
48  {
49  if (m_bToFail)
50  supportEntity.FailTask(this);
51  else
52  supportEntity.FinishTask(this);
53  }
54  }
55 
56  override void SetTargetFaction(Faction targetFaction)
57  {
58  super.SetTargetFaction(targetFaction);
59 
60  if (m_Trigger)
61  m_Trigger.SetOwnerFaction(targetFaction);
62  }
63  override void EOnInit(IEntity owner)
64  {
65  super.EOnInit(owner);
66 
67  if (Replication.IsServer())
68  {
69  IEntity child = GetChildren();
70  while (child)
71  {
72  m_Trigger = SCR_BaseFactionTriggerEntity.Cast(child);
73  if (m_Trigger)
74  break;
75  else
76  child = child.GetSibling();
77  }
78 
79  if (m_Trigger)
80  {
81  m_Trigger.GetOnActivate().Insert(OnTriggerActivate);
82  m_Trigger.GetOnDeactivate().Insert(OnTriggerDeactivate);
83  }
84  else if (!SCR_Global.IsEditMode(this))
85  {
86  Print("SCR_TriggerTask is missing a child of type SCR_BaseFactionTriggerEntity!", LogLevel.ERROR);
87  }
88  }
89  }
90 };
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
SCR_BaseFactionTriggerEntity
Definition: SCR_BaseFactionTriggerEntity.c:5
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_TriggerTaskClass
Definition: SCR_TriggerTask.c:2
Attribute
typedef Attribute
Post-process effect of scripted camera.
GetTaskManager
SCR_BaseTaskManager GetTaskManager()
Definition: SCR_BaseTaskManager.c:7
SCR_EditorTask
Definition: SCR_EditorTask.c:7
SCR_EditorTaskClass
Definition: SCR_EditorTask.c:2
SCR_TriggerTask
Definition: SCR_TriggerTask.c:5
SCR_BaseTaskSupportEntity
Definition: SCR_BaseTaskSupportEntity.c:8
EEditorTaskCompletionType
EEditorTaskCompletionType
Way of determening if a task is completed automaticly, manually or always manually (In the latter cas...
Definition: EEditorTaskCompletionType.c:2
Faction
Definition: Faction.c:12
SCR_Global
Definition: Functions.c:6
GetChildren
void GetChildren(out array< SCR_ScenarioFrameworkLayerBase > children)
Definition: SCR_ScenarioFrameworkLayerBase.c:359
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180