Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDecideActivity.c
Go to the documentation of this file.
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 };
52 {
53 return s_aVarsOut;
54 }
55
56 //------------------------------------------------------------------------------------------------
57 static override bool VisibleInPalette() {return true;}
58};
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition NodeError.c:3
proto void SetVariableOut(string name, void val)
static ref TStringArray s_aVarsOut
static override bool VisibleInPalette()
override TStringArray GetVariablesOut()
ENodeResult
Definition ENodeResult.c:13
array< string > TStringArray
Definition Types.c:385