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_CharacterEntityWaypointGroupCommand.c
Go to the documentation of this file.
1
//command that takes an EntityWaypoint, and executes the waypoint with entity under cursor, or player controller entity if Character entity not found
2
[
BaseContainerProps
(),
SCR_BaseGroupCommandTitleField
(
"m_sCommandName"
)]
3
class
SCR_CharacterEntityWaypointGroupCommand
:
SCR_WaypointGroupCommand
4
{
5
//------------------------------------------------------------------------------------------------
6
override
bool
Execute(
IEntity
cursorTarget,
IEntity
target,
vector
targetPosition,
int
playerID,
bool
isClient)
7
{
8
if
(isClient && playerID ==
SCR_PlayerController
.
GetLocalPlayerId
())
9
{
10
//SpawnWPVisualization(targetPosition, playerID);
11
return
true
;
12
}
13
14
//SpawnWPVisualization(targetPosition, playerID);
15
if
(
m_sWaypointPrefab
.Empty || !target || !targetPosition)
16
return
false
;
17
18
IEntity
targetEntity;
19
if
(cursorTarget)
20
targetEntity = cursorTarget.
GetRootParent
();
21
22
return
CreateCharacterEntityWP(targetEntity, target, targetPosition, playerID);
23
}
24
25
//------------------------------------------------------------------------------------------------
26
bool
CreateCharacterEntityWP(
IEntity
cursorTarget,
IEntity
targetGroup,
vector
targetPosition,
int
playerID)
27
{
28
ChimeraCharacter
character =
ChimeraCharacter
.Cast(cursorTarget);
29
if
(!character)
30
character =
ChimeraCharacter
.Cast(
GetGame
().GetPlayerManager().GetPlayerControlledEntity(playerID));
31
32
if
(!character)
33
return
false
;
34
35
Resource
waypointPrefab =
Resource
.Load(
GetWaypointPrefab
());
36
if
(!waypointPrefab.IsValid())
37
{
38
Print
(
"SCR_CharacterEntityWaypointGroupCommand:: Invalid prefab path"
,
LogLevel
.ERROR);
39
return
false
;
40
}
41
42
SCR_AIGroup
slaveGroup =
SCR_AIGroup
.Cast(targetGroup);
43
if
(!slaveGroup)
44
return
false
;
45
46
EntitySpawnParams
params
=
EntitySpawnParams
();
47
params
.TransformMode = ETransformMode.WORLD;
48
params
.Transform[3] = character.GetOrigin();
49
50
CheckPreviousWaypoints
(slaveGroup);
51
52
SCR_EntityWaypoint
wp =
SCR_EntityWaypoint
.Cast(
GetGame
().SpawnEntityPrefabLocal(waypointPrefab, null,
params
));
53
if
(!wp)
54
return
false
;
55
56
if
(
m_bForceCommand
)
57
wp.SetPriorityLevel(SCR_AIActionBase.PRIORITY_LEVEL_PLAYER);
58
59
wp.SetCompletionRadius(
m_fCompletionRadius
);
60
wp.SetEntity(character);
61
slaveGroup.AddWaypoint(wp);
62
63
return
true
;
64
}
65
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
ChimeraCharacter
Definition
ChimeraCharacter.c:13
IEntity
Definition
IEntity.c:13
IEntity::GetRootParent
proto external IEntity GetRootParent()
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
SCR_AIGroup
Definition
SCR_AIGroup.c:75
SCR_BaseGroupCommandTitleField
Definition
SCR_PlayerCommandsConfig.c:155
SCR_CharacterEntityWaypointGroupCommand
Definition
SCR_CharacterEntityWaypointGroupCommand.c:4
SCR_EntityWaypoint
Definition
SCR_EntityWaypoint.c:44
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_PlayerController::GetLocalPlayerId
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
Definition
SCR_PlayerController.c:481
SCR_WaypointGroupCommand
Definition
SCR_WaypointGroupCommand.c:4
SCR_WaypointGroupCommand::m_fCompletionRadius
float m_fCompletionRadius
Definition
SCR_WaypointGroupCommand.c:18
SCR_WaypointGroupCommand::m_bForceCommand
bool m_bForceCommand
Definition
SCR_WaypointGroupCommand.c:15
SCR_WaypointGroupCommand::m_sWaypointPrefab
ResourceName m_sWaypointPrefab
Definition
SCR_WaypointGroupCommand.c:6
SCR_WaypointGroupCommand::GetWaypointPrefab
ResourceName GetWaypointPrefab()
Definition
SCR_WaypointGroupCommand.c:121
SCR_WaypointGroupCommand::CheckPreviousWaypoints
void CheckPreviousWaypoints(SCR_AIGroup slaveGroup)
Definition
SCR_WaypointGroupCommand.c:160
vector
Definition
vector.c:13
EntitySpawnParams
void EntitySpawnParams()
Definition
gameLib.c:130
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
scripts
Game
Commanding
Commands
SCR_CharacterEntityWaypointGroupCommand.c
Generated by
1.17.0