Jump to content
Teutch

Set up soft dependencies

Recommended Posts

Hello,


I'd like to add "soft dependencies" to my mod, i.e. dependencies that are not needed to launch the mods

(so that don't put error messages at launch) but allow to view new vehicle retextures when they are added or even replace a weapon of a soldier(/uniform) by an other one from this soft dependency.

 

I know it's possible because some modders follow this very ingenious technique, but I really don't know how to set it up in a config.

Does anyone have any ideas ?

 

Thanks in advance !

 

 

Share this post


Link to post
Share on other sites
13 hours ago, Teutch said:

I know it's possible

...is it? I'm no config expert but I'm not entirely sure it is. Either the mod is dependant upon another one or it isn't.

If you reference an external class from a mod you don't have installed your game wont load - likewise if you set the dependency to a mod you don't have installed you'll get errors on startup saying the mod isn't there. I'm not sure how you could make it a "soft dependency".

What mods have you seen that do this? 

  • Like 1

Share this post


Link to post
Share on other sites

I figured out how it works

So for those like me who want to put dependencies that are not mandatory but functional :

 

You need to put first the line #if __has_include("\...")

before your class CfgVehicles/patches/... related to this optional mod.

(The # is important to make a priority)

 

Between the quotes you must put the path of a file of this mod (no matter what) which will prove that the mod is present when the game is launched.

 

To go further I was looking to ensure that some equipment is replaced when an additional mod is present.

It is therefore enough to use this same line of PreProcessor Commands but then adding "#else" to provide an option without the replacement.

 

I'm not getting too far ahead, I'll try it quietly and I'll come and confirm later if everything works well.

 

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, Teutch said:

I figured out how it works

So for those like me who want to put dependencies that are not mandatory but functional :

 

You need to put first the line #if __has_include("\...")

before your class CfgVehicles/patches/... related to this optional mod.

(The # is important to make a priority)

 

Between the quotes you must put the path of a file of this mod (no matter what) which will prove that the mod is present when the game is launched.

 

To go further I was looking to ensure that some equipment is replaced when an additional mod is present.

It is therefore enough to use this same line of PreProcessor Commands but then adding "#else" to provide an option without the replacement.

 

I'm not getting too far ahead, I'll try it quietly and I'll come and confirm later if everything works well.

 

Having read the link you provided I had noticed the author has posted about '#if __has_include()' and was about to suggest that is where you start looking into, but you're already on that track so there we go...

  • Like 1

Share this post


Link to post
Share on other sites

A small detail I'd like to add :

remember to add an #endif at the end of the command.

Share this post


Link to post
Share on other sites

I'm not familiar with these preprocessor commands. I never succeeded in making them work (but #include as basic in .cpp or .hpp)

Do you have any full example?

 

I always use a workaround with sqf commands like:
if ("SPE" in configSourceModList (configfile >> "CfgPatches")) then {...};

 

See also: configSourceAddonList

 

 

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/CfgPatches

// Optional. If this is 1, if any of requiredAddons[] entry is missing in your game the entire config will be ignored and return no error (but in rpt) so useful to make a compat Mod (Since Arma 3 2.14)
skipWhenMissingDependencies = 1;

 

  • 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

×