Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIAddAgentToRadialCover.c
Go to the documentation of this file.
1 class SCR_AIAddAgentToRadialCover : AITaskScripted
2 {
3  static const string PORT_AGENT = "Agent";
4 
5  protected SCR_AIGroupUtilityComponent m_groupUtilityComponent;
6 
7  //------------------------------------------------------------------------------------------------
8  protected static ref TStringArray s_aVarsIn = {
9  PORT_AGENT
10  };
11  override TStringArray GetVariablesIn()
12  {
13  return s_aVarsIn;
14  }
15 
16  //------------------------------------------------------------------------------------------------
17  override void OnInit(AIAgent owner)
18  {
19  m_groupUtilityComponent = SCR_AIGroupUtilityComponent.Cast(owner.FindComponent(SCR_AIGroupUtilityComponent));
20  }
21 
22  //------------------------------------------------------------------------------------------------
23  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
24  {
25  if (!m_groupUtilityComponent)
26  return NodeError(this,owner, "AIAgent does not have group utility component!");
27 
28  AIAgent defender;
29  if (!GetVariableIn(PORT_AGENT, defender))
30  {
31  return NodeError(this, owner, "No agent provided");
32  };
33 
34 
35  SCR_AIDefendActivity defendActivity = SCR_AIDefendActivity.Cast(m_groupUtilityComponent.GetCurrentAction());
36  if (!defendActivity)
37  return NodeError(this, owner, "Not running defend activity!");
38 
39  defendActivity.AddAgentToRadialCover(defender);
40  return ENodeResult.SUCCESS;
41  }
42 
43  //------------------------------------------------------------------------------------------------
44  protected override bool VisibleInPalette()
45  {
46  return true;
47  }
48 
49  //------------------------------------------------------------------------------------------------
50  protected override string GetOnHoverDescription()
51  {
52  return "Adds unit to list of covering units of defend waypoint";
53  }
54 
55 };
SCR_AIDefendActivity
Definition: SCR_AIDefendActivity.c:1
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition: NodeError.c:3
SCR_AIAddAgentToRadialCover
Definition: SCR_AIAddAgentToRadialCover.c:1