local: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| ofp | | ofp | ||
|1.00 | |1.00 | ||
|gr1 = Multiplayer | |gr1 = Multiplayer | ||
|arg= global | |arg= global | ||
| 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> | ||
This can be used to determine on which computer some code must be run. In Single player all objects are local. | This can be used to determine on which computer some code must be run. In Single player all objects are local. | ||
|mp= A few things to note [[Multiplayer Scripting#General information about locality|amongst others]]: | |mp= A few things to note [[Multiplayer Scripting#General information about locality|amongst others]]: | ||
Line 18: | Line 18: | ||
* Terrain objects are local to every machine |Multiplayer= | * Terrain objects are local to every machine |Multiplayer= | ||
| [[local]] object | | [[local]] object | ||
|p1= object: [[Object]] or [[Group]] (since Arma 3 v1.31.127204) | |p1= object: [[Object]] or [[Group]] (since Arma 3 v1.31.127204) | ||
| [[Boolean]] | | [[Boolean]] | ||
|s2= [[local]] variable = value <span style="margin-left: 7em">{{Color|red|From {{arma2}} until {{arma3}} v1.54}} - see '''[[private]]''' for later versions</span> | |s2= [[local]] variable = value <span style="margin-left: 7em">{{Color|red|From {{arma2}} until {{arma3}} v1.54}} - see '''[[private]]''' for later versions</span> | ||
|r2= [[Nothing]] | |r2= [[Nothing]] | ||
|x1= <code>[[if]] ([[not]] [[local]] _unit) [[then]] { | |x1= <code>[[if]] ([[not]] [[local]] _unit) [[then]] { | ||
[[hint]] [[format]] ["%1 is remote", [[name]] _unit]; | [[hint]] [[format]] ["%1 is remote", [[name]] _unit]; | ||
};</code> | };</code> | ||
|x2= <code>_isLocalGroup = [[local]] [[group]] _unit;</code> | |x2= <code>_isLocalGroup = [[local]] [[group]] _unit;</code> | ||
|x3= Sets variable's [[Variables#Scopes|scope]]:<code>{{cc|From {{arma2}} until {{arma3}} v1.54}} | |x3= Sets variable's [[Variables#Scopes|scope]]:<code>{{cc|From {{arma2}} until {{arma3}} v1.54}} | ||
Line 38: | Line 38: | ||
{{cc|Since {{arma3}} v1.54}} | {{cc|Since {{arma3}} v1.54}} | ||
[[private]] _myVariable = 42;</code> | [[private]] _myVariable = 42;</code> | ||
| [[Arma 3: Event Handlers#Local|"Local" Event Handler]], [[owner]], [[setOwner]] | | [[Arma 3: Event Handlers#Local|"Local" Event Handler]], [[owner]], [[setOwner]] | ||
}} | }} | ||
Revision as of 01:03, 18 January 2021
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
Bottom Section
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.00
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Multiplayer
- Scripting Commands OFP 1.46
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.99
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 3: Scripting Commands
- Take On Helicopters: Scripting Commands