playerSide: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
m (Text replacement - ";[ ]+ " to "; ")
Line 37: Line 37:


|x3= the following code will change the side of the player including [[playerSide]]:
|x3= the following code will change the side of the player including [[playerSide]]:
<code>[[private]] _player = [[player]];  
<code>[[private]] _player = [[player]];
[<nowiki/>[[player]]] [[join]] [[createGroup]] [[east]];  
[<nowiki/>[[player]]] [[join]] [[createGroup]] [[east]];
[[selectNoPlayer]];  
[[selectNoPlayer]];
[[selectPlayer]] _player;
[[selectPlayer]] _player;
[[hint]] [[str]] [[playerSide]]; {{cc|EAST}}</code>
[[hint]] [[str]] [[playerSide]]; {{cc|EAST}}</code>

Revision as of 01:54, 8 August 2021

Hover & click on the images for description

Description

Description:
Returns the player's side. This is valid even when the player controlled person is dead (a difference from side player).
playerSide will not change automatically if player joins a group on different side. However, selectPlayer command can and does change playerSide - see Example 3 for information.
Groups:
Sides

Syntax

Syntax:
playerSide
Return Value:
Side

Examples

Example 1:
if (side man1 == playerSide) then { hint "man1 is on your side!"; };
Example 2:
switch (playerSide) do { case west: { hint "You are BLUFOR"; }; case east: { hint "You are OPFOR"; }; };
Example 3:
the following code will change the side of the player including playerSide: private _player = player; [player] join createGroup east; selectNoPlayer; selectPlayer _player; hint str playerSide; // EAST

Additional Information

See also:
SidesidewesteastresistanceciviliansideLogicsideFriendlysideEnemysideUnknownsideEmptysideAmbientLifeSide relations

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on 27 Jan, 2008
Dr_Eyeball
playerSide defaults to west for JIP players early on during initialization regardless of their side.
So if you are a JIP player on another side (like east), you will need to cater for this for any early initializations.
Posted on 13 Oct, 2008
Dr_Eyeball
playerSide also shows your starting side, even if your side changes to enemy due to a bad rating. In that case, playerSide != side player.