setObjectTextureGlobal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(moving note to talk)
Line 92: Line 92:
_block [[setObjectTextureGlobal]] [0, "#(rgb,8,8,3)color(1,0,0,1)"];</code>
_block [[setObjectTextureGlobal]] [0, "#(rgb,8,8,3)color(1,0,0,1)"];</code>
Courtesy of '''[[User:Larrow|Larrow]]'''
Courtesy of '''[[User:Larrow|Larrow]]'''
</dd>
</dl>
<!-- DISCONTINUE Notes -->
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on November 27, 2016 - 21:12 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">This command is not really JIP compatible. On Hosted server:
<code>this setObjectTextureGlobal [0,"mypaafile.paa"]; // fails. The texture disappears and a warning message:
//Cannot load texture mpmissions\__cur_mp.yourWorld\mypaafile.paa.is displayed.
if (isServer) then {this setObjectTextureGlobal [0,"mypaafile.paa"]}; // only works on (hosted) server
</code>
At this time (Arma III v 1.64), it's preferable to remote the local command in the init field of the object:
<code>if (isServer) then {[this,[0,"mypaafile.paa"]] remoteExec ["setObjectTexture,0,true]};
// works for hosted server and JIP clients</code>
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->

Revision as of 00:52, 28 November 2016

Hover & click on the images for description

Description

Description:
Set the texture of the given selection on all computers in a network session.
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:
setObjectTexturegetObjectTexturessetObjectMaterial

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