Jump to content
Sign in to follow this  
Mopsmaster

Ai loadout in zeus arsenal - eternal problem and solution?

Recommended Posts

Is there any solution already for that eternal problem? I think there may be. That would add so much fun to the game and upgrade it alot.

Is there any possibility to just simply save the the different and custom loadouts for particular AI soldiers by clicking on "export" button in the Zeus Arsenal and then pasting that result somewhere for the different AIs to load with different custom loadouts created by us on them before? Goal is for these loadouts to just load at the point when the mission simply starts or just simply assign these loads for good to particular AI soldiers that were created by us in MCC/Zeus.

It sounds simple I know but it seems that it's impossible to achieve. It seemed that I've searched the whole google for the solution of how to achieve that and I didn't find any kind of solution to what I'm describing here so does this means it's literaly impossible?

What I need is to change single AI's outfit uniforms while I load my mission by MCC but when I load a mission the AIs doesn't have their loadouts in the way I changed them to have in Zeus Arsenal. I am wondering is there any way to acomplish that.

This makes totally no sense to me since after we are creating enemy units by Zeus / MCC we cannot apply them (or can we?) for them later to show up in the built-in game map editor so they could (or won't they?) respawn automaticaly with their saved loadouts (cuz there you can easily past their loadouts while exporting it from Zeus arsenal I supose) and they would be still vunerable to the MCC / Zeus scriptings like waypoints , GAIA ect. ect...

I know it's possible to do it with the miscellaneous items but not with the AI's am I right or wrong? The AIs can only be visible on the built-in editor map only when we put hem there by that specific editor but they cannot be visible on the built-in editor while we create them on MCC/Zeus cuz they wouldn't keep their properties set by MCC and Zeus am I right or wrong?

If I am wrong then there is an important question. Will these AIs that would be transfered to and visible on the built-in map editor that kept all of their properties by MCC/Zeus working could be applied with a different loadouts for every particular AI soldier by clicking "export" on the load from Zeus arsenal and copying that into somewhere in the built-in map editor for it to stay there on them while the mission and the AIs will be loaded?

I need help in that guys...

I saw many people have the exactly same problem cuz they want an easiest way for the soldier AIs to load with different loadouts while the mission starts. So if Im right that would be the simplest solution to that but how would I do that?

So is there any possibility for me to copy and paste these AIs to the built-in map editor from the MCC/Zeus (while keeping all of their edited properties) so I could easily apply the loadouts after I finish editing my mission in MCC/Zeus? If there is a way then how?

That's the main question.

Is that possible? If it is then can someone please explain to me how?

If that would be possible I think then the very easy mod could be made to once and for all give us very easy way to change the loadouts of the AI soldiers visible on the map and make them fully functional and working.

After finishing creating of our mission we could just simply transfer all of our AI soldiers from MCC/Zeus while keeping all of their functions created in MCC/Zeus for them to be visible on the built-in map editor so then we could just simply create or change and most important save outfit/loadout of every particular soldier that we wish to for it to load and stay on our AI that we created. Very easy and useful mod could be used for that then.

I'm waiting for your replies guys.

This one is important.

Is there a way?

Edited by Mopsmaster

Share this post


Link to post
Share on other sites

If you want to assign gear for individual units manually:

1) In virtual arsenal, press Ctrl+C or the EXPORT button to copy the loadout script to clipboard.

2) Double click a unit, paste the loadout script into the console text box and execute.

When you export missions from MCC/zeus to editor, I think only the most basic information gets stored (e.g. objects and their positions). Any changes made upon it by script (zeus/MCC...) are not stored. It would make more sense to me to have automatic gear assignment to units based on their classes upon spawning. The idea is to define several loadouts in mission description.ext and execute a loadout assignment script each time a unit is spawned. The following is how we do it in our clan (requires CBA and a fair bit of scripting).

I am pretty sure the following is not the most easy-to-learn/most straightforward method, but it's what makes sense to me.

1) Define loadout presets in description.ext

class cfgLoadouts
{
/*-------------------------------------------------------------------------

	USSR VDV (VDV)

-------------------------------------------------------------------------*/
class VDV_RFL
{
	uniform[] = {
		"rhs_uniform_m88_patchless",
		{"FirstAidKit","rhs_mag_rgd5","rhs_mag_rgd5","rhs_mag_rdg2_white"}
	};
	vest[] = {
		{"LOP_V_6B23_6Sh92_OLV","LOP_V_6B23_Rifleman_OLV","LOP_V_6Sh92_OLV"},
		{"hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK"}
	};
	backpack[] = {
		"",
		{}
	};
	primary[] = {
		"hlc_rifle_aks74",
		{"","","",""},
		{"hlc_30Rnd_545x39_B_AK"}
	};
	secondary[] = {
		"",
		{"","","",""},
		{}
	};
	handgun[] = {
		"",
		{"","","",""},
		{}
	};
	gear[] = {
		{"ItemMap","ItemCompass","ItemWatch","ItemRadio"},
		"LOP_H_SSh68Helmet_OLV",
		"",
		""
	};
};

class VDV_RPG26: VDV_RFL
{
	secondary[] = {
		"rhs_weap_rpg26",
		{"","","",""},
		{"rhs_rpg26_mag"}
	};
};

class VDV_RSHG2: VDV_RFL
{
	secondary[] = {
		"rhs_weap_rshg2",
		{"","","",""},
		{"rhs_rshg2_mag"}
	};
};

class VDV_GRN: VDV_RFL
{
	vest[] = {
		"LOP_V_6Sh92_VOG_OLV",
		{"hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_VOG25_AK","hlc_VOG25_AK","hlc_VOG25_AK","hlc_VOG25_AK","hlc_VOG25_AK","hlc_VOG25_AK","hlc_30Rnd_545x39_B_AK"}
	};
	primary[] = {
		"hlc_rifle_aks74_GL",
		{"","","",""},
		{"hlc_30Rnd_545x39_B_AK","hlc_VOG25_AK"}
	};
};

class VDV_SL: VDV_RFL
{
	vest[] = {
		{"LOP_V_6B23_CrewOfficer_OLV","LOP_V_6B23_CrewOfficer_OLV","LOP_V_6Sh92_Radio_OLV"},
		{"hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_t_ak","rhs_mag_9x18_12_57N181S","rhs_mag_9x18_12_57N181S"}
	};
	handgun[] = {
		"rhs_weap_makarov_pmm",
		{"","","",""},
		{"rhs_mag_9x18_12_57N181S"}
	};
	gear[] = {
		{"ItemMap","ItemCompass","ItemWatch","ItemRadio"},
		"rhs_fieldcap_ml",
		"",
		"Binocular"
	};
};

class VDV_ASL: VDV_RFL
{
	vest[] = {
		{"LOP_V_6B23_6Sh92_OLV","LOP_V_6B23_6Sh92_OLV","LOP_V_6Sh92_Radio_OLV"},
		{"hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_t_ak","hlc_30Rnd_545x39_t_ak"}
	};
	handgun[] = {
		"",
		{"","","",""},
		{}
	};
	gear[] = {
		{"ItemMap","ItemCompass","ItemWatch","ItemRadio"},
		"LOP_H_SSh68Helmet_OLV",
		"",
		"Binocular"
	};
};

class VDV_AR: VDV_RFL
{
	vest[] = {
		"LOP_V_6B23_6Sh92_OLV",
		{"hlc_45Rnd_545x39_t_rpk","hlc_45Rnd_545x39_t_rpk","hlc_45Rnd_545x39_t_rpk","hlc_45Rnd_545x39_t_rpk","hlc_45Rnd_545x39_t_rpk","hlc_45Rnd_545x39_t_rpk","hlc_45Rnd_545x39_t_rpk"}
	};
	primary[] = {
		"hlc_rifle_rpk74n",
		{"","","",""},
		{"hlc_45Rnd_545x39_t_rpk"}
	};
};

class VDV_MED: VDV_RFL
{
	vest[] = {
		"LOP_V_6B23_Medic_OLV",
		{"hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK"}
	};
	backpack[] = {
		"rhs_assault_umbts",
		{"Medikit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit"}
	};
};

class VDV_MRK: VDV_RFL
{
	vest[] = {
		{"LOP_V_6B23_Rifleman_OLV","LOP_V_6Sh92_OLV"},
		{"rhs_10Rnd_762x54mmR_7N1","rhs_10Rnd_762x54mmR_7N1","rhs_10Rnd_762x54mmR_7N1","rhs_10Rnd_762x54mmR_7N1","rhs_10Rnd_762x54mmR_7N1","rhs_10Rnd_762x54mmR_7N1","rhs_mag_9x18_12_57N181S","rhs_mag_9x18_12_57N181S","rhs_mag_9x18_12_57N181S"}
	};
	primary[] = {
		"rhs_weap_svds",
		{"","","rhs_acc_pso1m2",""},
		{"rhs_10Rnd_762x54mmR_7N1"}
	};
	handgun[] = {
		"rhs_weap_makarov_pmm",
		{"","","",""},
		{"rhs_mag_9x18_12_57N181S"}
	};
};

class VDV_PILOT
{
	uniform[] = {
		"rhs_uniform_df15",
		{"FirstAidKit","hlc_30Rnd_545x39_B_AK","hlc_30Rnd_545x39_B_AK"}
	};
	vest[] = {
		"",
		{}
	};
	backpack[] = {
		"",
		{}
	};
	primary[] = {
		"hlc_rifle_aks74u",
		{"","","",""},
		{"hlc_30Rnd_545x39_B_AK"}
	};
	secondary[] = {
		"",
		{"","","",""},
		{}
	};
	handgun[] = {
		"",
		{"","","",""},
		{}
	};
	gear[] = {
		{"ItemMap","ItemCompass","ItemWatch","ItemRadio"},
		{"rhs_gssh18","rhs_zsh7a_mike"},
		"",
		""
	};
};
};

To quickly export loadouts to clipboard, we use a gear export function "[OBJECT:unit] call IOT_fnc_exportInventory"

/*
Author: ted_hou

Description:
Export inventory (config format) of selected unit.

Parameter(s):
	0 :	OBJECT - Unit

Returns:
	ARRAY : ;

Example:
[player] call IOT_fnc_exportInventory;
*/

if (typeName _this == typeName []) Then {
_this = _this select 0;
};

_primaryWeapon = primaryWeapon _this;
_primaryWeaponItems = primaryWeaponItems _this;
_primaryWeaponMagazine = primaryWeaponMagazine _this;
_primary = [_primaryWeapon] + [_primaryWeaponItems] + [_primaryWeaponMagazine];

_secondaryWeapon = secondaryWeapon _this;
_secondaryWeaponItems = secondaryWeaponItems _this;
_secondaryWeaponMagazine = secondaryWeaponMagazine _this;
_secondary = [_secondaryWeapon] + [_secondaryWeaponItems] + [_secondaryWeaponMagazine];

_handgunWeapon = handgunWeapon _this;
_handgunWeaponItems = handgunItems _this;
_handgunWeaponMagazine = handgunMagazine _this;
_handgun = [_handgunWeapon] + [_handgunWeaponItems] + [_handgunWeaponMagazine];

_uniform = [uniform _this] + [uniformItems _this];
_vest = [vest _this] + [vestItems _this];
_backpack = [backpack _this] + [backpackItems _this];

_gear = [assignedItems _this - [binocular _this]] + [headgear _this, goggles _this, binocular _this];


//Export
_br = tostring [13,10];
_tab = toString [9];
_export = "";

_fnc_addArray = {
_name = _this select 0;
_array = _this select 1;

_export = _export + format ["%1[] = {",_name];
{
	_item = _x;
	_itemIndex = _foreachindex;
	if (_itemIndex > 0) then {_export = _export + ",";};
	if (typeName _item != typeName []) Then {
		_export = _export + _br + _tab + format ["""%1""",_item];
	} else {
		_export = _export + _br + _tab + "{";
		{
			if (_foreachindex > 0) then {_export = _export + ",";};
			if (typeName _x == typeName "") then {
				_export = _export + format ["""%1""",_x];
			} else {
				_export = _export + format ["%1",_x];
			};
		} forEach _item;
		_export = _export + "}";
	};
	if (_itemIndex + 1 == count _array) Then {_export = _export + _br;};
} foreach _array;
_export = _export + "};" + _br;
};

["uniform", _uniform] call _fnc_addArray;
["vest", _vest] call _fnc_addArray;
["backpack", _backpack] call _fnc_addArray;
["primary", _primary] call _fnc_addArray;
["secondary", _secondary] call _fnc_addArray;
["handgun", _handgun] call _fnc_addArray;
["gear", _gear] call _fnc_addArray;

copyToClipboard _export;
_export

2) Define which unit class under which faction use which loadout in description.ext


class CfgClassLoadouts
{
class rhs_faction_vdv   //faction classname
{
	data[] = {
		{"rhs_vdv_sergeant","VDV_SL"},    //{unit classname, loadout name defined in cfgLoadouts}
		{"rhs_vdv_efreitor","VDV_ASL"},
		{"rhs_vdv_rifleman","VDV_RFL"},
		{"rhs_vdv_machinegunner","VDV_AR"},
		{"rhs_vdv_LAT","VDV_RPG26"},
		{"rhs_vdv_RShG2","VDV_RSHG2"},
		{"rhs_vdv_marksman","VDV_MRK"},
		{"rhs_vdv_medic","VDV_MED"},
		{"rhs_vdv_grenadier","VDV_GRN"}
	};
};

class rhs_faction_vvs  //faction classname
{
	data[] = {
		{"rhs_pilot_combat_heli","VDV_PILOT"},
		{"rhs_pilot_transport_heli","VDV_PILOT"}
	};
};
};

3) Tell CBA initpost eventhandlers to execute gear assignment script upon unit spawning (works for either units placed via editor or spawned via script/zeus). Put this in description.ext

class Extended_InitPost_EventHandlers
{
class CAManBase
{
	init = "_this call IOT_fnc_initClassLoadout";
};
};

4) Finally, define gear assignment functions

[OBJECT:unit,STRING:loadout classname] call IOT_fnc_loadInventory; Assigns a designated loadout to a unit.

/*
Author: ted_hou

Description:
Export inventory (config format) of selected unit.
Local arguments, global effects. Must execute on owner of unit.

Parameter(s):
	0 :	OBJECT - Unit
	1 : STRING - Loadout name in cfgLoadouts

Returns:
	NOTHING

Example:
[player,"IRAQ_SL"] call IOT_fnc_loadInventory;
*/


_loadout = _this select 1;
_this = _this select 0;

//Parse config entry
_cfg = missionConfigFile >> "cfgLoadouts" >> _loadout;

if !(isClass _cfg) exitWith {};

_uniform = getArray (_cfg >> "uniform");
_vest = getArray (_cfg >> "vest");
_backpack = getArray (_cfg >> "backpack");
_primary = getArray (_cfg >> "primary");
_secondary = getArray (_cfg >> "secondary");
_handgun = getArray (_cfg >> "handgun");
_gear = getArray (_cfg >> "gear");

//Remove inventory
removeUniform _this;
removeVest _this;
removeBackpack _this;
removeAllWeapons _this;
removeAllAssignedItems _this;
removeHeadgear _this;
removeGoggles _this;

//Add containers
_uniformClass = _uniform select 0;
_vestClass = _vest select 0;
_backpackClass = _backpack select 0;
if (typeName _uniformClass == typeName []) Then {
_uniformClass = _uniformClass call bis_fnc_selectRandom;
};
if (typeName _vestClass == typeName []) Then {
_vestClass = _vestClass call bis_fnc_selectRandom;
};
if (typeName _backpackClass == typeName []) Then {
_backpackClass = _backpackClass call bis_fnc_selectRandom;
};
_this forceaddUniform _uniformClass;
_this addVest _vestClass;
_this addBackpack _backpackClass;

//Add loaded Magazines
{_this addMagazine _x} forEach (_primary select 2) + (_secondary select 2) + (_handgun select 2);

//Add weapons
_primaryWeapon = _primary select 0;
_secondaryWeapon = _secondary select 0;
_handgunWeapon = _handgun select 0;
if (typeName _primaryWeapon == typeName []) Then {
_primaryWeapon = _primaryWeapon call bis_fnc_selectRandom;
};
if (typeName _secondaryWeapon == typeName []) Then {
_secondaryWeapon = _secondaryWeapon call bis_fnc_selectRandom;
};
if (typeName _handgunWeapon == typeName []) Then {
_handgunWeapon = _handgunWeapon call bis_fnc_selectRandom;
};

{_this addWeaponGlobal _x} forEach [_primaryWeapon, _secondaryWeapon, _handgunWeapon];

//Add weaponAccessories
removeAllPrimaryWeaponItems _this;
removeAllHandgunItems _this;
{_this addPrimaryWeaponItem _x} forEach (_primary select 1);
{_this addSecondaryWeaponItem _x} forEach (_secondary select 1);
{_this addHandgunItem _x} forEach (_handgun select 1);


//Add container inventory
{_this addItemToUniform _x} forEach (_uniform select 1);
{_this addItemToVest _x} forEach (_vest select 1);
{_this addItemToBackpack _x} forEach (_backpack select 1);

//Add gear
_headgear = _gear select 1;
_goggles = _gear select 2;
if (typeName _headgear == typeName []) Then {
_headgear = _headgear call bis_fnc_selectRandom;
};
if (typeName _goggles == typeName []) Then {
_goggles = _goggles call bis_fnc_selectRandom;
};

{_this linkItem _x} forEach (_gear select 0);
_this addHeadgear _headgear;
_this addGoggles _goggles;
_this addWeaponGlobal (_gear select 3);

[unit] call IOT_fnc_initClassLoadout. Assigns loudout to a unit based on its faction/class. Requires IOT_fnc_loadInventory to function.

_unit = _this select 0;

if (_unit getVariable ["IOT_Loadout","AUTO"] isEqualTo "AUTO") Then {

_faction = faction _unit;

_CfgFactions = ["CfgClassLoadouts"] call bis_fnc_getCfgSubClasses;

if (_faction in _CfgFactions) Then {
	_class = typeOf _unit;
	_data = ["CfgClassLoadouts",_faction,"data"] call bis_fnc_getCfgDataArray;

	_loadout = [_data,_class,""] call BIS_fnc_getFromPairs;

	if (_loadout != "") Then {
		[_unit,_loadout] call IOT_fnc_loadInventory;
	};

	if (_loadout == "CIV_U") Then {
		_unit call IOT_fnc_randomizeCivGear;
	};
};
} else {
_loadout = _unit getVariable ["IOT_Loadout",""];

if (_loadout != "") Then {
	[_unit,_loadout] call IOT_fnc_loadInventory;
};

};

Edited by ted_hou

Share this post


Link to post
Share on other sites

Man it still doesn't work for me other than in the edit where do you want me to paste this thing that Arsenal is giving me other than in the editor?

You mean while I am still in Zeus? I did that and it's still the same nothing happened nothing changed when I load the mission again...

please help me man...

Edited by Mopsmaster

Share this post


Link to post
Share on other sites

Thanks a bunch for this too, it's probably the best solution to this i've seen so far. Will give it a try for sure.

Is there no way to create a new unit type easily that could be spawned via Zeus? Like instead of overriding a unit class just creating a new one that has the desired loadout? It sounds simple but i'm sure it's not, haha.

Hopefully with the new expansion and eventual full 3d editor, we can get some more support for this kind of thing.

Share this post


Link to post
Share on other sites

Soulis do you know where shall I paste the script of loadout for my soldier to be saved with it? Is it while im still in Zeus? In the Init window? Cuz it doesn't seems to save for me.... how do I save it after that? Please help me

Also how to export MCC/Zeus into the editor?

Is there any way for me to make the soldiers AIs created in MCC / ZEUS to be just visible in the map editor? Please just answer me that so I could change their loadouts out there cuz it seems there is no other way. :( :( :( :( :(

Please someone help me it seems I can only save my players loadouts only when im editing them in the built- in map editor but not for Zeus/MCC is that right? SO ITS IMPOSSIBLE?

HELP me with that please!!!!!

Edited by Mopsmaster

Share this post


Link to post
Share on other sites

Like instead of overriding a unit class just creating a new one that has the desired loadout?

I suppose you would need to make an addon to have new units in Zeus. But if you're spawning units via script, this would work.

_unit = createGroup west createUnit ["B_Soldier_F",[0,0,0]];
_unit setVariable ["IOT_Loadout","LOADOUTNAME"];
[_unit,"LOADOUTNAME"] call IOT_fnc_loadInventory;

---------- Post added at 09:45 ---------- Previous post was at 09:38 ----------

Man it still doesn't work for me other than in the edit where do you want me to paste this thing that Arsenal is giving me other than in the editor?

You mean while I am still in Zeus? I did that and it's still the same nothing happened nothing changed when I load the mission again...

please help me man...

I don't think loadout changes made in Zeus can be saved when you export a mission with MCC.

The loadout script exported from the arsenal needs to be put it in the "init" field of a unit in the editor. You would have to do this for every unit, though.

Share this post


Link to post
Share on other sites

You could make a script that cycles through all units and assigns them a loadout made in arsenal, based on their class name. Then add an eventhandler that checks every unit placed by zeus, to see if their class should use another loadout. I don't know if this would be compatible with MCC though.

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
Sign in to follow this  

×