From 74d5ba4f79afb623cb8b412be30a675ec00afc48 Mon Sep 17 00:00:00 2001 From: Andreas Brostrom Date: Sat, 18 Sep 2021 20:04:08 +0200 Subject: [PATCH 1/5] Added ability to select barrel art and number --- cScripts/CfgFunctions.hpp | 1 + .../fn_vehicle_addCosmeticSelection.sqf | 90 +++++++++++++++++++ .../vehicle/fn_vehicle_addStagingActions.sqf | 5 +- 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf diff --git a/cScripts/CfgFunctions.hpp b/cScripts/CfgFunctions.hpp index f885e7b4d..289f0efa9 100644 --- a/cScripts/CfgFunctions.hpp +++ b/cScripts/CfgFunctions.hpp @@ -147,6 +147,7 @@ class cScripts { class vehicle_addRegearAction {}; class vehicle_addRepairAction {}; + class vehicle_addCosmeticSelection {}; class vehicle_addPylonSelection {}; class vehicle_setupPylonCategories {}; }; diff --git a/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf b/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf new file mode 100644 index 000000000..8b31bd282 --- /dev/null +++ b/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf @@ -0,0 +1,90 @@ +#include "..\script_component.hpp"; +/* + * Author: CPL.Brostrom.A + * This function add cosmetic options to vehicles + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * Nothing + * + * Example: + * ["truckMcTruckLoad"] call cScripts_fnc_vehicle_addCosmeticSelection + * + * Public: No + */ + +params [["_vehicle", objNull, [objNull]]]; + +// [className, displayName, [[0, Desert], [0, Woodland], {code}]] +private _textures = [ + ["rhsusf_m1a1tank_base", "Barrel - Diplomacy Failed", [ + [12, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\BarrelArt_Abrams_D\30_ca.paa"], + [12, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\BarrelArt_Abrams_WD\17_ca.paa"] + ]], + ["rhsusf_m1a1tank_base", "Saber-1", [ + [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\1_ca.paa"], + [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\1_ca.paa"], + {_vehicle setVariable [QEGVAR(Vehicle,Squad), 1]} + ]], + ["rhsusf_m1a1tank_base", "Saber-2", [ + [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\2_ca.paa"], + [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\2_ca.paa"], + {_vehicle setVariable [QEGVAR(Vehicle,Squad), 2]} + ]], + ["rhsusf_m1a1tank_base", "Saber-3", [ + [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\3_ca.paa"], + [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\3_ca.paa"], + {_vehicle setVariable [QEGVAR(Vehicle,Squad), 3]} + ]], + ["rhsusf_m1a1tank_base", "Saber-4", [ + [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\4_ca.paa"], + [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\4_ca.paa"], + {_vehicle setVariable [QEGVAR(Vehicle,Squad), 4]} + ]] +]; + +{ + _x params ["_classname", "_displayName", "_textureCode"]; + if (_vehicle isKindOf _classname) then { + + private _statement = { + params ["_vehicle", "_player", "_params"]; + _params params [["_desert", []], ["_woodland", []], ["_code", {}, [{}]]]; + + if (_vehicle iskindOf "rhsusf_m1a1tank_base") then { + switch (typeOf _vehicle) do { + case "rhsusf_m1a1aimd_usarmy"; + case "rhsusf_m1a1aim_tuski_d"; + case "rhsusf_m1a2sep1d_usarmy"; + case "rhsusf_m1a2sep1tuskid_usarmy"; + case "rhsusf_m1a2sep1tuskiid_usarmy"; + case "rhsusf_m1a2sep2d_usarmy": {_vehicle setObjectTextureGlobal _desert;}; + default { + if (count _woodland == 0) then { + _vehicle setObjectTextureGlobal _desert; + } else { + _vehicle setObjectTextureGlobal _woodland; + }; + }; + }; + call _code; + [ + [], + ["Vehicle Art have been changed"], + [if (count _woodland == 0) then {_desert#1} else {_woodland#1}, 10], + [""] + ] call CBA_fnc_notify; + }; + }; + + private _category = ["ACE_SelfActions", QEGVAR(Actions_Vehicle,Main_Cat), QEGVAR(Actions_Vehicle,Cosmetic_Cat)]; + private _action = [format ["cScripts_Cosmetic_%1_%2", _classname, _forEachIndex], _displayName, "", _statement, {true}, nil, _textureCode] call ace_interact_menu_fnc_createAction; + [_vehicle, 1, _category, _action] call ace_interact_menu_fnc_addActionToObject; + + #ifdef DEBUG_MODE + [format["Selector for classname '%1' named '%2' added to %3 (%4)", typeOf _vehicle, _displayName, _vehicle, typeOf _vehicle], "Vehicle Cosmetic Selector"] call FUNC(info); + #endif + }; +} foreach _textures; \ No newline at end of file diff --git a/cScripts/functions/vehicle/fn_vehicle_addStagingActions.sqf b/cScripts/functions/vehicle/fn_vehicle_addStagingActions.sqf index 2ce76af4d..afd5dec0a 100644 --- a/cScripts/functions/vehicle/fn_vehicle_addStagingActions.sqf +++ b/cScripts/functions/vehicle/fn_vehicle_addStagingActions.sqf @@ -26,7 +26,10 @@ private _condition = { call FUNC(checkStagingZone) }; private _stagingCat = [QEGVAR(Actions_Vehicle,Main_Cat), "Vehicle Staging Zone", "cScripts\Data\Icon\icon_00.paa", {true}, _condition] call ace_interact_menu_fnc_createAction; [_vehicle, 1, ["ACE_SelfActions"], _stagingCat] call ace_interact_menu_fnc_addActionToObject; +private _stagingCat = [QEGVAR(Actions_Vehicle,Cosmetic_Cat), "Vehicle Cosmetics", "cScripts\Data\Icon\icon_00.paa", {true}, {true}] call ace_interact_menu_fnc_createAction; +[_vehicle, 1, ["ACE_SelfActions", QEGVAR(Actions_Vehicle,Main_Cat)], _stagingCat] call ace_interact_menu_fnc_addActionToObject; + [_vehicle] call EFUNC(vehicle,addRegearAction); [_vehicle] call EFUNC(vehicle,addRepairAction); - +[_vehicle] call EFUNC(vehicle,addCosmeticSelection); //_vehicle call EFUNC(vehicle,setupPylonSelection); \ No newline at end of file From 10f98c4cd1d5cec21b513acedcf8c645e587e6d4 Mon Sep 17 00:00:00 2001 From: Andreas Brostrom Date: Sat, 18 Sep 2021 20:24:51 +0200 Subject: [PATCH 2/5] updated art array --- .../functions/vehicle/fn_vehicle_addCosmeticSelection.sqf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf b/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf index 8b31bd282..87136fdeb 100644 --- a/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf +++ b/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf @@ -23,6 +23,12 @@ private _textures = [ [12, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\BarrelArt_Abrams_D\30_ca.paa"], [12, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\BarrelArt_Abrams_WD\17_ca.paa"] ]], + ["rhsusf_m1a1tank_base", "Barrel - Thunderbolt IX", [ + [12, "\rhsusf\addons\rhsusf_decals\Data\Labels\BarrelArt_Abrams_WD\0_ca.paa"] + ]], + ["rhsusf_m1a1tank_base", "Barrel - 120mm IV", [ + [12, "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_120mmIV_ca.paa"] + ]], ["rhsusf_m1a1tank_base", "Saber-1", [ [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\1_ca.paa"], [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\1_ca.paa"], From 1a165bd7d3dc166ae2bbb3d19c9e80eadedf1d20 Mon Sep 17 00:00:00 2001 From: Andreas Brostrom Date: Mon, 27 Sep 2021 19:14:20 +0200 Subject: [PATCH 3/5] Better art selection --- .../fn_vehicle_addCosmeticSelection.sqf | 108 ++++++++++-------- tools/config.json | 2 +- 2 files changed, 63 insertions(+), 47 deletions(-) diff --git a/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf b/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf index 87136fdeb..bcb9859e6 100644 --- a/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf +++ b/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf @@ -17,37 +17,70 @@ params [["_vehicle", objNull, [objNull]]]; -// [className, displayName, [[0, Desert], [0, Woodland], {code}]] private _textures = [ - ["rhsusf_m1a1tank_base", "Barrel - Diplomacy Failed", [ - [12, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\BarrelArt_Abrams_D\30_ca.paa"], - [12, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\BarrelArt_Abrams_WD\17_ca.paa"] + ["rhsusf_m1a1tank_base", "Saber-1 (120mm IV)", [ + "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_120mmIV_ca.paa", + { + _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\1_ca.paa"]; + _vehicle setObjectTextureGlobal [12, "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_120mmIV_ca.paa"]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), 1]; + } ]], - ["rhsusf_m1a1tank_base", "Barrel - Thunderbolt IX", [ - [12, "\rhsusf\addons\rhsusf_decals\Data\Labels\BarrelArt_Abrams_WD\0_ca.paa"] + ["rhsusf_m1a1tank_base", "Saber-2 (Bounty Hunters)", [ + "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_BountyHunters_ca.paa", + { + _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\2_ca.paa"]; + _vehicle setObjectTextureGlobal [12, "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_BountyHunters_ca.paa"]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), 2]; + } ]], - ["rhsusf_m1a1tank_base", "Barrel - 120mm IV", [ - [12, "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_120mmIV_ca.paa"] + ["rhsusf_m1a1tank_base", "Saber-3 (Iron Clad Lads)", [ + "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_IronCladLads_ca.paa", + { + _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\3_ca.paa"]; + _vehicle setObjectTextureGlobal [12, "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_IronCladLads_ca.paa"]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), 3]; + } ]], - ["rhsusf_m1a1tank_base", "Saber-1", [ - [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\1_ca.paa"], - [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\1_ca.paa"], - {_vehicle setVariable [QEGVAR(Vehicle,Squad), 1]} + ["rhsusf_m1a1tank_base", "Saber-4 (War Saw)", [ + "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_WarSaw_ca.paa", + { + _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\4_ca.paa"]; + _vehicle setObjectTextureGlobal [12, "\z\cav\addons\textures\data\vehicles\abrams\BarrelArt_WarSaw_ca.paa"]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), 4]; + } + ]], + ["rhsusf_m1a1tank_base", "Saber-1", [ + "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\1_ca.paa", + { + _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\1_ca.paa"]; + _vehicle setObjectTextureGlobal [12, ""]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), 1]; + } ]], ["rhsusf_m1a1tank_base", "Saber-2", [ - [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\2_ca.paa"], - [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\2_ca.paa"], - {_vehicle setVariable [QEGVAR(Vehicle,Squad), 2]} + "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\2_ca.paa", + { + _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\2_ca.paa"]; + _vehicle setObjectTextureGlobal [12, ""]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), 2]; + } ]], ["rhsusf_m1a1tank_base", "Saber-3", [ - [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\3_ca.paa"], - [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\3_ca.paa"], - {_vehicle setVariable [QEGVAR(Vehicle,Squad), 3]} + "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\3_ca.paa", + { + _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\3_ca.paa"]; + _vehicle setObjectTextureGlobal [12, ""]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), 3]; + } ]], ["rhsusf_m1a1tank_base", "Saber-4", [ - [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\4_ca.paa"], - [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_WD\4_ca.paa"], - {_vehicle setVariable [QEGVAR(Vehicle,Squad), 4]} + "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\4_ca.paa", + { + _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\4_ca.paa"]; + _vehicle setObjectTextureGlobal [12, ""]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), 4]; + } ]] ]; @@ -57,32 +90,15 @@ private _textures = [ private _statement = { params ["_vehicle", "_player", "_params"]; - _params params [["_desert", []], ["_woodland", []], ["_code", {}, [{}]]]; + _params params [["_texture", "", [""]], ["_code", {}, [{}]]]; - if (_vehicle iskindOf "rhsusf_m1a1tank_base") then { - switch (typeOf _vehicle) do { - case "rhsusf_m1a1aimd_usarmy"; - case "rhsusf_m1a1aim_tuski_d"; - case "rhsusf_m1a2sep1d_usarmy"; - case "rhsusf_m1a2sep1tuskid_usarmy"; - case "rhsusf_m1a2sep1tuskiid_usarmy"; - case "rhsusf_m1a2sep2d_usarmy": {_vehicle setObjectTextureGlobal _desert;}; - default { - if (count _woodland == 0) then { - _vehicle setObjectTextureGlobal _desert; - } else { - _vehicle setObjectTextureGlobal _woodland; - }; - }; - }; - call _code; - [ - [], - ["Vehicle Art have been changed"], - [if (count _woodland == 0) then {_desert#1} else {_woodland#1}, 10], - [""] - ] call CBA_fnc_notify; - }; + call _code; + [ + [], + ["Vehicle art have been changed"], + [_texture, 10], + [""] + ] call CBA_fnc_notify; }; private _category = ["ACE_SelfActions", QEGVAR(Actions_Vehicle,Main_Cat), QEGVAR(Actions_Vehicle,Cosmetic_Cat)]; diff --git a/tools/config.json b/tools/config.json index 755ff6327..b3d6e677f 100644 --- a/tools/config.json +++ b/tools/config.json @@ -1,7 +1,7 @@ { "build" : { "scriptName": "cScripts", - "version": "DevBuild", + "version": "4.4.0-56b12aaf_Alpha", "notlist": ["doc", "tools", "release", "resourses", "Compositions", "mission.sqm"] } } \ No newline at end of file From 819105fd07bf71b1513ccb85bf10c8661fe38c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brostr=C3=B6m=2EA=20=7C=20Evul?= Date: Mon, 27 Sep 2021 19:21:55 +0200 Subject: [PATCH 4/5] Minus callsign dont show barrel art --- .../vehicle/fn_vehicle_addCosmeticSelection.sqf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf b/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf index bcb9859e6..1ecbaabdb 100644 --- a/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf +++ b/cScripts/functions/vehicle/fn_vehicle_addCosmeticSelection.sqf @@ -55,7 +55,7 @@ private _textures = [ { _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\1_ca.paa"]; _vehicle setObjectTextureGlobal [12, ""]; - _vehicle setVariable [QEGVAR(Vehicle,Callsign), 1]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), -1]; } ]], ["rhsusf_m1a1tank_base", "Saber-2", [ @@ -63,7 +63,7 @@ private _textures = [ { _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\2_ca.paa"]; _vehicle setObjectTextureGlobal [12, ""]; - _vehicle setVariable [QEGVAR(Vehicle,Callsign), 2]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), -2]; } ]], ["rhsusf_m1a1tank_base", "Saber-3", [ @@ -71,7 +71,7 @@ private _textures = [ { _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\3_ca.paa"]; _vehicle setObjectTextureGlobal [12, ""]; - _vehicle setVariable [QEGVAR(Vehicle,Callsign), 3]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), -3]; } ]], ["rhsusf_m1a1tank_base", "Saber-4", [ @@ -79,7 +79,7 @@ private _textures = [ { _vehicle setObjectTextureGlobal [11, "\rhsusf\addons\RHSUSF_Decals\Data\Labels\ArmyPlt_Abrams_D\4_ca.paa"]; _vehicle setObjectTextureGlobal [12, ""]; - _vehicle setVariable [QEGVAR(Vehicle,Callsign), 4]; + _vehicle setVariable [QEGVAR(Vehicle,Callsign), -4]; } ]] ]; @@ -109,4 +109,4 @@ private _textures = [ [format["Selector for classname '%1' named '%2' added to %3 (%4)", typeOf _vehicle, _displayName, _vehicle, typeOf _vehicle], "Vehicle Cosmetic Selector"] call FUNC(info); #endif }; -} foreach _textures; \ No newline at end of file +} foreach _textures; From d8811d4f8ac1ed86f6221df1a5bb0adf6324117a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brostr=C3=B6m=2EA=20=7C=20Evul?= Date: Wed, 27 Oct 2021 09:55:10 +0200 Subject: [PATCH 5/5] Update config.json --- tools/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/config.json b/tools/config.json index b3d6e677f..fc900313e 100644 --- a/tools/config.json +++ b/tools/config.json @@ -1,7 +1,7 @@ { "build" : { "scriptName": "cScripts", - "version": "4.4.0-56b12aaf_Alpha", + "version": "DevBuild", "notlist": ["doc", "tools", "release", "resourses", "Compositions", "mission.sqm"] } -} \ No newline at end of file +}