Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AITaskTimer.c
Go to the documentation of this file.
1 class SCR_AITaskTimer: AITaskScripted
2 {
3  [Attribute("10", UIWidgets.EditBox, "Time")]
4  float m_Time;
5 
6  //------------------------------------------------------------------------------------------------
7  protected float elapsedTime;
8  protected bool isInfinite;
9 
10  //------------------------------------------------------------------------------------------------
11  override void OnEnter(AIAgent owner)
12  {
13  if (GetVariableType(true, "Time") == float)
14  {
15  GetVariableIn("Time", m_Time);
16  if ( m_Time < 0 )
17  isInfinite = true;
18  }
19  }
20 
21  //------------------------------------------------------------------------------------------------
22  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
23  {
24  bool reset;
25  GetVariableIn("ResetTime", reset);
26  if ( reset )
27  {
28  elapsedTime = 0;
29  SetVariableOut("ResetTimeOut", false);
30  };
31  elapsedTime += dt;
32 
33  if (GetVariableType(false, "Trigger") == bool)
34  {
35  bool res = (elapsedTime > m_Time && !isInfinite);
36  SetVariableOut("Trigger", res);
37  }
38 
39  if (GetVariableType(false, "ElapsedTime") == float)
40  {
41  SetVariableOut("ElapsedTime", elapsedTime);
42  }
43 
44  if (elapsedTime > m_Time && !isInfinite)
45  {
46  elapsedTime -= m_Time;
47  }
48 
49  return ENodeResult.SUCCESS;
50  }
51 
52  //------------------------------------------------------------------------------------------------
53  override bool VisibleInPalette()
54  {
55  return true;
56  }
57 
58  //------------------------------------------------------------------------------------------------
59  protected override string GetOnHoverDescription()
60  {
61  return "Task Timer: For triggering into output variable after specified time.";
62  }
63 
64  //------------------------------------------------------------------------------------------------
65  protected static ref TStringArray s_aVarsIn = {
66  "Time",
67  "ResetTime"
68  };
69  override TStringArray GetVariablesIn()
70  {
71  return s_aVarsIn;
72  }
73 
74  //------------------------------------------------------------------------------------------------
75  protected static ref TStringArray s_aVarsOut = {
76  "Trigger",
77  "ElapsedTime",
78  "ResetTimeOut"
79  };
80  override TStringArray GetVariablesOut()
81  {
82  return s_aVarsOut;
83  }
84 };
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_Time
WorldTimestamp m_Time
Definition: SCR_EditorManagerCore.c:581
SCR_AITaskTimer
Definition: SCR_AITaskTimer.c:1