Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AICalculateNextCombatMovePos.c
Go to the documentation of this file.
1 class SCR_AICalculateNextCombatMovePos : AITaskScripted
2 {
3  // Inputs
4  protected static const string PORT_REQUEST = "Request";
5  protected static const string PORT_TARGET_POS = "TargetPos";
6 
7  // Outputs
8  protected static const string PORT_POS = "Pos";
9 
10  protected static const float RANDOM_POS_RADIUS = 2;
11 
12  //--------------------------------------------------------------------------------------------
13  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
14  {
15  IEntity myEntity = owner.GetControlledEntity();
16  if (!myEntity)
17  return ENodeResult.FAIL;
18 
19  // Read inputs
21  GetVariableIn(PORT_REQUEST, rqBase);
23  if (!rq)
24  return SCR_AIErrorMessages.NodeErrorCombatMoveRequest(this, owner, rq);
25 
26  vector ownerPos = myEntity.GetOrigin();
27 
28  vector moveDir = SCR_AICombatMoveUtils.CalculateMoveDirection(rq.m_eDirection, ownerPos, rq.m_vMovePos); // It can't return 000!
29 
30  float moveDistance = rq.m_fMoveDistance;
31 
32  vector newPositionCenter = ownerPos + moveDir * moveDistance, newPosition;
33 
34  newPosition = s_AIRandomGenerator.GenerateRandomPointInRadius(0, RANDOM_POS_RADIUS, newPositionCenter, true);
35  newPosition[1] = newPositionCenter[1];
36 
37  SetVariableOut(PORT_POS, newPosition);
38 
39  return ENodeResult.SUCCESS;
40  }
41 
42  //--------------------------------------------------------------------------------------------
43  protected static ref TStringArray s_aVarsOut = {
44  PORT_POS
45  };
46  override TStringArray GetVariablesOut() { return s_aVarsOut; }
47 
48  protected static ref TStringArray s_aVarsIn = {
50  };
51  override TStringArray GetVariablesIn() { return s_aVarsIn; }
52 
53  override bool VisibleInPalette() { return true; }
54 
55 }
SCR_AICombatMoveUtils
Definition: SCR_AICombatMoveUtils.c:5
SCR_AICombatMoveRequestBase
Definition: SCR_AICombatMoveRequest.c:37
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
PORT_REQUEST
SCR_AISetCombatMoveRequestState PORT_REQUEST
SCR_AIErrorMessages
Definition: NodeError.c:30
SCR_AICombatMoveRequest_Move
Definition: SCR_AICombatMoveRequest.c:78
SCR_AICalculateNextCombatMovePos
Definition: SCR_AICalculateNextCombatMovePos.c:1