Inkko
Valued Member!
Was thinking about a way to spice up the look of vehicles and smashed out a script. Completely untested at the moment, don't have any textures either but is this something anyone would be looking interested in?
Pretty much there would be select vehicles with "additional" textures that could be applied when in the drivers seat. The textures would be applied then synced to other players, and on login would be resynced with any vehicles that have textures so it is consistent. There would be a timer on changing the texture as well to reduce public variable broadcasts. Here is a what I smashed out...again untested and just a concept of my thoughts.
Updated my concept code a little and went into the arma 2 editor to test things out, seems to be working but missing the client sync part since its just me able to test. I found some random textures online/just overlayed colors over current ones for options during my testing.
Pretty much there would be select vehicles with "additional" textures that could be applied when in the drivers seat. The textures would be applied then synced to other players, and on login would be resynced with any vehicles that have textures so it is consistent. There would be a timer on changing the texture as well to reduce public variable broadcasts. Here is a what I smashed out...again untested and just a concept of my thoughts.
Code:
/*
Temporary vehicle retexture concept
DZ_Retexture:
Handles texture variables, Updating textured vehicles on login
PVEH, and vehicle action to retexture.
Helps syncronize texture changes and handles action to retexture.
*/
private ["_check","_texture"];
//if (isServer) exitwith {};
//waituntil {speed player > 1}; //wait for movement, helps run when player has fully loaded in.
DZ_Texture1 = "veh1.paa";
DZ_Texture2 = "veh2.paa";
DZ_Texture3 = "veh3.paa";
DZ_Texture4 = "veh4.paa";
DZ_Texture5 = "veh5.paa";
DZ_Texture6 = "veh6.paa";
DZ_TextureVehicles = ["SUV_DZ","SUV_Blue","SUV_Camo","SUV_Charcoal","SUV_Green","SUV_Orange","SUV_Pink","SUV_PMC","SUV_PMC_BAF","SUV_Red","SUV_Silver","SUV_TK_CIV_EP1","SUV_TK_EP1","SUV_UN_EP1","SUV_White","SUV_Yellow","Lada1","Lada2","Lada1_GDR","Lada2_GDR","Lada4_GDR","Lada5_GDR","Lada_base","LadaLM","Lada1_TK_CIV_EP1","Lada2_TK_CIV_EP1"];
// Update vehicles after loading in
{
if (typeOf _x in DZ_TextureVehicles) Then {
_check = _x getVariable "DZ_Texture";
if (!isnil "_check") then {
switch (_check) do
{
case 0: {_texture = DZ_Texture1;}; // SUV texture 1
case 1: {_texture = DZ_Texture2;}; // SUV texture 2
case 2: {_texture = DZ_Texture3;}; // SUV texture 3
case 3: {_texture = DZ_Texture4;}; // Lada texture 1
case 4: {_texture = DZ_Texture5;}; // Lada texture 2
case 5: {_texture = DZ_Texture6;}; // Lada texture 3
default {_texture = 0;}; // default failsafe.
};
if (_texture != 0) then {
_x setObjectTexture [0,_texture];
};
};
};
} forEach vehicles;
//PVEH. Update textures during gameplay
"DZEH_TextureChange" addPublicVariableEventHandler {
private ["_vehicle","_check","_texture"];
_vehicle = _this select 0; // object
_check = _this select 1; //texture number
if (typeof _vehicle in DZ_TextureVehicles) then {
switch (_check) do
{
case 0: {_texture = DZ_Texture1;}; // SUV texture 1
case 1: {_texture = DZ_Texture2;}; // SUV texture 2
case 2: {_texture = DZ_Texture3;}; // SUV texture 3
case 3: {_texture = DZ_Texture4;}; // Lada texture 1
case 4: {_texture = DZ_Texture5;}; // Lada texture 2
case 5: {_texture = DZ_Texture6;}; // Lada texture 3
default {_texture = 0;}; // default failsafe.
};
if (_texture != 0) then {
_vehicle setObjectTexture [0,_texture];
};
};
};
// Action
[] spawn {
private ["_vehicle","_action_id","_radius","_currentVehicle", "_isNearVeh", "_countVeh"];
_vehicle = ObjNull;
_action_id = -1;
_radius = 10;
while {true} do {
if (!isNull player) then {
_currentVehicle = vehicle player;
_countVeh = (count nearestObjects [(position _currentVehicle),["SUV_DZ","SUV_Blue","SUV_Camo","SUV_Charcoal","SUV_Green","SUV_Orange","SUV_Pink","SUV_PMC","SUV_PMC_BAF","SUV_Red","SUV_Silver","SUV_TK_CIV_EP1","SUV_TK_EP1","SUV_UN_EP1","SUV_White","SUV_Yellow"], _radius]);
_countVeh = _countVeh + (count nearestObjects [(position _currentVehicle),["Lada1","Lada2","Lada1_GDR","Lada2_GDR","Lada4_GDR","Lada5_GDR","Lada_base","LadaLM","Lada1_TK_CIV_EP1","Lada2_TK_CIV_EP1"], _radius]);
_isNearVeh = _countVeh > 0;
if (_vehicle != _currentVehicle) then {
if (!isNull _vehicle) then {
_vehicle removeAction _action_id;
_vehicle = objNull;
};
if (_currentVehicle != player && _isNearVeh) then { //change "Bicycle" to "Land" to allow only air vehicles to aut-refuel
_vehicle = _currentVehicle;
_action_id = _vehicle addAction ["Retexture", "retexture.sqf", [_vehicle], -1, false, true, "", "vehicle _this == _target && local _target"];
};
};
if (!_isNearVeh) then {
_vehicle removeAction _action_id;
_vehicle = objNull;
};
};
sleep 2;
};
};
Code:
private ["_vehicle","_delay","_retexturetime"];
_vehicle = (_this select 3) select 0;
_delay = 300;
if (isnil "LastReTexture") then {
LastReTexture = 0;
};
_retexturetime = time - LastReTexture;
if(_retexturetime < _delay) exitWith { // If cooldown is not done then exit script
cutText [format["You may not retexture a vehicle so soon %1 seconds till you can!",((_retexturetime - _delay) * -1)], "PLAIN DOWN"]; //display text at bottom center of screen when players cooldown is not done
};
retexture_menu =
[
["",true],
["Texture 1", [2], "", -5, [["expression", "(vehicle player) setObjectTexture [0,DZ_Texture1]; (vehicle player) setVariable ['DZ_Texture',0,true];DZEH_TextureChange = [vehicle player, 0]; publicVariable 'DZEH_TextureChange'; LastReTexture = time;"]], "1", "1"],
["Texture 2", [3], "", -5, [["expression", "(vehicle player) setObjectTexture [0,DZ_Texture2]; (vehicle player) setVariable ['DZ_Texture',1,true];DZEH_TextureChange = [vehicle player, 1]; publicVariable 'DZEH_TextureChange'; LastReTexture = time;"]], "1", "1"],
["Texture 3", [4], "", -5, [["expression", "(vehicle player) setObjectTexture [0,DZ_Texture3]; (vehicle player) setVariable ['DZ_Texture',2,true];DZEH_TextureChange = [vehicle player, 2]; publicVariable 'DZEH_TextureChange'; LastReTexture = time;"]], "1", "1"],
["", [-1], "", -5, [["expression", ""]], "1", "0"],
["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];
retexture_menu2 =
[
["",true],
["Texture 1", [2], "", -5, [["expression", "(vehicle player) setObjectTexture [0,DZ_Texture4]; (vehicle player) setVariable ['DZ_Texture',3,true];DZEH_TextureChange = [vehicle player, 3]; publicVariable 'DZEH_TextureChange'; LastReTexture = time;"]], "1", "1"],
["Texture 2", [3], "", -5, [["expression", "(vehicle player) setObjectTexture [0,DZ_Texture5]; (vehicle player) setVariable ['DZ_Texture',4,true];DZEH_TextureChange = [vehicle player, 4]; publicVariable 'DZEH_TextureChange'; LastReTexture = time;"]], "1", "1"],
["Texture 3", [4], "", -5, [["expression", "(vehicle player) setObjectTexture [0,DZ_Texture6]; (vehicle player) setVariable ['DZ_Texture',5,true];DZEH_TextureChange = [vehicle player, 5]; publicVariable 'DZEH_TextureChange'; LastReTexture = time;"]], "1", "1"],
["", [-1], "", -5, [["expression", ""]], "1", "0"],
["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];
if (typeOf _vehicle in ["SUV_DZ","SUV_Blue","SUV_Camo","SUV_Charcoal","SUV_Green","SUV_Orange","SUV_Pink","SUV_PMC","SUV_PMC_BAF","SUV_Red","SUV_Silver","SUV_TK_CIV_EP1","SUV_TK_EP1","SUV_UN_EP1","SUV_White","SUV_Yellow"]) then {
showCommandingMenu "#USER:retexture_menu";
};
if (typeOf _vehicle in ["Lada1","Lada2","Lada1_GDR","Lada2_GDR","Lada4_GDR","Lada5_GDR","Lada_base","LadaLM","Lada1_TK_CIV_EP1","Lada2_TK_CIV_EP1"]) then {
showCommandingMenu "#USER:retexture_menu2";
};
Updated my concept code a little and went into the arma 2 editor to test things out, seems to be working but missing the client sync part since its just me able to test. I found some random textures online/just overlayed colors over current ones for options during my testing.

Last edited: