{"name":"setObjectTexture","operator":null,"title":"setObjectTexture","type":"command","url":"https://community.bistudio.com/wiki/setObjectTexture","revid":370028,"updated":"2024-10-27T23:20:14Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.75"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.75"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":"local","server_exec":false},"exec":null,"description":"Applies given texture to object's selection. See also Procedural Textures and Retexturing with setObjectTexture.\n\n> [!NOTE]\n> - Not all objects can be textured this way. To find out, run getObjectTextures command on an object. Empty array `[]` usually indicates it cannot be textured.\n> - All textures must have a resolution of 2a × 2b (e.g. 16×16, 16×32, 64×256, 512×512, ...). The largest texture size supported by the RV engine is 4096×4096.\n> - Supported formats: .pac, .paa, .jpg, .jpeg, .ogg, .ogv","syntaxes":[{"syntax":"object setObjectTexture [selection, texture]","since":null,"effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"object: Object"},{"name":"selection","type":"Number or Arma 3 v2.10 String","optional":false,"default":null,"description":"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.","types":["Number","String"],"since":null,"text":"selection: Number or Arma 3 v2.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."},{"name":"texture","type":"String","optional":false,"default":null,"description":"path to texture. Since Arma 3 v2.20 using **\"#reset\"** would reset to default texture.","types":["String"],"since":null,"text":"texture: String - path to texture. Since Arma 3 v2.20 using **\"#reset\"** would reset to default texture."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"object","types":["Object"]},"right":{"text":"[selection, texture]","types":["Array"]}}],"examples":[{"text":"```sqf\n_objectname setObjectTexture [0, \"\\pboname\\texture.paa\"];\n_objectname setObjectTexture [1, \"\\pboname\\texture2.paa\"];\n```","code":["_objectname setObjectTexture [0, \"\\pboname\\texture.paa\"];\n_objectname setObjectTexture [1, \"\\pboname\\texture2.paa\"];"]},{"text":"```sqf\n_obj setObjectTexture [0, \"#(rgb,8,8,3)color(1,0,0,1)\"];\n```","code":["_obj setObjectTexture [0, \"#(rgb,8,8,3)color(1,0,0,1)\"];"]},{"text":"```sqf\n_obj setObjectTexture [0, \"#(argb,512,512,1)r2t(rendersurface,1.333)\"];\n```","code":["_obj setObjectTexture [0, \"#(argb,512,512,1)r2t(rendersurface,1.333)\"];"]},{"text":"Disable randomization before applying a texture to a vehicle in the Editor (if it is a vehicle that supports randomization):\n\n```sqf\nthis setVariable [\"BIS_enableRandomization\", false];\nthis setObjectTexture [0,\"#(rgb,8,8,3)color(1,0,0,1)\"];\n```","code":["this setVariable [\"BIS_enableRandomization\", false];\nthis setObjectTexture [0,\"#(rgb,8,8,3)color(1,0,0,1)\"];"]},{"text":"The `\"clan\"` selection can be used to apply a texture to the areas that usually display the squad.xml logo:\n\n```sqf\nMyVehicle setObjectTexture [\"clan\", \"\\a3\\missions_f_epa\\data\\img\\orbat\\b_111_texture_ca.paa\"];\n```","code":["MyVehicle setObjectTexture [\"clan\", \"\\a3\\missions_f_epa\\data\\img\\orbat\\b_111_texture_ca.paa\"];"]}],"multiplayer":"See setObjectTextureGlobal.","problems":null,"aliases":[],"see_also":["getObjectTextures","setObjectTextureGlobal","setObjectMaterial","getObjectMaterials","setObjectMaterialGlobal","forceFlagTexture"],"notes":[{"user":"Benargee","date":"2014-08-25T22:27:00Z","text":"Also works with absolute path and .jpg files.\n\n```sqf\n_obj setObjectTexture [0, \"C:\\Folder\\Folder\\Texture.paa\"];\n_obj setObjectTexture [0, \"C:\\Folder\\Folder\\Texture.jpg\"];\n```\n\nTexture can also be blank:\n\n```sqf\n_obj setObjectTexture [2,\"\"];\n```\n\nThis will make the texture selection invisible on certain units without an error message. In some cases this is a desirable effect"},{"user":"Longbow","date":"2015-03-18T03:09:00Z","text":"It is also possible to apply texture to unit's backpack, as it also has hidden selection (unfortunately does not work for vests)\n\n```sqf\nbackpackContainer player setObjectTexture [0,\"#(argb,8,8,3)color(0,0,0,1)\"]\n```\n\nAlso keep in mind that player's custom texture is being reset when you open BIS Arsenal (even without changing any gear)"},{"user":"Moerderhoschi","date":"2015-05-13T14:37:00Z","text":"You can also use the game's internal skins: [List of MH9 Skins](http://forums.bistudio.com/showthread.php?169734-paint-MH-9-different-colour)\n\n```sqf\n_obj setObjectTexture [0, \"\\a3\\air_f\\heli_light_01\\data\\skins\\heli_light_01_ext_digital_co.paa\"];\n```"},{"user":"Killzone_Kid","date":"2016-10-24T12:09:00Z","text":"Sometimes it could be necessary to set default material on an object for the texture to take effect:\n\n```sqf\n_block = createVehicle [\"Land_VR_Block_02_F\", player getPos [20, getDir player], [], 0, \"CAN_COLLIDE\"];\n_block setObjectMaterial [0, \"\\a3\\data_f\\default.rvmat\"];\n_block setObjectTexture [0, \"#(rgb,8,8,3)color(1,0,0,1)\"];\n```\n\nCourtesy of **Larrow**"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Operation Flashpoint version 1.75","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Scripting Commands: Local Effect","Take On Helicopters: Scripting Commands"]}