Skip to content

Commit

Permalink
added check for possessing
Browse files Browse the repository at this point in the history
  • Loading branch information
y0014984 authored Oct 17, 2023
1 parent 7954057 commit 1ea8484
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/bastelstube/arma-reforger.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,18 @@ GetGame().GetCallqueue().CallLater(FunctionWithoutBraces, delay, repeat, paramet
SCR_Global.IsEditMode();
// returns true if currentlich in Workbench Mode and not in-game
```

## Check if Game Master is controlling an entity (possessing)
```c#
// This is a given entity; This is dummy code
IEntity entity;

int playerId = GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(entity);
SCR_PlayerController playerController = SCR_PlayerController.Cast(GetGame().GetPlayerManager().GetPlayerController(playerId));
if (!playerController)
return;

// Possessing means that the game master is controlling an AI character
// The game master also has (optionally) it's own character; If he controls his own unit, it's not possessing
Print(string.Format("isPossessing: %1", playerController.IsPossessing()), LogLevel.NORMAL);
```

0 comments on commit 1ea8484

Please sign in to comment.