Jump to content
Sign in to follow this  
kromka

Virtual Arsenal with ACE3 stuff only when player has this mod

Recommended Posts

I have a mission with MCC and RHS.
There in init.sqf I have Virtual Arsenals with RHS stuff connected to custom box with this command:

{
    [_x, 0] call RHS_fnc_VirtualAmmoBoxUSA
} forEach arsenals;

I don't want to force players to use ACE3 but I wan't to add to the same arsenals additional stuff from it when player has this mod on.

I try to do this in init.sqf with

if (isClass(configFile >> "CfgPatches" >> "ace_main")) then 
{ 
	{ 
		[_x, true] call ace_arsenal_fnc_initBox;
	} forEach arsenals;
}; 

But when mission starts, nothing happen. I've noticed this ace_arsenal_fnc_initBox isn't present on the list of available functions, probably because I didn't add ACE3 to the mod list. However I don't wan't to do this because I want to allow players play this mission without ACE. And so on.
What to do with this? Maybe I should add this detection to initPlayer.sqf?

Share this post


Link to post
Share on other sites

Solution is using this script:

{     
    [_x, 0] call RHS_fnc_VirtualAmmoBoxUSA ;
    
    if (isClass(configFile >> "CfgPatches" >> "ace_main")) then
    {
        [_x] execVM "scripts\addAceGearToContainer.sqf";
    };
} forEach arsenals;
private ["_obj", "_items", "_magazines", "_weapons", "_backpacks"];

_obj = _this select 0;

// sets
_items = [list of items];

_magazines = [list of magazines];

_weapons = [list of weapons];

_backpacks = [list of backpacks];


// add
[_obj, _items, false, false] call BIS_fnc_addVirtualItemCargo;
[_obj, _magazines, false, false] call BIS_fnc_addVirtualMagazineCargo;
[_obj, _backpacks, false, false] call BIS_fnc_addVirtualBackpackCargo;
[_obj, _backpacks, false, false] call BIS_fnc_addVirtualWeaponCargo;

Maybe not super elegant but it works.

  • Like 1

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  

×