Jump to content
Sign in to follow this  
dmos

How to get a script to dig through the installed mods and extract custom units, etc?

Recommended Posts

How to get a script to dig through the installed mods and extract custom units and weapons? Or check whether specific custom content is installed?

I'm looking to make my sandbox (Deep Sand) more dynamic and involve custom content, but at the same time be compatible with vanilla.

Thanks

-dmos

Share this post


Link to post
Share on other sites

this is how you check for ACE is installed:

if (isClass(configFile/"CfgPatches"/"ace_main")) then {hint "ACE is installed"};

that is the only way i know of, you need to find what "ace_main" should be replaced for with your mod of choise.

usually that is described in readme or something, maybe a bright soul here can post a easy way to locate the "name" by a script or something.

Share this post


Link to post
Share on other sites

I have the following script which checks an array of classnames against installed configs...

// Check for optional addons and add vehicles to correct array.
// checkaddons.sqf

_units = _this select 0;

_UseableUnits = [];

{
   if (isClass(configFile >> "CfgVehicles" >> _x)) then
   {
       _UseableUnits = _UseableUnits + [_x];
       diag_log format ["%1 added to unit array",_x];
   }
   else
   {
       diag_log format ["**********  %1 NOT available  **********",_x];
   };

} foreach _units;
_UseableUnits

I call it using...

_BritRifles = [_BritRiflesPool] call checkaddons;

where...

_BritRiflesPool = ["STKR_BritMTP_R","STKR_BritMTP_SL","STKR_BritMTP_MK","STKR_BritMTP_G","STKR_BritMTP_E","STKR_BritMTP_M","STKR_BritMTP_TL","STKR_BritMTP_S","STKR_BritMTP_AT","STKR_BritMTP_AR","STKR_BritMTP_RL","STKR_BritMTP_LG","STKR_BritMTP_LS","STKR_BritMTP_C"];

It then returns an array of those classnames that exist in the currently running configs.

I can then....

if (count _BritRifles != 0) then {do some stuff with the installed configs};

I am using this to make my own mod of your sandbox mission by the way!! You can have it when it is done!

Share this post


Link to post
Share on other sites

Thanks alot guys. Jedra, I'm looking forward to your mod, good luck with that!

I worked out how I'm gonna do my checks, your examples were very helpful btw:

That's to check if the RH's HK416 mod is installed:

RH_HK416 = isClass (configFile >> "CfgWeapons" >> "RH_hk416");

RH_hk416 is the parent class for the rest of the classes added by the mod. Maybe there's a better way to find the parent class but I found it using inheritsFrom. Then just use RH_HK416 as conditional:

if (RH_hk416) then {};

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  

×