Jump to content

Recommended Posts

Hello,

 

I am creating an addon (that includes a bunch of scripts used for making missions) and I am trying to make everything as overridable as possible by the mission maker that will use my addon.

Examples :

- stringtable.xml is overridable

- CfgXXXX or custom configs are overridable (based on tests I've made)

- sqf variables are overridable

 

I couldn't find a way to override functions defined in CfgFunctions (i know functions not defined in CfgFunctions are overridable just like variables but I don't want to use that method).

Also, I would like to be able to override the function by using the exact same name (eg BIS_FNC_ABC => BIS_FNC_ABC, etc) so the change has no impact on the scripts calling the function.

 

Does anyone know if it is possible and how?

 

In the test I made I did the following:

- created a test addon in which I added a CfgFunctions block with 1 function

- created a test mission in which I added THE SAME CfgFunctions block with 1 function as in the addon (I only changed the "file" attribute to make it point to the functions folder inside the mission folder)

- Started game with test addon enabled

- I called the function during the mission with debug console and the radio message displayed was the one from the addon not the one I put in the mission function file

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Hello,

 

I'm today in a similar situation : I want to modify slightly the way a function is working without impacting on any other file. Overriding of a function is exactly what I need. Do you have any new information on this subject ?

Share this post


Link to post
Share on other sites

Yeah, I am in the same boat. I have a fix to the vehicle respawn module, but no way to inject it. There are two ways to solve it. #1 is overwriting BIS functions is no longer allowed. #2 is get BIS to implement the (a) fix. But I can see many related posts on the feedback tracker about the respawn module, some old, some new, some with the exact same problem, but all with no communication from BIS. So I need a third way.

Share this post


Link to post
Share on other sites

I need a solution to this as well. I want to do some changes in BIS_fnc_showRespawnMenu so that I don't have to mess with dependencies to related functions.

Share this post


Link to post
Share on other sites

I found a solution but it only works because I created the addon that contains the functions I want to override :-)

 

My Addon - function ZDB_FNC_COUNTDOWN

if (not ("notfound" isEqualType (uiNamespace getVariable ["CUS_FNC_COUNTDOWN", missionNamespace getVariable ["CUS_FNC_COUNTDOWN", "notfound"]]))) exitWith {_this call (uiNamespace getVariable ["CUS_FNC_COUNTDOWN", missionNamespace getVariable "CUS_FNC_COUNTDOWN"])};

Explanation : the addon function must do the work of checking whether the overriding function exist (with similar name but different tag : CUS_FNC_COUNTDOWN instead of ZDB_FNC_COUNTDOWN).

 

Mission that uses addon can override function ZDB_FNC_COUNTDOWN by declaring the function CUS_FNC_COUNTDOWN

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

×