Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIFollowEntityPath.c
Go to the documentation of this file.
1 
6 {
7  static const string PORT_ENTITY_IN = "GroupIn";
8 
9  //------------------------------------------------------------------------------------------------
10  ChimeraCharacter m_pCharacter;
11  GenericEntity m_pFollowedEntity;
12  bool setupResult;
13  AIBaseMovementComponent m_pMyMovementComponent;
14 
15  override bool VisibleInPalette()
16  {
17  return true;
18  }
19 
20  override void OnEnter(AIAgent owner)
21  {
22  GetVariableIn(PORT_ENTITY_IN, m_pFollowedEntity);
23  if (!m_pFollowedEntity)
24  {
25  m_pFollowedEntity = owner.GetParentGroup();
26  }
27 
28  m_pMyMovementComponent = owner.GetMovementComponent();
29  if (!m_pMyMovementComponent)
30  return;
31 
32  setupResult = m_pMyMovementComponent.RequestFollowPathOfEntity(m_pFollowedEntity);
33  }
34 
35  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
36  {
37  if (!m_pMyMovementComponent || !setupResult)
38  return ENodeResult.FAIL;
39 
40  if (m_pMyMovementComponent.HasCompletedRequest(true))
41  return ENodeResult.SUCCESS;
42  return ENodeResult.RUNNING;
43  }
44 
45  protected static ref TStringArray s_aVarsIn = {
46  PORT_ENTITY_IN
47  };
48  override TStringArray GetVariablesIn()
49  {
50  return s_aVarsIn;
51  }
52 };
SCR_AIFollowEntityPath
Definition: SCR_AIFollowEntityPath.c:5
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
SCR_AIActionTask
Definition: SCR_AIBehaviorTask.c:1