setObjectTextureGlobal: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "|= Game name" to "|Game name=") |
Killzone Kid (talk | contribs) No edit summary |
||
(69 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| arma3 | | |game1= arma3 | ||
|version1= 1.06 | |||
| | |arg= global | ||
|eff= global | |||
| | |gr1= Object Manipulation | ||
| | |descr= Set the texture of the given selection on all computers in a network session. | ||
{{Feature|informative| | |||
* Not all objects can be textured this way. To find out, run [[getObjectTextures]] command on an object. Empty array <sqf inline>[]</sqf> usually indicates it cannot be textured. | |||
* All textures must have a resolution of 2<sup>a</sup> × 2<sup>b</sup> (e.g. 16×16, 16×32, 64×256, 512×512, ...). The largest texture size supported by the RV engine is 4096×4096. | |||
* Supported formats: .pac, .paa, .jpg, .jpeg, .ogg, .ogv | |||
}} | |||
| | |mp= The effect is [[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= object [[setObjectTextureGlobal]] [selection, texture] | ||
| | |p1= object: [[Object]] | ||
| | |p2= selection: [[Number]] or {{GVI|arma3|2.10|size= 0.75}} [[String]] - index of the selection. It is defined in the [[CfgVehicles Config Reference#hiddenSelections|hiddenSelections]] array in the vehicle's config (starting with 0). If a string is given, it referes to a hiddenSelection name or clan selection instead of an index. | ||
| | |p3= texture: [[String]] - path to texture. Since {{GVI|arma3|2.20}} using '''"#reset"''' would reset to default texture. | ||
|r1= [[Nothing]] | |||
| [ | |x1= <sqf>player setObjectTextureGlobal [0, "\MyAddon\blue.paa"];</sqf> | ||
|x2= <sqf> | |||
| | // 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 | |||
</sqf> | |||
|seealso= [[setObjectTexture]] [[getObjectTextures]] [[setObjectMaterial]] [[forceFlagTexture]] | |||
[[ | }} | ||
[ | |||
| [[ | {{Note | ||
|user= Killzone_Kid | |||
|timestamp= 20161024121300 | |||
|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"]; | |||
_block setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"]; | |||
_block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"]; | |||
</sqf> | |||
Courtesy of '''[[User:Larrow|Larrow]]''' | |||
}} | }} | ||
{{Note | |||
|user= whiztler | |||
|timestamp= 20220913210401 | |||
|text= Following Killzone_Kid's note, a [[sleep]] after the [[setObjectMaterialGlobal]] and before the setObjectTextureGlobal command is sometimes needed to ensure the texture effect is carried out correctly. | |||
<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"]; | |||
sleep 0.01; | |||
_block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"]; | |||
</sqf> | |||
Note that you need to run above code in a [[Scheduler|scheduled environment]].}} | |||
< | |||
_block | |||
_block | |||
Latest revision as of 00:21, 28 October 2024
Description
- Description:
- Set the texture of the given selection on all computers in a network session.
- 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:
- object setObjectTextureGlobal [selection, texture]
- Parameters:
- object: Object
- selection: Number or 2.10 String - index of the selection. It is defined in the hiddenSelections array in the vehicle's config (starting with 0). If a string is given, it referes to a hiddenSelection name or clan selection instead of an index.
- texture: String - path to texture. Since 2.20 using "#reset" would reset to default texture.
- Return Value:
- Nothing
Examples
- Example 1:
- 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
- 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:
Courtesy of Larrowprivate _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)"];
- Posted on Sep 13, 2022 - 21:04 (UTC)
-
Following Killzone_Kid's note, a sleep after the setObjectMaterialGlobal and before the setObjectTextureGlobal command is sometimes needed to ensure the texture effect is carried out correctly.
Note that you need to run above code in a scheduled environment.private _block = createVehicle ["Land_VR_Block_02_F", player getPos [20, getDir player], [], 0, "CAN_COLLIDE"]; _block setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"]; sleep 0.01; _block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];