playerSide: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:Scripting Commands ArmA|" to "[[Category:Scripting Commands Armed Assault|")
m (Add group)
Line 5: Line 5:


|1.00|Game version=
|1.00|Game version=
|gr1= Sides |GROUP1=
____________________________________________________________________________________________
____________________________________________________________________________________________


| Returns the player's [[Side|side]]. This is valid even when the player controlled person is dead (a difference from [[side]] [[player]]).<br><br>
| Returns the player's [[Side|side]]. This is valid even when the player controlled person is dead (a difference from [[side]] [[player]]).
{{Informative | [[playerSide]] will not change automatically if [[player]] [[join]]s a [[group]] on different [[side]]. However, [[selectPlayer]] command can and does change [[playerSide]], so the following code will change the side of the player including [[playerSide]]:
{{Informative | [[playerSide]] will not change automatically if [[player]] [[join]]s a [[group]] on different [[side]]. However, [[selectPlayer]] command can and does change [[playerSide]] - see '''[[#Examples|Example 3]]''' for information.}} |DESCRIPTION=
<code>[[private]] _player <nowiki>=</nowiki> [[player]];
<nowiki>[</nowiki>[[player]]] [[join]] [[createGroup]] [[east]];
[[selectNoPlayer]];
[[selectPlayer]] _player;
[[hint]] [[str]] [[playerSide]]; // EAST</code>}} |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 25: Line 22:
};</code>|EXAMPLE1=  
};</code>|EXAMPLE1=  


|x2=  
|x2= <code>[[switch]] ([[playerSide]]) do {
<code>[[switch]] ([[playerSide]]) do {
     [[case]] [[west]]: {
     [[case]] [[west]]: {
         [[hint]] "You are BLUFOR";
         [[hint]] "You are BLUFOR";
Line 33: Line 29:
         [[hint]] "You are OPFOR";
         [[hint]] "You are OPFOR";
     };
     };
};</code>|EXAMPLE2=  
};</code>|EXAMPLE2=
 
|x3= the following code will change the side of the player including [[playerSide]]:
<code>[[private]] _player {{=}} [[player]];
[<nowiki/>[[player]]] [[join]] [[createGroup]] [[east]];
[[selectNoPlayer]];
[[selectPlayer]] _player;
[[hint]] [[str]] [[playerSide]]; {{cc|EAST}}</code> |EXAMPLE3=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[Side]], [[side]], [[west]], [[east]], [[resistance]], [[civilian]], [[sideLogic]], [[sideFriendly]], [[sideEnemy]], [[sideUnknown]], [[sideEmpty]], [[sideAmbientLife]], [[Side relations]] |SEEALSO=
| [[Side]], [[side]], [[west]], [[east]], [[resistance]], [[civilian]], [[sideLogic]], [[sideFriendly]], [[sideEnemy]], [[sideUnknown]], [[sideEmpty]], [[sideAmbientLife]], [[Side relations]] |SEEALSO=
}}
}}


Line 48: Line 50:
[[playerSide]] defaults to [[west]] for JIP players early on during initialization regardless of their side.<br>
[[playerSide]] defaults to [[west]] for JIP players early on during initialization regardless of their side.<br>
So if you are a JIP player on another side (like [[east]]), you will need to cater for this for any early initializations.
So if you are a JIP player on another side (like [[east]]), you will need to cater for this for any early initializations.


<dd class="notedate">Posted on 13 Oct, 2008
<dd class="notedate">Posted on 13 Oct, 2008
<dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]]<dd class="note">
<dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]]<dd class="note">
[[playerSide]] also shows your starting side, even if your [[side]] changes to [[enemy]] due to a bad [[rating]]. In that case, playerSide != side player.
[[playerSide]] also shows your starting side, even if your [[side]] changes to [[enemy]] due to a bad [[rating]]. In that case, playerSide != side player.


<!-- Note Section END -->
<!-- Note Section END -->
Line 59: Line 59:


<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|PLAYERSIDE]]
[[Category:Scripting Commands OFP Elite |{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP Elite |PLAYERSIDE]]
[[Category:Scripting Commands Armed Assault|PLAYERSIDE]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Sides|{{uc:{{PAGENAME}}}}]]

Revision as of 14:28, 25 September 2020

-wrong parameter ("Arma") defined!-1.00
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

Notes

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.

Bottom Section