A3-Conquest.Altis / scripts / exportLoadout.sqf
exportLoadout.sqf
Raw
// Visit https://community.bistudio.com/wiki/Arma_3_Respawn for detailed information
// Script Author: R3vo https://community.bistudio.com/wiki/User:R3vo
// Script Edits: Garrus Valkyrin

// If interested in knowing if loadout set to show then re-implement below comments
// ["_conditionShow","true",[""]
// private _conditionShow = format ["show = ""%1"";",_conditionShow];
// private _export = _class + endl + _singleIndent + "{" + endl + _doubleIndent + _displayName + endl + _doubleIndent + _icon + endl + _doubleIndent + _role + endl + _doubleIndent + _conditionShow + endl + _doubleIndent + _uniformClass + endl + _doubleIndent + _backpack + endl;



params [
	["_object",player,[objNull]],
	["_class","",[""]],
	["_displayName","",[""]],
	["_icon","\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa",[""]],
	["_role","",[""]]
];

private _singleIndent = "    ";
private _doubleIndent = "        ";
private _tripleIndent = "            ";
private _class = format ["%2class %1",_class,_singleIndent];
private _displayName = format ["displayName = ""%1"";",_displayName];
private _icon = format ["icon = ""%1"";",_icon];
private _role = format ["role = ""%1"";",_role];
private _uniformClass = format ["uniformClass = ""%1"";",uniform _object];
private _backpack = format ["backpack = ""%1"";",backpack _object];
private _export = _class + endl + _singleIndent + "{" + endl + _doubleIndent + _displayName + endl + _doubleIndent + _icon + endl + _doubleIndent + _role + endl + _doubleIndent + endl + _doubleIndent + _uniformClass + endl + _doubleIndent + _backpack + endl;
private _weapons = weapons _object;
private _primWeaponItems = primaryWeaponItems _object;
private _secWeaponItems = secondaryWeaponItems _object;
private _assignedItems = assigneditems _object;

// From BIS_fnc_exportLoadout START
private _fnc_addArray =
{
	params ["_name","_array"];
	// hint format ["%1 : EXPORT", _name];
	_export = _export + format [_doubleIndent + "%1[] = {%2%3",_name,endl,_tripleIndent];
	{
		if (_x != "") then {
			if (_foreachindex > 0) then {_export = _export + "," + endl + _tripleIndent;};
			_export = _export + format ["""%1""",_x];
		};
	} foreach _array;
	_export = _export + endl + _doubleIndent + "};" + endl;
};

["weapons",_weapons] call _fnc_addArray;
["magazines",magazines _object] call _fnc_addArray;
["items",items _object] call _fnc_addArray;
["linkedItems",[vest _object,headgear _object,goggles _object] + _assignedItems - _weapons + _primWeaponItems + _secWeaponItems] call _fnc_addArray;

// From BIS_fnc_exportLoadout END
_export = _export + _singleIndent + "};";

// Copy formatted output
copyToClipboard _export;
_export