local: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Take[ _]On[ _]Helicopters(\|.*)?\]\]" to "{{GameCategory|tkoh|Scripting Commands}}")
m (Text replacement - "_{10,} " to "")
Line 1: Line 1:
{{Command|Comments=
{{Command|Comments=
____________________________________________________________________________________________


| ofp |Game name=
| ofp |Game name=
Line 11: Line 10:


|arg= global |Multiplayer Arguments=
|arg= global |Multiplayer Arguments=
____________________________________________________________________________________________


| Check if given unit is local on the computer in Multiplayer games - see [[Multiplayer Scripting#Locality|Multiplayer Scripting - Locality]].<br>
| Check if given unit is local on the computer in Multiplayer games - see [[Multiplayer Scripting#Locality|Multiplayer Scripting - Locality]].<br>
Line 19: Line 17:
* A game logic / module is always local to the server
* A game logic / module is always local to the server
* Terrain objects are local to every machine |Multiplayer=
* Terrain objects are local to every machine |Multiplayer=
____________________________________________________________________________________________


| [[local]] object |SYNTAX=
| [[local]] object |SYNTAX=
Line 26: Line 23:


| [[Boolean]] |RETURNVALUE=
| [[Boolean]] |RETURNVALUE=
____________________________________________________________________________________________


|s2= [[local]] variable = value <span style="margin-left: 7em">{{Color|red|From {{arma2}} until {{arma3}} v1.54}} - see '''[[private]]''' for later versions</span> |SYNTAX2=
|s2= [[local]] variable = value <span style="margin-left: 7em">{{Color|red|From {{arma2}} until {{arma3}} v1.54}} - see '''[[private]]''' for later versions</span> |SYNTAX2=


|r2= [[Nothing]] |RETURNVALUE2=
|r2= [[Nothing]] |RETURNVALUE2=
____________________________________________________________________________________________


|x1= <code>[[if]] ([[not]] [[local]] _unit) [[then]] {
|x1= <code>[[if]] ([[not]] [[local]] _unit) [[then]] {
Line 44: Line 39:
{{cc|Since {{arma3}} v1.54}}
{{cc|Since {{arma3}} v1.54}}
[[private]] _myVariable = 42;</code> |EXAMPLE3=
[[private]] _myVariable = 42;</code> |EXAMPLE3=
____________________________________________________________________________________________


| [[Arma 3: Event Handlers#Local|"Local" Event Handler]], [[owner]], [[setOwner]] |SEEALSO=
| [[Arma 3: Event Handlers#Local|"Local" Event Handler]], [[owner]], [[setOwner]] |SEEALSO=

Revision as of 01:52, 17 January 2021

Hover & click on the images for description

Description

Description:
Check if given unit is local on the computer in Multiplayer games - see Multiplayer Scripting - Locality.
This can be used to determine on which computer some code must be run. In Single player all objects are local.
Multiplayer:
A few things to note amongst others:
  • A game logic / module is always local to the server
  • Terrain objects are local to every machine
Groups:
Multiplayer

Syntax

Syntax:
local object
Parameters:
object: Object or Group (since Arma 3 v1.31.127204)
Return Value:
Boolean

Alternative Syntax

Syntax:
local variable = value From Arma 2 until Arma 3 v1.54 - see private for later versions
Return Value:
Nothing

Examples

Example 1:
if (not local _unit) then { hint format ["%1 is remote", name _unit]; };
Example 2:
_isLocalGroup = local group _unit;
Example 3:
Sets variable's scope:// From Arma 2 until Arma 3 v1.54 local _myVariable = 42; // Since Arma 3 v1.54 private _myVariable = 42;

Additional Information

See also:
"Local" Event HandlerownersetOwner

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

Bottom Section