setObjectTextureGlobal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(size matters)
m (template:command argument fix)
Line 19: Line 19:
| obj '''setObjectTextureGlobal''' [selection, texture] |= Syntax
| obj '''setObjectTextureGlobal''' [selection, texture] |= Syntax


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


|p2= [selection,texture]: [[Array]]  |= PARAMETER2
|p2= [selection,texture]: [[Array]]  |PARAMETER2=


|p3= selection: [[Number]]  |= PARAMETER3
|p3= selection: [[Number]]  |PARAMETER3=  


|p4= texture: [[String]]  |= PARAMETER4
|p4= texture: [[String]]  |PARAMETER4=


| [[Nothing]] |= RETURNVALUE
| [[Nothing]] |RETURNVALUE=  




|x1= <code>[[player]] [[setObjectTextureGlobal]] [0, "\MyAddon\blue.paa"];</code>|= EXAMPLE1
|x1= <code>[[player]] [[setObjectTextureGlobal]] [0, "\MyAddon\blue.paa"];</code>|EXAMPLE1=  
|x2= <code>//set up persistent texture keeper
|x2= <code>//set up persistent texture keeper
[[player]] [[addEventHandler]] ["Take", {
[[player]] [[addEventHandler]] ["Take", {
Line 46: Line 46:
_texture =  "#(rgb,8,8,3)color(0,0,1,1)"; //blue texture
_texture =  "#(rgb,8,8,3)color(0,0,1,1)"; //blue texture
[[player]] [[setObjectTextureGlobal]] [0, _texture]; //set it on player
[[player]] [[setObjectTextureGlobal]] [0, _texture]; //set it on player
[[uniformContainer]] [[player]] [[setVariable]] ["texture", _texture, [[true]]]; //store it on uniform</code>|= EXAMPLE2
[[uniformContainer]] [[player]] [[setVariable]] ["texture", _texture, [[true]]]; //store it on uniform</code>|EXAMPLE2=  
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[setObjectTexture]], [[getObjectTextures]], [[setObjectMaterial]], [[forceFlagTexture]] |= SEEALSO
| [[setObjectTexture]], [[getObjectTextures]], [[setObjectMaterial]], [[forceFlagTexture]] |SEEALSO=  


|  |= MPBEHAVIOUR
|  |MPBEHAVIOUR=  
____________________________________________________________________________________________
____________________________________________________________________________________________
}}
}}

Revision as of 11:37, 7 April 2019

Hover & click on the images for description

Description

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

NOTES:
  • Do not put global commands such this one into init field in editor and expect it to work in Multiplayer. See Talk:setObjectTextureGlobal for the explanation.
  • Not all objects could 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 resolution 2^x / 2^y (e.g. 16 / 16, 16 / 32, 64 / 256, 512 / 512, etc). The largest texture size commonly supported by graphics cards and RV engine is 4096x4096
Groups:
Uncategorised

Syntax

Syntax:
obj setObjectTextureGlobal [selection, texture]
Parameters:
obj: Object
[selection,texture]: Array
selection: Number
texture: String
Return Value:
Nothing

Examples

Example 1:
player setObjectTextureGlobal [0, "\MyAddon\blue.paa"];
Example 2:
//set up 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 _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:
setObjectTexturegetObjectTexturessetObjectMaterialforceFlagTexture

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

Bottom Section

Posted on March 8, 2015 - 21:15 (UTC)
Sxp2hiiigh
The effect is persistent and will be synchronized for players who join in progress. (Tested with Arma 3 v1.40)
Posted on December 29, 2015 - 18:13 (UTC)
Elch2070
In some cases the ".paa" files do not work. Instead you can try ".jpg" files.
Posted on October 24, 2016 - 12:13 (UTC)
Killzone Kid
Sometimes it could be necessary to set default material on an object for the texture to take effect: _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