setObjectTextureGlobal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Rewrite 2.10)
m (Some wiki formatting)
Line 12: Line 12:
Not all objects can be textured this way. See [[getObjectTextures]] for supported texture selections.
Not all objects can be textured this way. See [[getObjectTextures]] for supported texture selections.


{{Feature | Informative | All textures must have a resolution of 2^x / 2^y (e.g. 16x16, 16x32, 64x256, 512x32, etc). The largest texture size supported by the RV engine is 4096x4096.}}
{{Feature|informative|All textures must have a resolution of 2^x / 2^y (e.g. 16×16, 16×32, 64×256, 512×32, etc). The largest texture size supported by the RV engine is 4096×4096.}}


|mp= The effect is [[Multiplayer Scripting#Join In Progress|JIP]] compatible.
|mp= The effect is [[Multiplayer Scripting#Join In Progress|JIP]] compatible.
{{Feature | important | Do not put global commands in an object's init field : see [[Multiplayer Scripting#Join In Progress|Multiplayer Scripting - Join In Progress note]] for the explanation.}}


|pr= If executed from a vehicle's init field (going against the above note), 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= obj [[setObjectTextureGlobal]] [selection, texture]
Line 23: Line 22:
|p1= obj: [[Object]]
|p1= obj: [[Object]]


|p2= [selection,texture]: [[Array]]
|p2= selection: [[Number]] or{{GVI|arma3|2.10|size=0.75}} [[String]]


|p3= selection: [[Number]] or [[String]] (since {{GVI|arma3|2.10}})
|p3= texture: [[String]]
 
|p4= texture: [[String]]


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


|x1= <sqf>player setObjectTextureGlobal [0, "\MyAddon\blue.paa"];</sqf>
|x1= <sqf>player setObjectTextureGlobal [0, "\MyAddon\blue.paa"];</sqf>
|x2= <sqf>// Set up a persistent texture keeper
 
|x2= <sqf>
// Set up a persistent texture keeper
player addEventHandler ["Take", {
player addEventHandler ["Take", {
(getObjectTextures player + [uniformContainer player getVariable "texture"])
(getObjectTextures player + [uniformContainer player getVariable "texture"])
Line 46: Line 45:
private _texture = "#(rgb,8,8,3)color(0,0,1,1)"; // blue texture
private _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</sqf>
uniformContainer player setVariable ["texture", _texture, true]; // store it on uniform
</sqf>


|seealso= [[setObjectTexture]] [[getObjectTextures]] [[setObjectMaterial]] [[forceFlagTexture]]
|seealso= [[setObjectTexture]] [[getObjectTextures]] [[setObjectMaterial]] [[forceFlagTexture]]
}}
}}


<dl class="command_description">
{{Note
 
|user= Elch2070
<dt><dt>
|timestamp= 20151229181300
<dd class="notedate">Posted on December 29, 2015 - 18:13 (UTC)</dd>
|text= In some cases the ".paa" files  do not work. Instead you can try ".jpg" files.
<dt class="note">[[User:Elch2070|Elch2070]]</dt>
}}
<dd class="note">
In some cases the ".paa" files  do not work. Instead you can try ".jpg" files.
</dd>


<dt><dt>
{{Note
<dd class="notedate">Posted on October 24, 2016 - 12:13 (UTC)</dd>
|user= Killzone_Kid
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|timestamp= 20161024121300
<dd class="note">Sometimes it could be necessary to set default material on an object for the texture to take effect:
|text= Sometimes it could be necessary to set default material on an object for the texture to take effect:
<sqf>private _block = createVehicle ["Land_VR_Block_02_F", player getPos [20, getDir player], [], 0, "CAN_COLLIDE"];
<sqf>
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 setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];</sqf>
_block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];
</sqf>
Courtesy of '''[[User:Larrow|Larrow]]'''
Courtesy of '''[[User:Larrow|Larrow]]'''
</dd>
}}
 
</dl>

Revision as of 15:59, 15 August 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. See getObjectTextures for supported texture selections.
All textures must have a resolution of 2^x / 2^y (e.g. 16×16, 16×32, 64×256, 512×32, etc). The largest texture size supported by the RV engine is 4096×4096.
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:
obj setObjectTextureGlobal [selection, texture]
Parameters:
obj: Object
selection: Number orArma 3 logo black.png2.10 String
texture: String
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
Elch2070 - c
Posted on Dec 29, 2015 - 18:13 (UTC)
In some cases the ".paa" files do not work. Instead you can try ".jpg" files.
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