Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIDecideActivity.c
Go to the documentation of this file.
1 class SCR_AIDecideActivity: AITaskScripted
2 {
3  static const string PORT_ACTIVITY_TREE = "ActivityTree";
4  static const string PORT_UPDATE_ACTIVITY = "UpdateActivity";
5 
6  SCR_AIGroupUtilityComponent m_UtilityComponent;
7  SCR_AIMessageGoal m_GoalMessage;
8  SCR_AIMessageInfo m_InfoMessage;
9 
10  //------------------------------------------------------------------------------------------------
11  override void OnInit(AIAgent owner)
12  {
13  if (owner)
14  m_UtilityComponent = SCR_AIGroupUtilityComponent.Cast(owner.FindComponent(SCR_AIGroupUtilityComponent));
15  }
16 
17  //------------------------------------------------------------------------------------------------
18  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
19  {
20  bool restartActivity;
21  if (!m_UtilityComponent)
22  {
23  return NodeError(this, owner, "Group utility component is missing.");
24  }
25 
26  SCR_AIActionBase currentAction = m_UtilityComponent.EvaluateActivity(restartActivity);
27  if (!currentAction)
28  {
29  //Print("AI: Missing behavior tree in " + m_CurrentActivity.ToString(), LogLevel.WARNING);
30  return ENodeResult.FAIL;
31  }
32  else
33  {
34  if (restartActivity)
35  {
36  SetVariableOut(PORT_ACTIVITY_TREE, currentAction.m_sBehaviorTree);
37  SetVariableOut(PORT_UPDATE_ACTIVITY, restartActivity);
38  }
39 
40  return ENodeResult.SUCCESS;
41  }
42 
43  return ENodeResult.FAIL;
44  }
45 
46  //------------------------------------------------------------------------------------------------
47  protected static ref TStringArray s_aVarsOut = {
48  PORT_ACTIVITY_TREE,
49  PORT_UPDATE_ACTIVITY
50  };
51  override TStringArray GetVariablesOut()
52  {
53  return s_aVarsOut;
54  }
55 
56  //------------------------------------------------------------------------------------------------
57  override bool VisibleInPalette() {return true;}
58 };
SCR_AIActionBase
Definition: SCR_AIAction.c:1
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
SCR_AIMessageGoal
Definition: SCR_AIMessage.c:69
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition: NodeError.c:3
SCR_AIDecideActivity
Definition: SCR_AIDecideActivity.c:1
SCR_AIMessageInfo
Definition: SCR_AIMessage.c:95