local: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
(alt syntax - keyword usage)
Line 11: Line 11:
| Check if given unit is local on the computer in Multiplayer games (see [[Locality in Multiplayer]] for general concepts).
| Check if given unit is local on the computer in Multiplayer games (see [[Locality in Multiplayer]] for general concepts).


<br>This can be used when some activation fields or scripts need to be performed only on one computer. In Singleplayer all objects are local.  
<br>This can be used when some activation fields or scripts need to be performed only on one computer. In Single player all objects are local.  


<br>''Note:'' Map created objects (those placed in [[Terrain_Editing|Visitor]]) are local everywhere. |= Description
<br><br>'''Note1:''' Map created objects (those placed in [[Terrain_Editing|Visitor]]) are local everywhere.
<br>'''Note2:''' [[local]] can also be used as keyword prepending a variable as explained in Alt Syntax. This will instruct the engine to [[private]]-ise the variable on the fly, at the moment of assignment. |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 21: Line 22:


| [[Boolean]] |= Return value
| [[Boolean]] |= Return value
| s2 = '''local''' variable = value |= Syntax
|p21= variable: underscored variable, for example _lol  |= Parameter 1
|p22= value: [[Anything]]: value to assign to the variable  |= Parameter 1
|r2 =  [[Nothing]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
Line 30: Line 38:


|x3= <code>_isLocalGroup = [[local]] [[group]] _unit;</code> |= Example 3
|x3= <code>_isLocalGroup = [[local]] [[group]] _unit;</code> |= Example 3
|x4= Usage of [[local]] as keyword: <code>[[local]] _lol = 123;
//is the same as
[[private]] "_lol";
_lol = 123;</code> |= Example 4
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 21:54, 24 September 2015

Hover & click on the images for description

Description

Description:
Check if given unit is local on the computer in Multiplayer games (see Locality in Multiplayer for general concepts).
This can be used when some activation fields or scripts need to be performed only on one computer. In Single player all objects are local.

Note1: Map created objects (those placed in Visitor) are local everywhere.
Note2: local can also be used as keyword prepending a variable as explained in Alt Syntax. This will instruct the engine to private-ise the variable on the fly, at the moment of assignment.
Problems:
In MP remote objects are not initialised in functions called by initline or init eventhandlers.
Groups:
Uncategorised

Syntax

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

Alternative Syntax

Syntax:
local variable = value
Parameters:
variable: underscored variable, for example _lol
value: Anything: value to assign to the variable
Return Value:
Nothing

Examples

Example 1:
SQS:?!local _unitName : hint "remote"
Example 2:
SQF:if (!local _unitName) then { hint "remote"; };
Example 3:
_isLocalGroup = local group _unit;
Example 4:
Usage of local as keyword: local _lol = 123; //is the same as private "_lol"; _lol = 123;

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

Posted on August 4, 2006 - 10:56
hardrock
Notes from before the conversion: In multiplayer, a game logic will always be local to the host computer. This works on both dedicated and player-hosted servers.

Bottom Section