Jump to content
GeeGeeRaffe

Need a CfgVehicles wizard to crack TextureSources failure

Recommended Posts

Attempting workaround for hidden selections that don't apply. (Think Huron, some CSAT vehicles, etc.)

 

1) Made new "TextureSources" class as a test for custom faction.

 

2) New class is obviously working in game and can be applied from list.

 

3) New class does not apply to vehicle by default despite being only item in list, defaults to original Sand texture from inherited vehicle.

 

4) Have to manually select new class for every vehicle put down in editor. Don't want to do that every time for multiple vehicles.

 

5) I want the vehicle to use new class as default when placed in editor.

 

6) Want to apply texture by default through CfgVehicles. Know this is possible because I did it years ago but lost the code.

Must be an event handler in vehicle config with "BIS_fnc_initVehicle" function in "init =" or something? Looked at OEM configs and found nothing.

No idea how to accomplish this because user is an artist and not a programmer. Help?

 

class CfgVehicles
{
	// Texture Vehicle
	class B_APC_Tracked_01_AA_F;
	class GGR_Test: B_APC_Tracked_01_AA_F
	{
		scope = 2;	
		displayName = "[TEST]";
		author = "Steve Sherber (GeeGeeRaffe)";
		editorSubcategory = "EdSubcat_AAs";
		faction = "GGR_F_USAF";
		side = 1;
		crew = "B_crew_F";
		typicalCargo[] = {"B_Soldier_F"};
		hiddenSelections[] = {"camo1","camo2","camo3","CamoNet"};
		// Define Custom Textures
		class TextureSources
		{
			class USAF_Woodland_APC_Tracked_01_AA
			{
				displayName = "USAF Woodland";
				author = "Steve Sherber (GeeGeeRaffe)";
				textures[] = {"A3\Armor_F_exp\APC_Tracked_01\Data\apc_tracked_01_aa_body_olive_co.paa","A3\Armor_F_exp\APC_Tracked_01\Data\mbt_01_body_olive_co.paa","A3\Armor_F_exp\APC_Tracked_01\Data\apc_tracked_01_aa_tower_olive_co.paa","a3\Armor_F\Data\camonet_NATO_Green_CO.paa"};
				factions[] = {"GGR_F_USAF"};
			};
			textureList[] = {"USAF_Woodland_APC_Tracked_01_AA"};
		};
		// Vehicle Inventory
		class TransportItems{};
		class TransportMagazines{};
		class TransportWeapons{};
		class TransportBackpacks{};
	};
};

 

Share this post


Link to post
Share on other sites

All right! So, to narrow this down further:

 

1) I've verified that my TextureSources class functions 100% properly in-game.

 

#define _ARMA_

class CfgPatches
{
	class GGR_TLR_USAF_Anti_Air
	{
		author = "Steve Sherber (GeeGeeRaffe)";
		name = "Twin Lakes Resistance (GGR_F_USAF Anti_Air Config)";
		url = "https://www.arma3.com";
		requiredAddons[] = {"A3_Armor_F_Beta"};
		requiredVersion = 0.1;
		units[] = {"GGR_USAF_Veh_Cheetah"};
		weapons[] = {};
	};
};

class DefaultEventHandlers;
class EventHandlers;

class CfgVehicles
{
	class B_APC_Tracked_01_AA_F;
	class GGR_USAF_Veh_Cheetah: B_APC_Tracked_01_AA_F
	{
		scope = 2;	
		displayName = "IFV-6a Cheetah";
		author = "Steve Sherber (GeeGeeRaffe)";
		editorSubcategory = "EdSubcat_AAs";
		faction = "GGR_F_USAF";
		side = 1;
		crew = "B_crew_F";
		typicalCargo[] = {"B_Soldier_F"};
		// Define Custom Textures
		class TextureSources
		{
			class Sand
			{
				displayName = "$STR_A3_TextureSources_Sand0";
				author = "$STR_A3_Bohemia_Interactive";
				textures[] = {"A3\Armor_F_Beta\APC_Tracked_01\Data\apc_tracked_01_aa_body_co.paa","A3\Armor_F_Beta\APC_Tracked_01\Data\mbt_01_body_co.paa","A3\Armor_F_Beta\APC_Tracked_01\Data\apc_tracked_01_aa_tower_co.paa","a3\Armor_F\Data\camonet_NATO_Desert_CO.paa"};
				factions[] = {"GGR_F_USAF"};
			};
			class Olive
			{
				displayName = "$STR_A3_TEXTURESOURCES_OLIVE0";
				author = "$STR_A3_Bohemia_Interactive";
				textures[] = {"A3\Armor_F_exp\APC_Tracked_01\Data\apc_tracked_01_aa_body_olive_co.paa","A3\Armor_F_exp\APC_Tracked_01\Data\mbt_01_body_olive_co.paa","A3\Armor_F_exp\APC_Tracked_01\Data\apc_tracked_01_aa_tower_olive_co.paa","a3\Armor_F\Data\camonet_NATO_Green_CO.paa"};
				factions[] = {"GGR_F_USAF"};
			};
			class Woodland
			{
				displayName = "USAF Woodland";
				author = "Steve Sherber (GeeGeeRaffe)";
				textures[] = {"A3\Armor_F_Beta\APC_Tracked_01\Data\APC_Tracked_01_AA_body_NOHQ.paa","A3\Armor_F_Beta\APC_Tracked_01\Data\MBT_01_body_NOHQ.paa","A3\Armor_F_Beta\APC_Tracked_01\Data\APC_Tracked_01_AA_Tower_NOHQ.paa","a3\Armor_F\Data\camonet_green_CO.paa"};
				factions[] = {"GGR_F_USAF"};
			};
		};
		// Vehicle Inventory
		class TransportItems{};
		class TransportMagazines{};
		class TransportWeapons{};
		class TransportBackpacks{};
	};
};

2) I was indeed correct that an init line using "bis_fnc_initVehicle" works for my purpose:

 

[this, "Woodland", nil] call bis_fnc_initVehicle;

This line added to the vehicle's init field in Eden does what I wanted to do, which is assign the test "Woodland" texture set to the vehicle by default at mission start.

 

HOWEVER:

 

Adding this to my CfgVehicles entry for the vehicle does not work, which is driving me mad.

 

		// Texture Init
		class EventHandlers
		{
			init = "[this, "Woodland", nil] call bis_fnc_initVehicle;";
		};

I always return the error:

 

Quote

"" encountered instead of -=-

 

And after variations and attempts, changing this to _this based on old forum posts suggesting local variables were needed and other attempts, I am well and truly starting to get frustrated. It's obviously a syntax error due to my lack of coding knowledge, since the init line works fine from the editor, but I don't want to have to enter it on every single vehicle manually, especially since you can do it right from the config.

 

Can somebody please tell me where I'm messing up and why? Is my better option trying to mess with the texturelist variable?

Share this post


Link to post
Share on other sites
init = "[this, "Woodland", nil] call bis_fnc_initVehicle;";

STRING in a STRING, you need to either use double quotes or single quotes around Woodland. Otherwise, it thinks the quotes at the start of woodland is the end of the init string causing the rest of the line to throw the error.

init = "[this, ""Woodland"", nil] call bis_fnc_initVehicle;";
init = "[this, 'Woodland', nil] call bis_fnc_initVehicle;";

Notice the difference between the colourization of the above two lines to your original.

Share this post


Link to post
Share on other sites
On 3/11/2024 at 5:13 AM, GeeGeeRaffe said:

5) I want the vehicle to use new class as default when placed in editor.

 

6) Want to apply texture by default through CfgVehicles.

Surely you just use hiddenSelectionsTextures to apply the default textures to your modded vehicle, much like the original B_APC_Tracked_01_AA_F has ...

hiddenSelectionsTextures[]=
{
  "A3\Armor_F_Beta\APC_Tracked_01\Data\apc_tracked_01_aa_body_co.paa",
  "A3\Armor_F_Beta\APC_Tracked_01\Data\mbt_01_body_co.paa",
  "A3\Armor_F_Beta\APC_Tracked_01\Data\apc_tracked_01_aa_tower_co.paa",
  "a3\Armor_F\Data\camonet_NATO_Desert_CO.paa"
};

You overwrite it with the default textures you want applied...

hiddenSelectionsTextures[]=
{
	"A3\Armor_F_exp\APC_Tracked_01\Data\apc_tracked_01_aa_body_olive_co.paa",
	"A3\Armor_F_exp\APC_Tracked_01\Data\mbt_01_body_olive_co.paa",
	"A3\Armor_F_exp\APC_Tracked_01\Data\apc_tracked_01_aa_tower_olive_co.paa",
	"a3\Armor_F\Data\camonet_NATO_Green_CO.paa"
};

 

Share this post


Link to post
Share on other sites

Thank you for your reply, Larrow. I greatly appreciate your time and experience.

 

Quote

STRING in a STRING, you need to either use double quotes or single quotes around Woodland. Otherwise, it thinks the quotes at the start of woodland is the end of the init string causing the rest of the line to throw the error.

 

I assumed it was something so simple. Thank you.

 

Quote

Surely you just use hiddenSelectionsTextures to apply the default textures to your modded vehicle, much like the original B_APC_Tracked_01_AA_F has ...

 

I've been doing unit retexturing off and on for a year or so now, and what people need to appreciate is that the hiddenSelectionsTextures line has weird considerations on vehicles versus the way it works on all other gear. Having spent a fair bit of time experimenting in CfgVehicles, CfgWeapons, CfgGlasses, etc, you would typically use hiddenSelectionsTextures to texture those items, and if you're feeling adventurous you can get more in-depth and make a custom .rvmat, for instance, on a beret to apply your custom badge.

 

With vehicles it gets less straight forward. One of the two main issues is that hiddenSelectionsTextures does not always change the default texture set on a vehicle. This can be observed on the Huron helicopter, as I said, the CSAT APCs, some aircraft, turrets, and so on. The second issue is that vehicle animations, such as the camo net, will often be overwritten by the default texture even if it is defined as a custom, because hiddenSelectionsTextures merely overrides the default choices instead of creating a de facto paint scheme to be used in "edit vehicle appearance." In that case, as I've discovered, it's necessary to create a livery to add to the texture list. My example here is a very specific use case for when hiddenSelectionsTextures  doesn't overwrite the default texture set, since I want the complete Arma 3 vehicle fleet accessible to particular factions in game, and as you might gather, the flexibility of faction specific liveries is important to that.

 

This isn't to denegrate your reply at all, I just felt it would be useful in this thread if somebody happens to look it up. My solution here is, again, as a specific use case, to solve a minor problem that happens infrequently and seems to be poorly known online over many youtube videos, articles, guides, etc.

Share this post


Link to post
Share on other sites
22 hours ago, GeeGeeRaffe said:

One of the two main issues is that hiddenSelectionsTextures does not always change the default texture set on a vehicle. This can be observed on the Huron helicopter, as I said, the CSAT APCs, some aircraft, turrets, and so on. The second issue is that vehicle animations, such as the camo net, will often be overwritten by the default texture even if it is defined as a custom, because hiddenSelectionsTextures merely overrides the default choices instead of creating a de facto paint scheme

Really, even if you make sure to overwrite TextureList[] and AnimationList[] ? Seems odd.

For instance the Huron has...

textureList[] = {"Green",1};

So, if you inherit from this unless you overwrite it then it will always apply the textureSource "green" no matter what you put in hiddenSelectionsTextures.

It already has a postInit EH telling initVehicle to choose by weighted selection.

// (_this select 0): the vehicle
// """" Random texture source (pick one from the property textureList[])
// []: randomize the animation sources (accordingly to the property animationList[])
// false: Don't change the mass even if an animation source has a defined mass
postinit = "if (local (_this select 0)) then {[(_this select 0), """", [], false] call bis_fnc_initVehicle;};";

 

This...

textureList[] = {"USAF_Woodland_APC_Tracked_01_AA"};

...that you have inside the textureSources class in your OP example, should be outside in the main class and include a weight.

Arma 3: Vehicle Customization

Share this post


Link to post
Share on other sites

So! I just wanted to throw an update in here and a solution to my original problem because I wasn't as cool as I thought I was.

 

After a lot more deep diving into BI's configs and moving on to CSAT and IND vehicles instead of just NATO, which I rarely worked on before and encountered very little problems with, I can now say with proven consistency that the answer to my problem was much simpler than a script or anything of that nature.

 

In short, the problem that others have faced over scattered forums, YouTube videos, and Workshop threads is this: if you just define the hiddenSelections and don't also define TextureSources within your custom vehicle, stupid stuff happens. What do I mean?

 

Common errors:

 

1) hiddenSelections alone won't change the vehicle's skin when it is dropped in the editor.

2) If you apply cosmetics such as the camo nets, carried backpacks, etc on a vehicle you'll lose your custom skin and/or it will glitch out and refuse to apply anything, you'll lose access to your custom skin, etc etc.

 

Further experimentation proved that if you DO define a new camo through TextureSources, your best practice is to also use the SAME FILE PATHS IN HIDDENSELECTIONS. Why? Because when you define a new livery through TextureSources and you want to apply it to the vehicle, it must match on both entries. Why does that matter? Because the engine is actually smart enough to look at your config, look at hiddenSelections, compare it to a matching entry on TextureSources, AND THEN ASSIGN YOUR NEW SKIN BY DEFAULT TO THE VEHICLE. As in, if you then access "Edit Vehicle Appearance" in Eden, your new skin will be assigned by default and will also appear by default when dropped in the editor. This is the exact reason that cosmetic features and hiddenSelections alone doesn't work on some vehicles with additional features, because the config is looking for a matching entry defined in TextureSources and if it doesn't find it, it will default to the inherited class instead of your custom files.

 

So, in conclusion, if you're going to reskin a vehicle, your best practice is to define hiddenSelections as you do with everything else, defining the camo you are changing, such as "camo1" and the file paths to replace it with in your mod. You must ALSO use a TextureSources entry to properly register your new skin for full use in both the editor and scripting. And if you want everything to work properly, MAKE SURE THESE TWO ENTRIES HAVE CONSISTENT FILE PATHS.

 

An example of working code:

 

	class O_MBT_02_railgun_F;
	class GGR_TLR_UASR_Veh_Futura: O_MBT_02_railgun_F
	{
		scope = 2;
		displayName = "Futura (Woodland)";
		editorSubcategory = "EdSubcat_Tanks";
		faction = "GGR_Fac_UASR";
		side = 0;
		// Define Custom Textures
		hiddenSelections[] = {"camo1","camo2","camo3","CamoNet"};
		hiddenSelectionsTextures[] =
		{
			"\GGR\GGR_TLR\Data\Veh\Tank\GGR_TLR_UASR_Veh_Futura_Ext01.paa",
			"\GGR\GGR_TLR\Data\Veh\Tank\GGR_TLR_UASR_Veh_Futura_Gun.paa",
			"\GGR\GGR_TLR\Data\Veh\Tank\GGR_TLR_UASR_Veh_Futura_Ext02.paa",
			"\GGR\GGR_TLR\Data\Veh\Tank\GGR_TLR_UASR_Veh_Futura_Camonet.paa"
		};
		class TextureSources
		{
			class NewSkin
			{
				displayName = "Hex (Woodland)";
				textures[] =
				{
					"\GGR\GGR_TLR\Data\Veh\Tank\GGR_TLR_UASR_Veh_Futura_Ext01.paa",
					"\GGR\GGR_TLR\Data\Veh\Tank\GGR_TLR_UASR_Veh_Futura_Gun.paa",
					"\GGR\GGR_TLR\Data\Veh\Tank\GGR_TLR_UASR_Veh_Futura_Ext02.paa",
					"\GGR\GGR_TLR\Data\Veh\Tank\GGR_TLR_UASR_Veh_Futura_Camonet.paa"
				};
				factions[] = {"GGR_Fac_UASR"};
			};
		};
	};

 

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

×