2016-06-20 21:12:06 +00:00
|
|
|
/*
|
|
|
|
DMS_fnc_AddWeapon
|
|
|
|
created by eraser1 - based off of BIS_fnc_AddWeapon
|
|
|
|
|
2016-06-28 00:07:18 +00:00
|
|
|
https://github.com/Defent/DMS_Exile/wiki/DMS_fnc_AddWeapon
|
|
|
|
|
2016-06-20 21:12:06 +00:00
|
|
|
Description:
|
|
|
|
Add a weapon to a unit with the right magazines. Magazine class is obtained from the weapon's config.
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
[
|
2016-06-28 00:07:18 +00:00
|
|
|
_unit, // <object> The unit that is to receive the weapon (and magazines).
|
|
|
|
_weapon, // <string> The classname of the weapon to be added.
|
|
|
|
_magazineCount, // <scalar> Number of magazines to be added.
|
|
|
|
_magClassname // <string> (Optional) The classname of the magazine to be added.
|
2016-06-20 21:12:06 +00:00
|
|
|
] call DMS_fnc_AddWeapon;
|
|
|
|
|
|
|
|
Nothing is returned
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (params
|
|
|
|
[
|
|
|
|
"_unit",
|
|
|
|
"_weapon",
|
|
|
|
"_magazineCount"
|
|
|
|
])
|
|
|
|
then
|
|
|
|
{
|
|
|
|
//Add magazines
|
|
|
|
if (_magazineCount > 0) then
|
|
|
|
{
|
|
|
|
private _magazine =
|
|
|
|
if ((count _this) > 3) then
|
|
|
|
{
|
|
|
|
_this select 3
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines")) select 0
|
|
|
|
};
|
|
|
|
|
|
|
|
for "_i" from 1 to _magazineCount do
|
|
|
|
{
|
|
|
|
_unit addMagazine _magazine;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//Add weapon
|
|
|
|
_unit addWeapon _weapon;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
diag_log format["DMS ERROR :: Calling DMS_fnc_AddWeapon with invalid parameters: %1",_this];
|
|
|
|
};
|