setObjectTextureGlobal: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "|= Comments" to "|Comments=") |
Lou Montana (talk | contribs) (Fix description and clean comments) |
||
Line 1: | Line 1: | ||
{{Command | {{Command | ||
| arma3 | | |game1= arma3 | ||
|version1= 1.06 | |||
| | |arg= global | ||
|eff= global | |||
| | |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. | |||
| | {{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.}} | ||
| | |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.}} | |||
| | |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. | ||
| | |s1= obj [[setObjectTextureGlobal]] [selection, texture] | ||
| | |p1= obj: [[Object]] | ||
| [[ | |p2= [selection,texture]: [[Array]] | ||
|p3= selection: [[Number]] | |||
|x1= <code>[[player]] [[setObjectTextureGlobal]] [0, "\MyAddon\blue.paa"];</code> | |p4= texture: [[String]] | ||
|x2= <code> | |||
|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 | ([[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: | ||
{{cc|Example: make current uniform persistently blue}} | |||
_texture = | [[private]] _texture = "#(rgb,8,8,3)color(0,0,1,1)"; {{cc|blue texture}} | ||
[[player]] [[setObjectTextureGlobal]] [0, _texture]; | [[player]] [[setObjectTextureGlobal]] [0, _texture]; {{cc|set it on player}} | ||
[[uniformContainer]] [[player]] [[setVariable]] ["texture", _texture, [[true]]]; | [[uniformContainer]] [[player]] [[setVariable]] ["texture", _texture, [[true]]]; {{cc|store it on uniform}}</code> | ||
| | |seealso= [[setObjectTexture]], [[getObjectTextures]], [[setObjectMaterial]], [[forceFlagTexture]] | ||
}} | }} | ||
Line 59: | Line 57: | ||
<dl class='command_description'> | <dl class='command_description'> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<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> | ||
<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> | ||
< | |||
<h3 style='display:none'>Bottom Section</h3> |
Revision as of 22:26, 15 January 2020
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. - Multiplayer:
- The effect is JIP compatible.
- 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
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