# Apply Texture to Vehicle

This script applies the specified texture and components to the designated vehicle when it spawns during the mission.

{% stepper %}
{% step %}

### Choosing vehicle

Begin by opening the **Eden Editor** and placing the vehicle you want to customize. Right-click on the vehicle, select ***Vehicle Appearance***, and adjust its settings to your preference. Once you're satisfied with the edits, click ***Export***. A message will confirm that the settings have been copied to your clipboard.
{% endstep %}

{% step %}

### Creating the script

Next, navigate to the mission folder and create a file named ***ApplyTextureToVehicle.sqf***. Then, copy and paste the following code into the file:

```sqf
[ "Land", "InitPost", {
	params ["_veh"];
	if (typeOf _veh == "CLASSNAME") then {
		// PUT EXPORTED CODE HERE
	};
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
```

Paste the exported code where it says `"// PUT EXPORTED CODE HERE."`. Now change the classname of the vehicle to `_veh` It should look something like this, but with your customizations:

{% code overflow="wrap" %}

```sqf
[_veh, ["Urban", 1], ["hide_rack", 0, "hide_rack_antenna", 0, "hide_frame", 0, "hide_frame_full", 0, "hide_frame_full_panel", 0, "hide_box", 1, "hide_box_door", 0, "hide_trunk_door", 0, "trunk_door_open", 0, "box_door_open", 0, "hide_Services", 1, "BeaconsServicesStart", 0, "hide_bullbar", 0, "hide_snorkel", 0, "hide_antenna", 1, "hide_armor_window_armor_top", 0, "window_armor_hatch_L_rot", 0, "window_armor_hatch_R_rot", 0, "door_F_L_open", 0, "door_F_R_open", 0, "door_R_L_open", 0, "door_R_R_open", 0, "hide_rack_spotlights", 0, "hide_sidesteps", 0]
] call BIS_fnc_initVehicle;
```

{% endcode %}
{% endstep %}

{% step %}

### Applying Classname

Launch the game again and right-click on the vehicle you modified in step 1. Go to ***Log*** and select ***Copy classname to clipboard*****.** Then, return to the ***ApplyTextureToVehicle.sqf*** file and paste the classname where it says `"CLASSNAME"`.
{% endstep %}

{% step %}

### Executing script

Create a new file in the mission folder called ***init.sqf*** and paste the following code in there:

```sqf
[] execVM "ApplyTextureToVehicles.sqf";
```

{% endstep %}
{% endstepper %}
