setObjectTextureGlobal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Some wiki formatting)
m (Brought some text in line with setObjectTexture)
Line 9: Line 9:
|gr1= Object Manipulation
|gr1= Object Manipulation


|descr= Set the texture of the given selection on all computers in a network session.<br>
|descr= Set the texture of the given selection on all computers in a network session.
Not all objects can be textured this way. See [[getObjectTextures]] for supported texture selections.
 
{{Feature|Informative|
{{Feature|Informative|
* Not all objects can be textured this way. To find out, run [[getObjectTextures]] command on an object. Empty array <sqf inline>[]</sqf> usually indicates it cannot be textured.
* Not all objects can be textured this way. To find out, run [[getObjectTextures]] command on an object. Empty array <sqf inline>[]</sqf> usually indicates it cannot be textured.
* All textures must have a resolution of 2^x &times; 2^y (16&times;16, 16&times;32, 64&times;256, 512&times;512, ...). The largest texture size supported by the RV engine is 4096&times;4096  
* All textures must have a resolution of 2<sup>a</sup> &times; 2<sup>b</sup> (e.g. 16&times;16, 16&times;32, 64&times;256, 512&times;512, ...). The largest texture size supported by the RV engine is 4096&times;4096.
* Supported formats: .pac, .paa, .jpg, .jpeg, .ogg, .ogv
* Supported formats: .pac, .paa, .jpg, .jpeg, .ogg, .ogv
}}
}}
Line 22: Line 20:
|pr= If executed from an object's init field (which should not be done anyway for {{Icon|globalEffect|32}} commands), execution may happen too early and fail to broadcast over the network and to be [[Multiplayer Scripting#Join In Progress|JIP]] compatible.
|pr= If executed from an object's init field (which should not be done anyway for {{Icon|globalEffect|32}} commands), execution may happen too early and fail to broadcast over the network and to be [[Multiplayer Scripting#Join In Progress|JIP]] compatible.


|s1= obj [[setObjectTextureGlobal]] [selection, texture]
|s1= object [[setObjectTextureGlobal]] [selection, texture]


|p1= obj: [[Object]]
|p1= object: [[Object]]


|p2= selection: [[Number]] or {{GVI|arma3|2.10|size=0.75}} [[String]] - Index of the selection. It is defined in the [[CfgVehicles_Config_Reference#hiddenSelections|hiddenselection]][] = {} array in the vehicle's config (starting with 0). If a string has given, it referee the hiddenSelection name or clan selection instead of the number index.
|p2= selection: [[Number]] or {{GVI|arma3|2.10|size=0.75}} [[String]] - Index of the selection. It is defined in the [[CfgVehicles Config Reference#hiddenSelections|hiddenSelections]] array in the vehicle's config (starting with 0). If a string is given, it referes to a hiddenSelection name or clan selection instead of an index.


|p3= texture: [[String]]
|p3= texture: [[String]] - Path to texture


|r1= [[Nothing]]
|r1= [[Nothing]]

Revision as of 12:08, 13 September 2022

Hover & click on the images for description

Description

Description:
Set the texture of the given selection on all computers in a network session.
  • 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
Multiplayer:
The effect is JIP compatible.
Problems:
If executed from an object's init field (which should not be done anyway for GEGlobal commands), execution may happen too early and fail to broadcast over the network and to be JIP compatible.
Groups:
Object Manipulation

Syntax

Syntax:
object setObjectTextureGlobal [selection, texture]
Parameters:
object: Object
selection: Number or Arma 3 logo black.png2.10 String - Index of the selection. It is defined in the hiddenSelections array in the vehicle's config (starting with 0). If a string is given, it referes to a hiddenSelection name or clan selection instead of an index.
texture: String - Path to texture
Return Value:
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

Additional Information

See also:
setObjectTexture getObjectTextures setObjectMaterial forceFlagTexture

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
Killzone_Kid - c
Posted on Oct 24, 2016 - 12:13 (UTC)
Sometimes it could be necessary to set default material on an object for the texture to take effect:
private _block = createVehicle ["Land_VR_Block_02_F", player getPos [20, getDir player], [], 0, "CAN_COLLIDE"]; _block setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"]; _block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];
Courtesy of Larrow