setObjectTextureGlobal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|= Comments" to "|Comments=")
(Fix description and clean comments)
Line 1: Line 1:
{{Command|Comments=
{{Command
____________________________________________________________________________________________


| arma3 |Game name=
|game1= arma3
|version1= 1.06


|1.06|Game version=
|arg= global
|eff= global


|arg= global |Multiplayer Arguments=


|eff= global |Multiplayer Effects=
|descr= Set the texture of the given selection on all computers in a network session.<br>
____________________________________________________________________________________________
Not all objects can be textured this way. See [[getObjectTextures]] for supported texture selections.


| Set the texture of the given selection on all computers in a network session. <br><br>'''NOTES''':
{{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.}}
* 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
{{Warning | If [[setObjectTextureGlobal]] is executed from <tt>init</tt> of a vehicle, it may be too soon and fail to broadcast to other vehicle instances on network and become JIP compatible. The workaround is to delay setting the texture until after the vehicle is fully initialised}} |DESCRIPTION=
____________________________________________________________________________________________


| obj '''setObjectTextureGlobal''' [selection, texture] |SYNTAX=
|mp= The effect is [[JIP]] compatible.
{{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.}}


|p1= obj: [[Object]] |PARAMETER1=
|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 [[JIP]] compatible.


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


|p3= selection: [[Number]] |PARAMETER3=
|s1= obj [[setObjectTextureGlobal]] [selection, texture]


|p4= texture: [[String]] |PARAMETER4=
|p1= obj: [[Object]]


| [[Nothing]] |RETURNVALUE=
|p2= [selection,texture]: [[Array]]


|p3= selection: [[Number]]


|x1= <code>[[player]] [[setObjectTextureGlobal]] [0, "\MyAddon\blue.paa"];</code>|EXAMPLE1=
|p4= texture: [[String]]
|x2= <code>//set up persistent texture keeper
 
|r1= [[Nothing]]
 
 
|x1= <code>[[player]] [[setObjectTextureGlobal]] [0, "\MyAddon\blue.paa"];</code>
|x2= <code>{{cc|Set up a persistent texture keeper}}
[[player]] [[addEventHandler]] ["Take", {
[[player]] [[addEventHandler]] ["Take", {
([[getObjectTextures]] [[player]] + <nowiki>[</nowiki>[[uniformContainer]] [[player]] [[getVariable]] "texture"])
([[getObjectTextures]] [[player]] + [<nowiki/>[[uniformContainer]] [[player]] [[getVariable]] "texture"])
[[params]] ["_texUniform", "_texInsignia", "_texCustom"];
[[params]] ["_texUniform", "_texInsignia", "_texCustom"];
[[if]] ([[isNil]] "_texCustom") [[exitWith]] {};
[[if]] ([[isNil]] "_texCustom") [[exitWith]] {};
Line 43: Line 44:




//Example: make current uniform persistently blue
{{cc|Example: make current uniform persistently blue}}


_texture = "#(rgb,8,8,3)color(0,0,1,1)"; //blue texture
[[private]] _texture = "#(rgb,8,8,3)color(0,0,1,1)"; {{cc|blue texture}}
[[player]] [[setObjectTextureGlobal]] [0, _texture]; //set it on player
[[player]] [[setObjectTextureGlobal]] [0, _texture]; {{cc|set it on player}}
[[uniformContainer]] [[player]] [[setVariable]] ["texture", _texture, [[true]]]; //store it on uniform</code>|EXAMPLE2=
[[uniformContainer]] [[player]] [[setVariable]] ["texture", _texture, [[true]]]; {{cc|store it on uniform}}</code>
____________________________________________________________________________________________


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


| |MPBEHAVIOUR=  
|seealso= [[setObjectTexture]], [[getObjectTextures]], [[setObjectMaterial]], [[forceFlagTexture]]
____________________________________________________________________________________________
}}
}}


Line 59: Line 57:
<dl class='command_description'>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on March 8, 2015 - 21:15 (UTC)</dd>
<dt class="note">[[User:Sxp2hiiigh|Sxp2hiiigh]]</dt>
<dd class="note">
The effect is persistent and will be synchronized for players who join in progress. (Tested with Arma 3 v1.40)
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on December 29, 2015 - 18:13 (UTC)</dd>
<dd class="notedate">Posted on December 29, 2015 - 18:13 (UTC)</dd>
<dt class="note">[[User:Elch2070|Elch2070]]</dt>
<dt class="note">[[User:Elch2070|Elch2070]]</dt>
Line 84: Line 63:
In some cases the ".paa" files  do not work. Instead you can try ".jpg" files.
In some cases the ".paa" files  do not work. Instead you can try ".jpg" files.
</dd>
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on October 24, 2016 - 12:13 (UTC)</dd>
<dd class="notedate">Posted on October 24, 2016 - 12:13 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">Sometimes it could be necessary to set default material on an object for the texture to take effect:
<dd class="note">Sometimes it could be necessary to set default material on an object for the texture to take effect:
<code>_block = [[createVehicle]] ["Land_VR_Block_02_F", [[player]] [[getPos]] [20, [[getDir]] [[player]]], [], 0, "CAN_COLLIDE"];
<code>[[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)"];</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>
</dd>
<!-- Note Section END -->
</dl>
</dl>
<!-- DISCONTINUE Notes -->
 
<h3 style='display:none'>Bottom Section</h3>

Revision as of 23:26, 15 January 2020

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. 16x16, 16x32, 64x256, 512x32, etc). The largest texture size supported by the RV engine is 4096x4096.
Multiplayer:
The effect is JIP compatible.
Do not put global commands in an object's init field : see Multiplayer Scripting - Join In Progress note for the explanation.
Problems:
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 JIP compatible.
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 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:
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

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: 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

Bottom Section