4 const static float PRIORITY_LEVEL_NORMAL = 0;
5 const static float PRIORITY_LEVEL_PLAYER = 1000;
6 const static float PRIORITY_LEVEL_GAMEMASTER = 2000;
8 const static float PRIORITY_BEHAVIOR_RETREAT_MELEE = 190 + PRIORITY_LEVEL_PLAYER;
9 const static float PRIORITY_BEHAVIOR_GET_OUT_VEHICLE_HIGH_PRIORITY = 162 + PRIORITY_LEVEL_PLAYER;
10 const static float PRIORITY_BEHAVIOR_MOVE_FROM_DANGER = 160 + PRIORITY_LEVEL_PLAYER;
11 const static float PRIORITY_BEHAVIOR_ATTACK_HIGH_PRIORITY = 120;
12 const static float PRIORITY_BEHAVIOR_PICKUP_INVENTORY_ITEMS = 118;
13 const static float PRIORITY_BEHAVIOR_HEAL_HIGH_PRIORITY = 115;
14 const static float PRIORITY_BEHAVIOR_OBSERVE_UNKNOWN_FIRE_HIGH_PRIORITY = 113;
15 const static float PRIORITY_BEHAVIOR_THROW_GRENADE = 112;
16 const static float PRIORITY_BEHAVIOR_MEDIC_HEAL = 111;
17 const static float PRIORITY_BEHAVIOR_RETREAT_FROM_TARGET = 110;
18 const static float PRIORITY_BEHAVIOR_PROVIDE_AMMO = 100;
19 const static float PRIORITY_BEHAVIOR_ATTACK_SELECTED = 90;
20 const static float PRIORITY_BEHAVIOR_HEAL_WAIT = 83;
21 const static float PRIORITY_BEHAVIOR_MOVE_FROM_VEHICLE_HORN = 72;
22 const static float PRIORITY_BEHAVIOR_ATTACK_NOT_SELECTED = 70;
23 const static float PRIORITY_BEHAVIOR_MOVE_FROM_UNKNOWN_FIRE = 68;
24 const static float PRIORITY_BEHAVIOR_OBSERVE_UNKNOWN_FIRE = 66;
25 const static float PRIORITY_BEHAVIOR_HEAL = 65;
26 const static float PRIORITY_BEHAVIOR_MOVE_AND_INVESTIGATE = 64;
27 const static float PRIORITY_BEHAVIOR_DEFEND = 62;
28 const static float PRIORITY_BEHAVIOR_FIND_FIRE_POSITION = 61;
29 const static float PRIORITY_BEHAVIOR_MOVE_INDIVIDUALLY = 60;
30 const static float PRIORITY_BEHAVIOR_VEHICLE = 51;
31 const static float PRIORITY_BEHAVIOR_GET_OUT_VEHICLE = 51;
32 const static float PRIORITY_BEHAVIOR_PERFORM_ACTION = 30;
33 const static float PRIORITY_BEHAVIOR_MOVE = 30;
34 const static float PRIORITY_BEHAVIOR_MOVE_IN_FORMATION = 30;
38 const static float PRIORITY_BEHAVIOR_DISMOUNT_TURRET = 300;
39 const static float PRIORITY_BEHAVIOR_DISMOUNT_TURRET_INVESTIGATE = 21;
40 const static float PRIORITY_BEHAVIOR_DISMOUNT_TURRET_GET_IN = 20;
43 const static float PRIORITY_ACTIVITY_RESUPPLY = 100;
44 const static float PRIORITY_ACTIVITY_HEAL = 80;
45 const static float PRIORITY_ACTIVITY_ATTACK_CLUSTER = 70;
46 const static float PRIORITY_ACTIVITY_SEEK_AND_DESTROY = 60;
47 const static float PRIORITY_ACTIVITY_INVESTIGATE_CLUSTER = 55;
48 const static float PRIORITY_ACTIVITY_DEFEND_FROM_CLUSTER = 55;
49 const static float PRIORITY_ACTIVITY_MOVE = 50;
50 const static float PRIORITY_ACTIVITY_PERFORM_ACTION = 50;
51 const static float PRIORITY_ACTIVITY_DEFEND = 50;
52 const static float PRIORITY_ACTIVITY_GET_IN = 50;
53 const static float PRIORITY_ACTIVITY_GET_OUT = 50;
54 const static float PRIORITY_ACTIVITY_FOLLOW = 50;
58 bool m_bIsInterruptable =
true;
59 protected ref SCR_BTParam<float> m_fPriorityLevel =
new SCR_BTParam<float>(
SCR_AIActionTask.PRIORITY_LEVEL_PORT);
61 ResourceName m_sBehaviorTree;
63 ResourceName m_sAbortBehaviorTree;
65 ref ScriptInvoker m_OnActionCompleted =
new ScriptInvoker();
66 ref ScriptInvoker m_OnActionFailed =
new ScriptInvoker();
70 ref array<SCR_BTParamBase> m_aParams = {};
73 override float EvaluatePriorityLevel()
79 void SetPriorityLevel(
int priority)
87 protected void AddDebugMessage(
string str);
94 AddDebugMessage(
string.Format(
"SetActionState: %1, %2",
typename.EnumToString(
EAIActionState, state), GetActionDebugInfo()));
99 override void OnSetSuspended(
bool suspended)
102 AddDebugMessage(
string.Format(
"SetSuspended: %1, %2", suspended, GetActionDebugInfo()));
107 override void OnComplete()
110 AddDebugMessage(
string.Format(
"Complete: %1", GetActionDebugInfo()));
113 m_OnActionCompleted.Invoke(
this);
117 override void OnFail()
120 AddDebugMessage(
string.Format(
"Fail: %1", GetActionDebugInfo()));
123 m_OnActionFailed.Invoke(
this);
127 override void OnActionRemoved()
130 AddDebugMessage(
string.Format(
"Fail: %1", GetActionDebugInfo()));
135 string GetActionDebugInfo()
137 return this.ToString();
140 string GetDebugPanelText() {
return string.Empty; }
143 override void OnActionSelected() {SetActionState(
EAIActionState.RUNNING);}
146 override void OnActionDeselected() {SetActionState(
EAIActionState.EVALUATED);}
149 void OnActionExecuted() { }
152 void OnActionCompleted() {SetActionState(
EAIActionState.COMPLETED);}
158 bool IsActionInterruptable()
160 return m_bIsInterruptable || GetActionState() !=
EAIActionState.RUNNING;
164 void SetActionInterruptable(
bool IsInterruptable)
166 m_bIsInterruptable = IsInterruptable;
176 param.SetVariableOut(node);
183 param.GetVariableIn(node);
188 TStringArray GetPortNames()
190 TStringArray namesOut = {};
192 namesOut.Insert(p.m_sPortName);
198 float GetRestrictedPriorityLevel(
float minimumLevel = PRIORITY_LEVEL_NORMAL)
200 return Math.Clamp(Math.Max(EvaluatePriorityLevel(), minimumLevel), PRIORITY_LEVEL_NORMAL, PRIORITY_LEVEL_PLAYER);