|p4= value: [[Anything]] - (if public is true, check [[publicVariable]] for what types are supported for broadcast) |= Parameter 4

+

|p4= value: [[Anything]] - variable value |= Parameter 4

−

|p5= public (Optional): [[Boolean]] - Only available for [[Object]] types and (''since Arma 3 v1.48'') for [[missionNamespace]]. If public is [[true]] then the value is broadcast to all computers. {{EffArg|cmd|eff|glob}} |= Parameter 5

Revision as of 10:58, 9 July 2017

1.00

Hover & click on the images for descriptions

Description

Description:

Set variable to given value in the variable space of given element.
To remove a variable, set it to nil (e.g. playersetVariable ["varname", nil];).
When variable is set on Task, it is not actually set on task itself, but on FSM attached to the task. So if there is no FSM setVariable will not work.
All available variable spaces which support setVariable:

The variable space of the object is local to each client and by default changes are not broadcast.
Since Arma 2: If the public parameter for supported types is true, the value will be synchronized also for a JIP player.

Notes

Notes

According to Suma, beginning with ArmA version 1.08, "setVariable now should work on any entity which can be targeted by AI, including soldier and game logic units. This includes most buildings, but not other static objects.
Using it with buildings one should be aware the building may be discarded because of streaming. In such case the variable space is lost. When used for buildings, the storage should therefore be considered non-reliable." Reference: Make setVariable work on other things than just vehicles

Bottom Section

(A3) Disable randomization and set a color to randomized vehicles by using ‘this setVariable ["color",X]’ in the init of the vehicle where X is a number ranging from 0 to the number of skins (minus 1). If the number is out of range, the skin is still randomized.