Jump to content
Sign in to follow this  
kibaBG

[SOLVED] Spawn vehicle with different skin

Recommended Posts

Hi, is there any code or other way to get textures path to a vehicle, so I can use setObjectTextureGlobal when I spawn it? I have found this on internet but even I can say its deeply wrong 
 

_vehicleType = typeOf cursorTarget; 
_textureSets = "true" configClasses (configFile >> "CfgVehicles" >> _vehicleType >> "TextureSources");
_availableTextures = []; 
_textureSets apply { 
_colorName = configName _x; 
_textures = [_x , "textures", []] call BIS_fnc_returnConfigEntry; 
_availableTextures pushBack [_colorName, _textures]; 

Gives me error "Missing }" when used in debug console. 

Share this post


Link to post
Share on other sites
14 minutes ago, kibaBG said:

even I can say its deeply wrong

 

How so? Works for me - return from an Offroad:

[
["Red",["\a3\Soft_F\Offroad_01\data\Offroad_01_ext_CO.paa","\a3\Soft_F\Offroad_01\data\Offroad_01_ext_CO.paa"]],
["Beige",["\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE01_CO.paa","\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE01_CO.paa"]],
["White",["\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE02_CO.paa","\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE02_CO.paa"]],
["Blue",["\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE03_CO.paa","\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE03_CO.paa"]],
["Darkred",["\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE04_CO.paa","\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE04_CO.paa"]],
["Bluecustom",["\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE05_CO.paa","\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE05_CO.paa"]],
["Guerilla_01",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_01_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_01_CO.paa"]],
["Guerilla_02",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_02_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_02_CO.paa"]],
["Guerilla_03",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_03_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_03_CO.paa"]],
["Guerilla_04",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_04_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_04_CO.paa"]],
["Guerilla_05",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_05_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_05_CO.paa"]],
["Guerilla_06",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_06_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_06_CO.paa"]],
["Guerilla_07",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_07_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_07_CO.paa"]],
["Guerilla_08",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_08_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_08_CO.paa"]],
["Guerilla_09",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_09_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_09_CO.paa"]],
["Guerilla_10",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_10_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_10_CO.paa"]],
["Guerilla_11",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_11_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_11_CO.paa"]],
["Guerilla_12",["\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_12_CO.paa","\A3\Soft_F_Bootcamp\Offroad_01\Data\offroad_01_ext_IG_12_CO.paa"]],
["Gendarmerie",["\A3\Soft_F_Exp\Offroad_01\Data\Offroad_01_ext_gen_CO.paa","\A3\Soft_F_Exp\Offroad_01\Data\Offroad_01_ext_gen_CO.paa"]],
["IDAP",["\A3\Soft_F_Orange\Offroad_01\Data\Offroad_01_ext_IDAP_CO.paa","\A3\Soft_F_Orange\Offroad_01\Data\Offroad_01_ext_IDAP_CO.paa"]],
["EAF",["\a3\Soft_F_Enoch\Offroad_01\Data\offroad_01_ext_EAF_CO.paa","\a3\Soft_F_Enoch\Offroad_01\Data\offroad_01_ext_EAF_CO.paa"]],
["Green",["\a3\Soft_F_Enoch\Offroad_01\Data\offroad_01_ext_grn_CO.paa","\a3\Soft_F_Enoch\Offroad_01\Data\offroad_01_ext_grn_CO.paa"]],
["ParkRanger",["\a3\Soft_F_Enoch\Offroad_01\Data\offroad_01_ext_Ranger_CO.paa","\a3\Soft_F_Enoch\Offroad_01\Data\offroad_01_ext_Ranger_CO.paa"]]
];

Spawn a blue Offroad 10m in front of player (from debug menu):

_dir = getDir player; 
_pos = player getPos [10,_dir]; 
_obj = createVehicle ["C_Offroad_01_F",[0,0,0],[],0,"CAN_COLLIDE"]; 
_obj setPosATL [_pos select 0, _pos select 1, 0]; 
_obj setDir _dir + 90; 
_obj setObjectTextureGlobal [0,"\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE03_CO.paa"];
_obj setObjectTextureGlobal [1,"\a3\Soft_F\Offroad_01\data\Offroad_01_ext_BASE03_CO.paa"];


 

  • Like 1

Share this post


Link to post
Share on other sites

Ok, I have found easier way. I just place the vehicle (a plane in this case)> right click > Edit Vehicle Appearance > choose the skin I want > ctrl+c 
 

_veh = createVehicle ["pook_SU30M_OPFOR",position player,[],0,"NONE"];
[
	_veh,
	["pook_SU27_TEX_GREY",1], 
	true
] call BIS_fnc_initVehicle;

I get all skins
 

["pook_flanker\mat\old\body1_co.paa","pook_flanker\mat\old\body2_co.paa","pook_flanker\mat\old\clear_empty.paa","pook_flanker\mat\old\clear_empty.paa","pook_flanker\mat\old\rus_num\number_b2_ca.paa","pook_flanker\mat\old\rus_num\number_b3_ca.paa","pook_flanker\mat\old\rus_num\number_b8_ca.paa"]

Then I use this to spawn a vehicle with the skin I want: 
 

veh1 setObjectTextureGlobal [0,"pook_flanker\mat\old\body1_co.paa"];
veh1 setObjectTextureGlobal [1,"pook_flanker\mat\old\body2_co.paa"];

Beware, some skins have two or more "parts" and you need to load them all. The "number" is the position of the skin in the array, the first one is 0, second 1, etc. I hope this helps somebody 🙂  
 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×