Arma 3 Scripting

Command in Object Manipulation

setObjectTextureGlobal

Also available as Markdown and JSON, or read the original wiki page.

Description

Set the texture of the given selection on all computers in a network session.

Note

  • Not all objects can be textured this way. To find out, run getObjectTextures command on an object. Empty array [] usually indicates it cannot be textured.
  • All textures must have a resolution of 2a × 2b (e.g. 16×16, 16×32, 64×256, 512×512, ...). The largest texture size supported by the RV engine is 4096×4096.
  • Supported formats: .pac, .paa, .jpg, .jpeg, .ogg, .ogv

Syntax

object setObjectTextureGlobal [selection, texture]

Parameters:

Returns: Nothing

Examples

Example 1

player setObjectTextureGlobal [0, "\MyAddon\blue.paa"];

Example 2

// Set up a persistent texture keeper
player addEventHandler ["Take", {
    (getObjectTextures player + [uniformContainer player getVariable "texture"])
    params ["_texUniform", "_texInsignia", "_texCustom"];
    if (isNil "_texCustom") exitWith {};
    if (_texUniform == _texCustom) exitWith {};
    player setObjectTextureGlobal [0, _texCustom];
    false
}];

// Example: make current uniform persistently blue

private _texture = "#(rgb,8,8,3)color(0,0,1,1)"; // blue texture
player setObjectTextureGlobal [0, _texture]; // set it on player
uniformContainer player setVariable ["texture", _texture, true]; // store it on uniform

Multiplayer

The effect is JIP compatible.

Problems

If executed from an object's init field (which should not be done anyway for Global Effect commands), execution may happen too early and fail to broadcast over the network and to be JIP compatible.

See also

setObjectTexture · getObjectTextures · setObjectMaterial · forceFlagTexture

Community notes

whiztler

Following Killzone_Kid's note, a sleep after the setObjectMaterialGlobal and before the setObjectTextureGlobal command is sometimes needed to ensure the texture effect is carried out correctly.

private _block = createVehicle ["Land_VR_Block_02_F", player getPos [20, getDir player], [], 0, "CAN_COLLIDE"];
_block setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
sleep 0.01;
_block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];

Note that you need to run above code in a scheduled environment.