Page MenuHomeFeedback Tracker

[Warlords] Vehicle spawn does not work with custom factions
New, NormalPublic

Description

Custom factions from mods such as RHS can't spawn vehicles in garrisons when using Warlords. This is due to a line in BIS_fnc_WLSectorInit:

_grpPool = ("TRUE" configClasses (BIS_WL_cfgIndepGrps >> BIS_WL_factionsPool # 2 >> "Mechanized")) + ("TRUE" configClasses (BIS_WL_cfgIndepGrps >> BIS_WL_factionsPool # 2 >> "Motorized"));

As the config class of the groups chosen from is hard-coded to either "Mechanized" or "Motorized", it cannot select from groups that aren't named using the same convention as the standard factions.

Details

Severity
Tweak
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce

Load Arma 3 with a custom factions mod that does not use standard group names (RHS is a good example).
Place warlords modules as standard.
Replace independent faction in Warlords Init with a faction from the mod.
Place sectors and bases as normal
Independent forces will spawn infantry as normal, but no vehicles will spawn.

Additional Information

Easiest fix I can think of is to replace the hard-coded group configs with variables that can be changed in the Warlords init:

BIS_fnc_WLSectorInit

_grpPool = BIS_WL_cfgIndepVehGrps;

BIS_fnc_WLVarsInit

BIS_WL_cfgIndepVehGrpNames = _this getVariable "CustomVehicleGroups"; //Array of custom group names - easier to enter into the module than full config entries - default:  ["Mechanized", "Motorized"]

(...)

BIS_WL_cfgIndepVehGrps = [];
{
  BIS_WL_cfgIndepVehGrps append [("TRUE" configClasses (BIS_WL_cfgIndepGrps >> BIS_WL_factionsPool # 2 >> _x))]
}foreach BIS_WL_BIS_WL_cfgIndepVehGrpNames
//Needs to be added to the function after BIS_WL_cfgIndepGrps and BIS_WL_factionsPool are initialized

Event Timeline

syhrus created this task.Dec 13 2018, 12:23 AM
syhrus added a comment.EditedDec 13 2018, 4:55 AM

I've also found an additional "issue" (more like a NTH feature) for mods where you want to use an independent faction as Blufor or use an Opfor faction as Independent etc (IFA3 this time)

The issue lies in BIS_fnc_WLInitVars and is the same as the above problem: You can only spawn factions on the side they are set to by default. It should be possible to spawn units on different sides to their default faction thanks to the way the groups are spawned in WLSectorPopulate. In this example, I am attempting to make a D-day style mission, but IFA3 has US forces set for Independent side by default, and Wehrmacht to Blufor. Theoretically the spawning is possible with the modified sides, but because the code searches for each faction in a hard-coded config level, it means it cannot find the right faction when it runs through the setup.

BIS_fnc_WLInitVars - Current

_faction = _this getVariable (["FactionOPFOR", "FactionBLUFOR", "FactionIndep"] # _forEachIndex);
(…)
_groupTypes = "TRUE" configClasses (_cfgGroups >> ["East", "West", "Indep"] # _forEachIndex >> _faction);

This one would be a little trickier to fix though, as you would need to search all three sides' configs for the faction, then select the correct one from those three. I'm not so good at my config queries though, so I can't think of a tidy way to do it. Perhaps someone cleverer than me can work it out.

syhrus added a comment.EditedDec 13 2018, 6:47 AM

And another update because I can't just leave things alone, I've got a workaround for the second issue I posted above. The WL variables can be modified at runtime, which means with a few scripts set to run after the WLinit, you can work past these issues:

Workaround for different factions for sides - run from init.sqf for multiplayer, and for single player will need to be executed by another script called AFTER modules initialize

BIS_WL_unitsPool = [];
{
		_faction = ["LIB_WEHRMACHT", "LIB_US_ARMY", "LIB_WEHRMACHT"] # _forEachIndex; //Choose appropriate factions for each side in order EAST, WEST, INDEPENDENT
		_factionUnits = [];
		_cfgGroups = configFile >> "CfgGroups";
		_groupTypes = "TRUE" configClasses (_cfgGroups >> ["West", "Indep", "West"] # _forEachIndex >> _faction); //Choose the default side for each faction chosen above.
		{
			_groupClasses = "TRUE" configClasses _x;
			{
				_unitClasses = "TRUE" configClasses _x;
				_includesVehicles = FALSE;
				_groupUnits = [];
				{
					_unitClass = getText (_x >> "vehicle");
					if (toLower getText (BIS_WL_cfgVehs >> _unitClass >> "simulation") == "soldier") then {
						if (toLower getText (BIS_WL_cfgVehs >> _unitClass >> "vehicleClass") != "mendiver" && !(_unitClass in BIS_WL_mortarUnits)) then {
							_groupUnits pushBackUnique _unitClass;
						};
					} else {
						_includesVehicles = TRUE;
					};
				} forEach _unitClasses;
				if !(_includesVehicles) then {{_factionUnits pushBackUnique _x} forEach _groupUnits};
			} forEach _groupClasses;
		} forEach _groupTypes;
		BIS_WL_unitsPool pushBack _factionUnits;
	} forEach BIS_WL_sidesPool;

The same sort of solution should be possible for vehicles. Will post an update when I work that one out.

EDIT: Nope, the issue can't be circumvented for vehicle spawns. The hard-coded config names can't be avoided :(

chose added a subscriber: chose.Dec 17 2018, 3:57 PM

Thle problem is not with vehicles for garrisons, these are spawned only be predefined compositions in the editor. See https://community.bistudio.com/wiki/Arma_3_MP_Warlords#4._.28OPTIONAL.29_Set_up_vehicles.
Searching for a faction in all sides configs is not a good idea since there could be factions with identical class name for multiple sides.

Searching for a faction in all sides configs is not a good idea since there could be factions with identical class name for multiple sides.

Oh good point, I didn't think of that. Oh well ;)

Thle problem is not with vehicles for garrisons, these are spawned only be predefined compositions in the editor. See https://community.bistudio.com/wiki/Arma_3_MP_Warlords#4._.28OPTIONAL.29_Set_up_vehicles.

That's optional, but the code exists within the functions. Place down some warlords sectors with AAF units and they spawn in roaming Strider patrols and APCs holding points.

Correct, I forgot about the vehicle patrols. Well the trouble with mods is that they don't always have the same nomenclature rules as official content and scanning the configs for specific group types is very complicated because of that. Requiring people to dig this deep into the mod configs in order to set up the correct assets is something I'd like avoid doing, but perhaps I will be able to solve it somehow automatically.

syhrus added a comment.EditedDec 19 2018, 11:20 AM

Requiring people to dig this deep into the mod configs in order to set up the correct assets is something I'd like avoid doing, but perhaps I will be able to solve it somehow automatically.

Yeah I can certainly agree with that line of thinking. It would make life a lot easier if they just used the conventions!
I was pondering how you could automatically detect vehicle groups, and did notice there appeared to be a spot where someone considered it in the WLInitVars function. There is a loop of code that finds the infantry groups by ignoring any group with a vehicle. Perhaps adding an else section to that loop where it discards groups with vehicle types we don't want (Tank sections, artillery, etc) could do the trick?