Jump to content

[Release] Paint Vehicles


0verHeaT

Recommended Posts

Description

 

This script is a public version of the notorious Vehicle Paint script which idea and code are originally 'invented' by maca134.

 

This mod allows you to retexture any vehicle on your server with any colour you choose.

 

 

Features

 

   -   Vehicles can be painted in two different colours

   -   Only vehicles with a CharacterID can be painted (Vehicles with key)

   -   Colours will be bound to to the Object(Vehicle) and will be persistent

   -   Colours codes are saved in the Worldspace field in the database

   -   Vehicles can be manually added or removed from an Array in your variables.sqf

 

 

Screenshots

 

f-paint154231d760017a671.jpg

 

f-paint254231daf0017a672.jpg

 

FAQ

 

  Q: Will this script be compatible with Plot4Life because it uses the same gap in the database ?

  A: Yes. The colour will only be safed in this gap if the object is a vehicle.

 

  Q: I am not using Zupa's Singley Curreny System. Am I able to use this script as well ?

  A: Yes. The download includes files which are usable with the traditional curreny system.

 

 

USEFUL:  by raymix

 

 

Installation

 

 

Download the required files here

 

 
1. Server Files:

1.1 In your server_function.sqf search for:
 
server_updateNearbyObjects = {

above add

"PVDZE_veh_Colour" addPublicVariableEventHandler {
	private["_position","_worldspace","_fuel","_key","_colour","_colour2","_object","_objectID","_PUID","_clrinit","_clrinit2","_pname","_name"];
		_object = ((_this select 1) select 0);
		_colour = ((_this select 1) select 1);
		_colour2 = ((_this select 1) select 2);
		
		_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
		_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
		_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
		_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
		
                processInitCommands;

		_object setVariable["Colour",_colour,true];
		_object setVariable["Colour2",_colour2,true];
		
		_name = getText(configFile >> "cfgVehicles" >> (typeOf _object) >> "displayName");
		_PUID = ((_this select 1) select 3);
		_pname = ((_this select 1) select 4);
		
		diag_log format ["VEHICLE PAINT: Player %1 (%2) has painted a %3!",_pname,_PUID,_name];
		
		_position = getPosATL _object;
		
		_worldspace = [
			round(direction _object),
			_position,
			_colour,
			_colour2
		];
		
		_fuel = 0;
		_fuel = fuel _object;
		
		_objectID =	_object getVariable ["ObjectID","0"];
		
		_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
		_key call server_hiveWrite;
	};

1.2 In 'compile/server_updateObject.sqf' change the following

_object_position = {
	private["_position","_worldspace","_fuel","_key"];
		_position = getPosATL _object;
		_worldspace = [
			round(direction _object),
			_position
		];
		_fuel = 0;
		if (_object isKindOf "AllVehicles") then {
			_fuel = fuel _object;
		};
		_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
		//diag_log ("HIVE: WRITE: "+ str(_key));
		_key call server_hiveWrite;
	};

to

_object_position = {
	private["_position","_worldspace","_fuel","_key","_colour","_colour2"];
		_position = getPosATL _object;
		if (_object isKindOf "AllVehicles") then {
			_colour = _object getVariable ["Colour","0"];
			_colour2 = _object getVariable ["Colour2","0"];
			_worldspace = [
				round(direction _object),
				_position,
				_colour,
				_colour2
			];
			_fuel = fuel _object;
		} else {
			_worldspace = [
				round(direction _object),
				_position
			];
			_fuel = 0;
		};
		_key = format["CHILD:305:%1:%2:%3:",_objectID,_worldspace,_fuel];
		//diag_log ("HIVE: WRITE: "+ str(_key));
		_key call server_hiveWrite;
	};

1.3 In your server_monitor.sqf search for:

if (_object isKindOf "AllVehicles") then {

below paste

private ["_colour","_colour2","_clrinit","_clrinit2"];

again in your server_monitor.sqf look for

} forEach _hitpoints;

(if you can't find this look for)

} count _hitpoints;

below add

if(count _worldspace >= 4) then{	
        if (((typeName(_worldspace select 2)) == "STRING") and ((typeName(_worldspace select 3)) == "STRING")) then {
		_colour = _worldspace select 2;
		_colour2 = _worldspace select 3;
					
		if (_colour != "0") then {
			_object setVariable ["Colour",_colour,true];
			_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
			_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
		};
		if (_colour2 != "0") then {			
			_object setVariable ["Colour2",_colour2,true];
			_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
			_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
		};
	};
};

Done.

 

 

2. Mission Files

2.1 Paste the folder 'Paint' which you have downloaded in your mission.pbo.
 
2.2 Go to your custom compile.sqf. After
 
if (!isDedicated) then {

add

VehicleColourPaint =			compile preprocessFileLineNumbers "Paint\vehicleColourPaint.sqf";
VehicleColourUpdate =			compile preprocessFileLineNumbers "Paint\VehicleColourUpdate.sqf";
VehicleColourUpdate2 =			compile preprocessFileLineNumbers "Paint\VehicleColourUpdate2.sqf";
player_paint =				compile preprocessFileLineNumbers "Paint\player_paint.sqf";

2.3 In your fn_selfActions.sqf find

s_player_lockunlock set [count s_player_lockunlock,_lock];

below add

if (_typeOfCursorTarget in ColourVehicles) then {
		private ["_paint"];
		_paint = player addAction ["Paint", "Paint\player_paint_init.sqf",_cursorTarget, 2, true, true, "", ""];
		s_player_lockunlock set [count s_player_lockunlock,_paint];
	};

2.4 Go to your variables.sqf and at the very bottom add

ColourVehicles = [
	"ATV_CZ_EP1",
	"ATV_US_EP1",
	"SUV_TK_CIV_EP1",
	"Mi17_Civilian_DZ",
	"UH60M_EP1_DZE",
	"Ka52",
	"Ka52Black",
	"UH1H_TK_EP1",
	"UH60M_MEV_EP1",
	"HMMWV_M998A2_SOV_DES_EP1_DZE",
	"HMMWV_M1151_M2_CZ_DES_EP1_DZE",
	"UAZ_MG_TK_EP1_DZE",
	"Ural_CDF",
	"Ural_TK_CIV_EP1",
	"Ural_UN_EP1",
	"V3S_Open_TK_CIV_EP1",
	"Kamaz",
	"MTVR_DES_EP1", 
	"MH6J_DZ",
	"AH6X_DZ",
	"HMMWV_M1035_DES_EP1",
	"HMMWV_Ambulance",
	"HMMWV_Ambulance_CZ_DES_EP1",
	"HMMWV_DES_EP1",
	"HMMWV_DZ",
	"hilux1_civil_3_open_EP1",
	"hilux1_civil_1_open",
	"datsun1_civil_1_open",
	"Pickup_PK_GUE_DZE",
	"Pickup_PK_INS_DZE",
	"Pickup_PK_TK_GUE_EP1_DZE",
	"Offroad_DSHKM_Gue_DZE",
	"LAV25_HQ",
	"BTR90_HQ_DZE",
	"M1133_MEV_EP1",
	"pook_H13_amphib",
	"pook_H13_civ",
	"pook_H13_medevac_CIV",
	"pook_H13_transport",
	"pook_H13_gunship_PMC",
	"pook_H13_transport_INS",
	"VWGolf"
	];
Here you can add any vehicle you want to paint.
NOTE: Some vehicles can not be painted.
 
2.5 In your description.ext add the following at the bottom:
 
	#include "Paint\defines.hpp"
	#include "Paint\vehiclecolour.hpp"

Done.

 

3. Infistar

Add the number to allowed dialogs

571113

4. Battleye

Put this in your publicvariable.txt

!="PVDZE_veh_Colour"

Credits

  • Maca134: Made the orginal colour vehicle script. Without his idea of painting vehicles in any colour as well as the style of his dialogs this script would not exist.
  • Zupa: The idea of painting vehicles in two different colours. 
Link to comment
Share on other sites

 0:13:17 Error in expression <== "STRING") and ((typeName(_worldspace select 3)) == "STRING")) then {
_colour >
 0:13:17   Error position: <select 3)) == "STRING")) then {
_colour >
 0:13:17   Error Zero divisor
 0:13:17 File z\addons\dayz_server\system\server_monitor.sqf, line 318

its spamming this in the log

Link to comment
Share on other sites

Hey 0verHeaT,

 

You need to do a little fix.

 

Change this

	if (((typeName(_worldspace select 2)) == "STRING") and ((typeName(_worldspace select 3)) == "STRING")) then {
		_colour = _worldspace select 2;
		_colour2 = _worldspace select 3;
					
		if (_colour != "0") then {
			_object setVariable ["Colour",_colour,true];
			_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
			_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
		};
		if (_colour2 != "0") then {			
			_object setVariable ["Colour2",_colour2,true];
			_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
			_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
		};
	};

To

if(count _worldspace >= 4) then{	
        if (((typeName(_worldspace select 2)) == "STRING") and ((typeName(_worldspace select 3)) == "STRING")) then {
		_colour = _worldspace select 2;
		_colour2 = _worldspace select 3;
					
		if (_colour != "0") then {
			_object setVariable ["Colour",_colour,true];
			_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
			_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
		};
		if (_colour2 != "0") then {			
			_object setVariable ["Colour2",_colour2,true];
			_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
			_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
		};
	};
};

This prevents the Error Zero divisor from being spammed into the RPT. The worldspace array is a default two elements. Without this check, you are checking out of bounds of the array causing the error.

 

Anyway, LOVE THE SCRIPT  :)

 

striker

 

 

P.S. If you add a third color, change >= 4 to >= 5

Link to comment
Share on other sites

Could someone explain why this dosemt texture most vehicles ? Not saying the scipt is wrong just is it scirt related or arma related ?

 

Not all vehicles support retexturing vehicles. But u will notice, 80% of default epoch vehicles DayZ

 

Vehicles i'm sure not allowing it are these :

CH_47F_EP1_DZE
UH1Y_DZE
UH1H_DZE
MH60S_DZE
ARMOREDSUV_PMC_DZE
HMMVV_M1151_M2_CZ
LandRover_Special_CZ_EP1_DZE
LandRover_MG_TK_EP1_DZE

And the VODNIK is pretty bugged sometimes ^^

 

I also believe some vehicles can be painted to 3 colors. But that would just make it too much.

 

My players had the fun with this script, but they soon never used it after couple of weeks.

 

It's a nice feature and all but ya, short term usages ( of players)

Link to comment
Share on other sites

Hey 0verHeaT,

 

You need to do a little fix.

 

Change this

	if (((typeName(_worldspace select 2)) == "STRING") and ((typeName(_worldspace select 3)) == "STRING")) then {
		_colour = _worldspace select 2;
		_colour2 = _worldspace select 3;
					
		if (_colour != "0") then {
			_object setVariable ["Colour",_colour,true];
			_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
			_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
		};
		if (_colour2 != "0") then {			
			_object setVariable ["Colour2",_colour2,true];
			_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
			_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
		};
	};

To

if(count _worldspace >= 4) then{	
        if (((typeName(_worldspace select 2)) == "STRING") and ((typeName(_worldspace select 3)) == "STRING")) then {
		_colour = _worldspace select 2;
		_colour2 = _worldspace select 3;
					
		if (_colour != "0") then {
			_object setVariable ["Colour",_colour,true];
			_clrinit = format ["#(argb,8,8,3)color(%1)",_colour];
			_object setVehicleInit "this setObjectTexture [0,"+str _clrinit+"];";
		};
		if (_colour2 != "0") then {			
			_object setVariable ["Colour2",_colour2,true];
			_clrinit2 = format ["#(argb,8,8,3)color(%1)",_colour2];
			_object setVehicleInit "this setObjectTexture [1,"+str _clrinit2+"];";
		};
	};
};

This prevents the Error Zero divisor from being spammed into the RPT. The worldspace array is a default two elements. Without this check, you are checking out of bounds of the array causing the error.

 

Anyway, LOVE THE SCRIPT  :)

 

striker

 

 

P.S. If you add a third color, change >= 4 to >= 5

 

Yes you're right. Forgot to add this to prevent the zero divisor error.

Anyway, thanks for the hint striker  :)

 

Install instruction has been updated.

Link to comment
Share on other sites

Just something you might consider.

 

In my version of the paint script. I bind the colloring to an item "IRStrobe", you can buy this items at the traders.

 

Now if you are in a vehicle and right click this items u can choose paint.

 

Otherwise it's too easy imo to just paint ? ^^

Link to comment
Share on other sites

Just something you might consider.

 

In my version of the paint script. I bind the colloring to an item "IRStrobe", you can buy this items at the traders.

 

Now if you are in a vehicle and right click this items u can choose paint.

 

Otherwise it's too easy imo to just paint ? ^^

 

Hey Zupa,

 

Would you be kind enough to show us how this would be done?

 

Thanks

Link to comment
Share on other sites

Can someone help me make it work?

 

ive noticed you need the key to your vehicle in your toolbelt to bring up the menu, Maybe this is your problem?

 

 

Loving the script Nice job OverHeaT, but still buggy for most of the vehicles. how wouldd i go about fixing these vehicles to retexture? i see some of the colouring when you are so far from the vehicle but part painted as you get closer the original skin pops back. coulkd this be to the vehicle being skinned in parts and will not show untill fully complete

 

Instead of irstrobe, increase the coin price? you will only end up buying it from trader anyways

 

Many Thanks

Link to comment
Share on other sites

have this up and running on an epoch panthera server very cool script thanks for the work!!

below is a lost of vehicle class names my wife and i are putting together, you can copy and paste the whole thing or just pick what you want to use. it is by no means complete nor has it been checked to see if all vehicles work properly with the paint script, I am working on that and will update the list when i get a chance.

 

"CSJ_GyroP",


"CSJ_GyroCover",
"CSJ_GyroC",
"Mi17_Ins",
"Mi17_CDF",
"Mi17_Civilian",
"CYBP_Camel_us",
"CYBP_Camel_rus",
"CYBP_Camel_civ",
"F35B",
"Mi17_DZ",
"UH1H_DZ",
"AH6X_DZ",
"MH6J_DZ",
"UH1Y",
"UH1Y_DZ",
"UH60M_EP1",
"UH60M_DZ",
"UH1H_TK_GUE_EP1",
"UH1H_TK_GUE_DZ",
"MV22",
"MV22_DZ",
"CH_47F_BAF",
"CH_47F_DZ",
"BAF_Merlin_HC3_D",
"BAF_Merlin_DZ",
"GyroC_DZ",
"AN2_DZ",
"Camel_DZ",
"MH6J_EP1",
"An2_1_TK_CIV_EP1",
"An2_2_TK_CIV_EP1",
"An2_TK_EP1",
"CH_47F_EP1",
"UH1H_TK_EP1",
"VWGolf",
"CVPI_Patrol",
"CVPI_Trooper_Patrol",
"CVPI_TrooperSL_Patrol",
"CVPI_NYPD_Patrol",
"CVPI_HighwaySL_Patrol",
"CVPI_UnmarkedB_Patrol",
"CVPI_UnmarkedG_Patrol",
"CVPI_LAPD_Patrol",
"CVPI_UnmarkedW_Patrol",
"CVPI_LAPDSL_Patrol",
"CVPI_NYPDSL_Patrol",
"Tractor",
"car_sedan",
"policecar",
"Civcar",
"Civcarbu",
"civcarbl",
"Civcarre",
"Civcarge",
"Civcarwh",
"Civcarsl",
"Copcar",
"Copcarhw",
"Copcarswat",
"350z",
"350z_red",
"350z_kiwi",
"350z_black",
"350z_silver",
"350z_green",
"350z_blue",
"350z_gold",
"350z_white",
"350z_pink",
"350z_mod",
"350z_ruben",
"350z_v",
"350z_city",
"350z_yellow",
"HMMWV_M2",
"HMMWV_M2_USArmy",
"HMMWV_Mk19",
"HMMWV_Mk19_USArmy",
"Offroad_DSHKM_Gue",
"Offroad_DSHKM_TERROR",
"Pickup_PK_GUE",
"Pickup_PK_TERROR",
"EOffroad_DSHKM_TERROR",
"EPickup_PK_TERROR",
"HMMWV",
"UAZ_MG_CDF",
"UAZ_CDF",
"Ural_CDF",
"UralOpen_CDF",
"UralRefuel_CDF",
"UAZ_RU",
"UAZ_MG_INS",
"UAZ_INS",
"Ural_INS",
"UralOpen_INS",
"UralRefuel_INS",
"UralCivil",
"UralCivil2",
"Skoda",
"SkodaBlue",
"SkodaRed",
"SkodaGreen",
"datsun1_civil_1_open",
"datsun1_civil_2_covered",
"datsun1_civil_3_open",
"tractorOld",
"car_hatchback",
"hilux1_civil_1_open",
"hilux1_civil_2_covered",
"hilux1_civil_3_open",
"Pickup_PK_INS",
"Offroad_DSHKM_INS",
"HMMWV_Armored",
"Ikarus",
"Kamaz",
"KamazOpen",
"KamazRefuel",
"Lada1",
"Lada2",
"LadaLM",
"MTVR",
"MtvrRefuel",
"V3S_Civ",
"M1030",
"TT650_Civ",
"TT650_Ins",
"TT650_Gue",
"UAZ_MG_TK_EP1",
"UAZ_Unarmed_TK_EP1",
"UAZ_Unarmed_UN_EP1",
"UAZ_Unarmed_TK_CIV_EP1",
"Ural_UN_EP1",
"Ural_TK_CIV_EP1",
"UralRefuel_TK_EP1",
"Pickup_PK_TK_GUE_EP1",
"Offroad_DSHKM_TK_GUE_EP1",
"HMMWV_DES_EP1",
"HMMWV_MK19_DES_EP1",
"TT650_TK_CIV_EP1",
"TT650_TK_EP1",
"M1030_US_DES_EP1",
"MTVR_DES_EP1",
"MtvrRefuel_DES_EP1",
"Lada1_TK_CIV_EP1",
"Lada2_TK_CIV_EP1",
"Ikarus_TK_CIV_EP1",
"hilux1_civil_3_open_EP1",
"ATV_US_EP1",
"ATV_CZ_EP1",
"BTR40_MG_TK_GUE_EP1",
"BTR40_TK_GUE_EP1",
"BTR40_MG_TK_INS_EP1",
"BTR40_TK_INS_EP1",
"HMMWV_M1151_M2_CZ_DES_EP1",
"HMMWV_M1151_M2_DES_EP1",
"LandRover_CZ_EP1",
"LandRover_TK_CIV_EP1",
"LandRover_MG_TK_INS_EP1",
"LandRover_MG_TK_EP1",
"Old_bike_TK_CIV_EP1",
"Old_bike_TK_INS_EP1",
"Old_moto_TK_Civ_EP1",
"S1203_TK_CIV_EP1",
"SUV_TK_CIV_EP1",
"SUV_TK_EP1",
"SUV_UN_EP1",
"Volha_1_TK_CIV_EP1",
"Volha_2_TK_CIV_EP1",
"VolhaLimo_TK_CIV_EP1",
"SUV_PMC",
"ArmoredSUV_PMC",
"HMMWV_DZ",
"SUV_DZ",
"SUV_Armored_DZ",
"350z_black_DZ",
"350z_blue_DZ",
"350z_green_DZ",
"350z_kiwi_DZ",
"350z_pink_DZ",
"350z_white_DZ",
"350z_yellow_DZ",
"350z_cream_DZ",
"Civcar_DZ",
"civcarbl_DZ",
"Civcarbu_DZ",
"Civcarge_DZ",
"Civcarre_DZ",
"Civcarsl_DZ",
"Civcarwh_DZ",
"CPD_DZ",
"CPD_U_DZ",
"HMMWV_Armored_DZ",
"HMMWV_M2_DZ",
"MTVR_DZ",
"Ural_CDF_DZ",
"V3S_TK_EP1",
"V3S_Open_TK_EP1",
"V3S_Open_TK_CIV_EP1",
"V3S_TK_GUE_EP1",
"V3S_Refuel_TK_GUE_EP1",
"SUV_PMC_BAF",
"BAF_Offroad_D",
"BAF_Offroad_W",
"Zodiac",
"PBX",
"JetSkiYanahui",
"JetSkiYanahui_Case_Green",
"JetSkiYanahui_Case_Green2",
"JetSkiYanahui_White",
"JetSkiYanahui_Red",
"Fishing_Boat",
"Smallboat_1",
"smallboat_2",
"JetSkiYanahui_Green_DZ",
"JetSkiYanahui_Red_DZ"

Link to comment
Share on other sites

ive noticed you need the key to your vehicle in your toolbelt to bring up the menu, Maybe this is your problem?

 

 

Loving the script Nice job OverHeaT, but still buggy for most of the vehicles. how wouldd i go about fixing these vehicles to retexture? i see some of the colouring when you are so far from the vehicle but part painted as you get closer the original skin pops back. coulkd this be to the vehicle being skinned in parts and will not show untill fully complete

 

Instead of irstrobe, increase the coin price? you will only end up buying it from trader anyways

 

Many Thanks

I have the key to the belt, and the vehicle is unlock.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...