Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AIGetPosForward.c
Go to the documentation of this file.
1
class
SCR_AIGetPosForward
:
AITaskScripted
2
{
3
static
const
string
PORT_DISTANCE =
"DistanceIn"
;
4
static
const
string
PORT_RESULT_VECTOR =
"VectorOut"
;
5
static
const
string
PORT_TARGET =
"TargetIn"
;
6
7
[
Attribute
(
"10"
,
UIWidgets
.EditBox, PORT_DISTANCE)]
8
float
m_Distance;
9
10
protected
vector
m_ResultVector
;
11
protected
IEntity
m_Target
;
12
13
//------------------------------------------------------------------------------------------------
14
override
void
OnInit
(AIAgent owner)
15
{
16
if
(
GetVariableIn
(PORT_DISTANCE, m_Distance) && (
GetVariableType
(
true
, PORT_DISTANCE) !=
int
&&
GetVariableType
(
true
, PORT_DISTANCE) !=
float
) )
17
{
18
NodeError
(
this
, owner, PORT_DISTANCE +
" type should be number"
);
19
}
20
}
21
22
//------------------------------------------------------------------------------------------------
23
override
ENodeResult
EOnTaskSimulate
(AIAgent owner,
float
dt)
24
{
25
if
(!
GetVariableIn
(PORT_TARGET,
m_Target
))
26
m_Target
= owner;
27
28
AIAgent agent = AIAgent.Cast(
m_Target
);
29
if
(agent)
30
m_Target
= agent.GetControlledEntity();
31
32
if
(!
m_Target
)
33
return
ENodeResult
.FAIL;
34
35
vector
direction
=
m_Target
.GetYawPitchRoll().AnglesToVector();
36
37
if
(
GetVariableType
(
true
, PORT_DISTANCE) ==
int
)
38
{
39
int
distance
;
40
GetVariableIn
(PORT_DISTANCE,
distance
);
41
m_Distance =
distance
;
42
}
43
else
if
(
GetVariableType
(
true
, PORT_DISTANCE) ==
float
)
44
{
45
GetVariableIn
(PORT_DISTANCE, m_Distance);
46
}
47
48
vector
pos =
m_Target
.GetOrigin();
49
50
vector
forwardVector = pos + (
direction
* m_Distance );
51
// snap the vector on ground, for valid location to run to
52
forwardVector[1] =
m_Target
.GetWorld().GetSurfaceY(forwardVector[0], forwardVector[2]);
53
54
m_ResultVector
= forwardVector;
55
56
SetVariableOut
(PORT_RESULT_VECTOR,
m_ResultVector
);
57
58
return
ENodeResult
.SUCCESS;
59
}
60
61
//------------------------------------------------------------------------------------------------
62
protected
static
override
string
GetOnHoverDescription
()
63
{
64
return
"It will return world position of forward vector of provided target entity multiplied by distance. If no target specified, owner will be used."
;
65
}
66
67
//------------------------------------------------------------------------------------------------
68
static
override
bool
VisibleInPalette
()
69
{
70
return
true
;
71
}
72
73
//------------------------------------------------------------------------------------------------
74
protected
static
ref
TStringArray
s_aVarsIn
= {
75
PORT_TARGET,
76
PORT_DISTANCE
77
};
78
override
TStringArray
GetVariablesIn
()
79
{
80
return
s_aVarsIn
;
81
}
82
83
//------------------------------------------------------------------------------------------------
84
protected
static
ref
TStringArray
s_aVarsOut
= {
85
PORT_RESULT_VECTOR
86
};
87
override
TStringArray
GetVariablesOut
()
88
{
89
return
s_aVarsOut
;
90
}
91
};
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition
NodeError.c:3
distance
float distance
Definition
SCR_DestructibleTreeV2.c:29
direction
vector direction
Definition
SCR_DestructibleTreeV2.c:31
AITaskScripted
Definition
AITaskScripted.c:13
IEntity
Definition
IEntity.c:13
Node::SetVariableOut
proto void SetVariableOut(string name, void val)
Node::GetVariableIn
proto bool GetVariableIn(string name, out void val)
Node::GetVariableType
proto external GetVariableType(bool inputPort, string name)
SCR_AIGetPosForward
Definition
SCR_AIGetPosForward.c:2
SCR_AIGetPosForward::s_aVarsOut
static ref TStringArray s_aVarsOut
Definition
SCR_AIGetPosForward.c:84
SCR_AIGetPosForward::m_ResultVector
vector m_ResultVector
Definition
SCR_AIGetPosForward.c:10
SCR_AIGetPosForward::m_Target
IEntity m_Target
Definition
SCR_AIGetPosForward.c:11
SCR_AIGetPosForward::GetVariablesIn
override TStringArray GetVariablesIn()
Definition
SCR_AIGetPosForward.c:78
SCR_AIGetPosForward::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AIGetPosForward.c:68
SCR_AIGetPosForward::GetOnHoverDescription
static override string GetOnHoverDescription()
Definition
SCR_AIGetPosForward.c:62
SCR_AIGetPosForward::GetVariablesOut
override TStringArray GetVariablesOut()
Definition
SCR_AIGetPosForward.c:87
SCR_AIGetPosForward::OnInit
override void OnInit(AIAgent owner)
Definition
SCR_AIGetPosForward.c:14
SCR_AIGetPosForward::EOnTaskSimulate
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
Definition
SCR_AIGetPosForward.c:23
SCR_AIGetPosForward::s_aVarsIn
static ref TStringArray s_aVarsIn
Definition
SCR_AIGetPosForward.c:74
UIWidgets
Definition
attributes.c:40
vector
Definition
vector.c:13
ENodeResult
ENodeResult
Definition
ENodeResult.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
TStringArray
array< string > TStringArray
Definition
Types.c:385
scripts
Game
AI
ScriptedNodes
Utils
SCR_AIGetPosForward.c
Generated by
1.17.0