Jump to content
Sign in to follow this  
Big Dawg KS

Initializing BIS Functions Module for Addon Scripts

Recommended Posts

I've never done this before but I'm sure someone has. Is there an easy/proper way to initialize the BIS functions from within an addon initialization script?

Share this post


Link to post
Share on other sites

Example I've used

		class EventHandlers
	{
		init = "[_this select 0] exec ""\rktsu33\scr\common_init.sqs"";_scr = _this execVM ""\ca\Data\ParticleEffects\SCRIPTS\init.sqf"";";
		fired = "_this call BIS_Effects_EH_Fired;";
		killed = "_this call BIS_Effects_EH_Killed;";			
	};

EDIT: SORRY, ignore.

Edited by [APS]Gnat

Share this post


Link to post
Share on other sites

Thanks Gnat but that's not what I meant. I'm asking how to initialize all of the functions in the Functions Module, not how to use BIS eventhandler scripts.

Share this post


Link to post
Share on other sites

The safest way to accomplish that would be to create a BIS Functions Module:

_h=[] spawn
{
   if (isNil "BIS_functions_mainscope" && isServer) then
   {
       _side = createCenter sideLogic;
       _group = createGroup _side;
       _logic = _group createUnit ["FunctionsManager", [0,0,0], [], 0, "NONE"];
   };
};

waitUntil {bis_fnc_init};

// The Functions module is now ready for use

(CBA does this for you, so if your addon depends on CBA ( requiredAddons[]={"cba_main"}; ), you won't have to do this yourself)

Edited by Killswitch

Share this post


Link to post
Share on other sites

Thanks Killswitch. Yea, that's what I was originally planning to do, that is until I realized this...

(CBA does this for you, so if your addon depends on CBA ( requiredAddons[]={"cba_main"}; ), you won't have to do this yourself)

Right you are, but if I ever plan on removing CBA(/XEH) dependency from my addon it'll be good to know the best way to init the functions.

Share this post


Link to post
Share on other sites
Guest

Why the isServer check? It must be initializad by the server only?

Server, Clients and Headless Clients will be able to use the functions?

Thankyou!

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  

×