Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AISetDefendWaypoint.c
Go to the documentation of this file.
1 class SCR_AISetDefendWaypoint : AITaskScripted
2 {
3  static const string PRESET_INDEX_PORT = "PresetIndexIn";
4  static const string FAST_INIT_PORT = "FastInitIn";
5  static const string WAYPOINT_PORT = "WaypointIn";
6 
7  [Attribute("-1", UIWidgets.EditBox, "Set current preset index of defend waypoint")];
8  private int m_iNewPresetIndex;
9 
10  [Attribute("-1", UIWidgets.EditBox, "Set fast init for of defend waypoint")];
11  private int m_iNewFastInit;
12 
13  //------------------------------------------------------------------------------------------------
14  protected static ref TStringArray s_aVarsIn = {
15  WAYPOINT_PORT,
16  PRESET_INDEX_PORT,
17  FAST_INIT_PORT
18  };
19  override TStringArray GetVariablesIn()
20  {
21  return s_aVarsIn;
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
26  {
27  AIWaypoint waypoint;
29  int newIndex;
30 
31  AIGroup group = AIGroup.Cast(owner);
32  if (!group)
33  {
34  SCR_AgentMustBeAIGroup(this, owner);
35  return ENodeResult.FAIL;
36  }
37 
38  if (!GetVariableIn(WAYPOINT_PORT, waypoint))
39  {
40  waypoint = group.GetCurrentWaypoint();
41  }
42 
43  wp = SCR_DefendWaypoint.Cast(waypoint);
44  if (!wp)
45  {
46  return NodeError(this, owner, "Did not provide defend waypoint to set!");
47  }
48 
49  if (!GetVariableIn(PRESET_INDEX_PORT, newIndex))
50  newIndex = m_iNewPresetIndex;
51 
52  if (newIndex > -1 && !wp.SetCurrentDefendPreset(newIndex)) // I want to change preset
53  {
54  return NodeError(this, owner, "Wrong index of preset provided");
55  }
56 
57  if (!GetVariableIn(FAST_INIT_PORT, newIndex))
58  newIndex = m_iNewFastInit;
59 
60  if (newIndex > -1) // I want to change fast init state
61  {
62  wp.SetFastInit(newIndex);
63  }
64 
65  return ENodeResult.SUCCESS;
66  }
67 
68  //------------------------------------------------------------------------------------------------
69  protected override bool VisibleInPalette()
70  {
71  return true;
72  }
73 
74  //------------------------------------------------------------------------------------------------
75  protected override string GetOnHoverDescription()
76  {
77  return "Changes preset of defend waypoint, defined in m_DefendPresets array of defend waypoint entity.";
78  }
79 };
SCR_AgentMustBeAIGroup
void SCR_AgentMustBeAIGroup(Node node, AIAgent owner)
Definition: NodeError.c:14
SCR_DefendWaypoint
Definition: SCR_DefendWaypoint.c:18
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition: NodeError.c:3
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_AISetDefendWaypoint
Definition: SCR_AISetDefendWaypoint.c:1