Jump to content
killswitch

CBA: Community Base Addons for A2, OA and CO

Recommended Posts

Apologies for the basic question, but this is the first MP mission I am building that makes extensive use of CBA.

I am using quite a few event handlers, but the problem is that if the game starts too soon, CBA hasn't been initialised and some of the EH's are not set up. Is there a way to set up a check in the init.sqf to wait for CBA to initialise before setting up the Event Handlers?

Share this post


Link to post
Share on other sites

Functions should be available before the init.sqf, some features initialize with PostInit, which should be at the init.sqf, normally before starting the game.

But for proper initialization at least a single object should be on the map which is XEH native compatible - otherwise initialization may be delayed until the first such object appears in the mission.

How do you setup the eventhandlers?

Recommended approach for missions would be to add them to description.ext (e.g in this format: http://browser.dev-heaven.net/configclasses/config/Extended_FiredBis_EventHandlers)

Also what CBA functionality is not available?

You can wait for full postinit initialization flag:

waitUntil { SLX_XEH_MACHINE select 8 };

Edited by Sickboy

Share this post


Link to post
Share on other sites

In my init.sqf I have the following...

It's a snippet so there may be missing brackets - it does work!

if (!isDedicated) then {
   // Creates the eventhandler code to run on all machines for the Ammo Box Trigger
["dropAmmo_trigger", {
       diag_log format ["Trigger Created"];
       _trig = createTrigger ["EmptyDetector", _this]; 
       _trig setTriggerArea [5, 5, 0, false];
       _trig setTriggerActivation ["WEST", "present", true];
       _trig setTriggerStatements ["player in thislist", "hint 'Near Ammo Box';0=[] execVM 'jedscripts\pickupammo.sqf'" , "hint 'Not Near Ammo Box'"];
       ["triggerTimer", _trig] call CBA_fnc_globalEvent;
   }] call CBA_fnc_addEventHandler;

   // Timer for the triggers
   ["triggerTimer", {
       nul = [_this] execVM "jedscripts\triggerTimer.sqf";
   }] call CBA_fnc_addEventHandler;
};

then in some code that is fired as a result of an action menu selection, I have the following;

//Calls global event to place a trigger round the ammo box
["dropAmmo_trigger", getpos _AmmoBoxDr] call CBA_fnc_globalEvent;

This creates a trigger area around a dropped ammo box which also has a timer to delete the trigger after 20 seconds.

If, when the game starts the player very quickly drops an ammo box, the trigger is not created because the EH has not yet been set up. If the player waits a few seconds into the game before dropping the box then everything is peachy.

I'll take a look at the link and try waitUntil.

Share this post


Link to post
Share on other sites

Hm those should really work from init.sqf, as long as the condition is met I spoke about earlier.

Have you checked the rpt file for clues? Otherwise you could do some tests with the diag_log command to write some variables/functions to the rpt file, see if they are nil etc.

Also perhaps verify if the init.sqf code has actually ran and completed, perhaps that's what's being waited on?

Share this post


Link to post
Share on other sites

Hi,

Ok, the waitUntil did not work. I tried it in the unit's init ('riflemaninit.sqf' which is execvm'd from the init line of the unit in the editor) and I also tried it immediately before the Event Handlers are set up in init.sqf.

What did work was putting a small sleep (10 seconds) in the 'riflemaninit.sqf' of the unit just before the addaction (it's a CBA addaction by the way). It seems that this gives CBA enough time to load before the addaction becomes available.

Checking the rpt file it seems that CBA is initialised AFTER the units and as there is not much processing done before the game starts, the addiction becomes available to the player before CBA has had a chance to initialise. Anyway, the sleep worked!

You mentioned But for proper initialization at least a single object should be on the map which is XEH native compatible - is there a CBA function module I should be adding to the map? I couldn't see anything relevant other than 'Requires CBA' but this made no difference.

Anyway, my solution although a bit 'sticky tape and plasters' works for now!

Share this post


Link to post
Share on other sites

There is a CBA module you can place, but you shouldn't have to place it normally, unless the units in your mission are not XEH native supported.

Depends on the addons you use. Give it a try.

Please create a ticket with your mission and repro steps, and i'll figure out what's going on :)

Edited by Sickboy

Share this post


Link to post
Share on other sites

Discover that XEH can't deliver the extra new ArmA2 FIRED EH parameters

Routed via XEH, below code doesn't work;

_b = _this select 6;

Have to go back to the old code;

_b = nearestObject [_u, _this select 4];

XEH not flexible for engine changes?

Anyone else confirmed above?

Share this post


Link to post
Share on other sites

Extended_Fired_EventHandlers:

_this select 5 = Projectile
_this select 6 = Magazine

Extended_FiredBis_Eventhandlers:

_this select 5 = Magazine
_this select 6 = Projectile

http://dev-heaven.net/projects/cca/wiki/Extended_Eventhandlers#New-in-303-Extended_FiredBIS_Eventhandlers-and-support-for-addons-that-do-not-support-XEH

XEH had projectile in the fire eventhandler already in A1, BIS implemented one in A2 patch 1.08/1.55 :)

:D Ninja'd by Xeno!

Edited by Sickboy

Share this post


Link to post
Share on other sites

That prior post hard forms an "answer" Xeno

Thanks SB.

Any idea when was those changes were done?

...... unclear if its available in the I44 mod where I'm trying to make content.

BTW, any chance the "handleDamage" XEH will become functional?

EDIT:

Thanks!

For FIRED _this select 5 works nicely!

Edited by [APS]Gnat

Share this post


Link to post
Share on other sites
Gnat;2008161']

BTW' date=' any chance the "handleDamage" XEH will become functional?[/quote']

Not really as the result of one HD EH would overwrite another HD EH result.

Means, when one HD EH returns 0 and another one _this select 2 things go wrong.

Xeno

Share this post


Link to post
Share on other sites

3.03 (Nov 09, 2010)

But in all available XEH versions, inside Extended_Fired_Eventhandlers you'll find Projectile available in _this select 5 instead of 6.

So you can always use that if needed. But their version is probably newer anyway so you can safely use Extended_FiredBis_Eventhandlers.

BTW, any chance the "handleDamage" XEH will become functional?
Currently there are no plans to support handleDamage or handleHeal because of their internal workings inside the engine, and the complexity involved with multiplexing the event.

By default, if multiple handleDamage eventhandlers are attached, only the last one's return value will actually do something to the unit, and all earlier attached handler output is discarded.

If we'd multiplex this, it would also mean changed behaviour - all the handlers should have effect, and then things start to become rather messy, as most of the handlers will not be aware of eachother, probably causing unforseen issues.

There are no other handlers that behave this way other than keyHandlers (kinda).

Edited by Sickboy

Share this post


Link to post
Share on other sites

Ok, thanks for the explanations on handleDamage.

..... just trying to roll everything in via XEH to keep a standard.

I will just make it the exception then.

Share this post


Link to post
Share on other sites

Hey Guys,

New to scripting and coding I'm begining to discover just how incrediable the CBA package really is and how so many commands functions that appear to be essential were not within arma already. Thank you for such an extensive support package.

Anyhow my question is about using the Global Execute Function. I have used it to apply a sound sample to my missions support menu as demonstrated below:

 [-1, {_man = _this select 0; _man say "MySound"; }, [player]] call cba_fnc_globalExecute;

Using this appears to work fine across a MP game and all players hear the file.

But, I also want to loop a short sample for a continuous duration of 10 mins.

How would i do this using a variation above command to send the sound to all MP players?

Regards BP

Share this post


Link to post
Share on other sites

For generic scripting assistance, please refer to the Mission Scripting & Editing forums http://forums.bistudio.com/forumdisplay.php?f=93

A note about global execute; it is only intended for debugging purposes because you are sending code over the network which is a waste of bandwidth.

You should instead use:

http://dev-heaven.net/docs/cba/files/events/fnc_addEventHandler-sqf.html

http://dev-heaven.net/docs/cba/files/events/fnc_globalEvent-sqf.html

These only send parameters over the network while the code is locally attached as eventhandler.

Edited by Sickboy

Share this post


Link to post
Share on other sites

Very nice Sickboy. So I take it that, given time, all other mods that utilise CBA/XEH could be converted to this performance enhancement ?

Share this post


Link to post
Share on other sites
Very nice Sickboy. So I take it that, given time, all other mods that utilise CBA/XEH could be converted to this performance enhancement ?
Ty :) Hope you all are enjoying the boost :)

The enhancements are available out of the box for XEH events for any addon, incl bis modules, and for the BI Functions Module and all mods that make use of those (CBA, ACE, ACRE etc).

Any script, not rapified mission or unbinarized addon config using CBA macros will automatically benefit as well, binarized addon configs need to be rebinarized to enjoy the benefits.

Other mods can benefit from it if they start using CBA macros or directly the functions related to caching.

Some more minor improvements are included with the dev build tomorrow, and some more planned for later.

Share this post


Link to post
Share on other sites

I'm hoping you gents could give me pointers as to where I can resolve an issue with the following error being received after updating CBA, ACE etc today

This issue crops up when selecting a mission from our mission selection screen (shortly after selecting the player slot, and selecting continue)

Script Extended_EventHandlers\Init.sqf not found

ACE 502

CBA 163

ACEX 341

ACRE 1.3.7 [build 439]

Any idea's/pointers as to where I should be looking to resolve this I'd appreciate it.

Edited by LondonLad

Share this post


Link to post
Share on other sites
Please create a ticket with rpt file, repro mission, and we should be able to tell what's up pretty quickly; http://dev-heaven.net/projects/cca/issues/new

Thank you Sickboy.

I neglected to state that we also run our own mod (with various other 'mods' within).

We think we've identified it down to RKLS (possibly the Merlin) - We'll contact the RKLS chaps to see if anything can be done :)

Thank you for response!

Share this post


Link to post
Share on other sites

I would argue people shouldn't refer the XEH script files directly, but on the other hand it is easy to add some backwards compatibility for it.

I shall have a look and see what I can add before the release tonight.

---------- Post added at 10:40 ---------- Previous post was at 10:36 ----------

Yep found em;

C:\Temp\rksl\rksl\rksl-lynx-ah\s\RKSLlynx_ah7Init.sqf
If (isClass (configFile >> "Extended_EventHandlers")) Then
	if (IsNil "RKSL_ExtendedInit") then {RKSL_ExtendedInit=Compile PreProcessFile "\Extended_EventHandlers\Init.sqf"};
2 matches in C:\Temp\rksl\rksl\rksl-lynx-ah\s\RKSLlynx_ah7Init.sqf
C:\Temp\rksl\rksl\rksl-lynx-se\s\RKSLlynx_ah7seInit.sqf
If (isClass (configFile >> "Extended_EventHandlers")) Then
	if (IsNil "RKSL_ExtendedInit") then {RKSL_ExtendedInit=Compile PreProcessFile "\Extended_EventHandlers\Init.sqf"};
2 matches in C:\Temp\rksl\rksl\rksl-lynx-se\s\RKSLlynx_ah7seInit.sqf
C:\Temp\rksl\rksl\rksl-system\s\RKSLSystem.sqf
If ((isClass (configFile >> "CfgPatches" >> "asr_rksl_arma2_xeh")) And (isClass (configFile >> "Extended_EventHandlers"))) exitWith {};
If (isClass (configFile >> "Extended_EventHandlers")) Then
RKSL_ExtendedInit=Compile PreProcessFile "\Extended_EventHandlers\Init.sqf";
3 matches in C:\Temp\rksl\rksl\rksl-system\s\RKSLSystem.sqf
C:\Temp\rksl\rksl\rksl-system\s\RKSLVersionErrorDlg.sqf
_CurrVer=GetNumber (configFile >> "CfgPatches" >> "Extended_EventHandlers" >> "SLX_XEH2_Version");
1 match in C:\Temp\rksl\rksl\rksl-system\s\RKSLVersionErrorDlg.sqf
C:\Temp\rksl\rksl\rksl-typhoon\s\RKSLhandler_Init.sqf
	If (isClass (configFile >> "Extended_EventHandlers")) Then
		RKSL_ExtendedInit=Compile PreProcessFile "\Extended_EventHandlers\Init.sqf";
2 matches in C:\Temp\rksl\rksl\rksl-typhoon\s\RKSLhandler_Init.sqf
TOTAL:    11 matches in 6 files  (146 other files without matches are not listed)

Will add backwards compatibility init.sqf

Share this post


Link to post
Share on other sites
I would argue people shouldn't refer the XEH script files directly, but on the other hand it is easy to add some backwards compatibility for it.

I shall have a look and see what I can add before the release tonight.

---------- Post added at 10:40 ---------- Previous post was at 10:36 ----------

Yep found em;

C:\Temp\rksl\rksl\rksl-lynx-ah\s\RKSLlynx_ah7Init.sqf
If (isClass (configFile >> "Extended_EventHandlers")) Then
	if (IsNil "RKSL_ExtendedInit") then {RKSL_ExtendedInit=Compile PreProcessFile "\Extended_EventHandlers\Init.sqf"};
2 matches in C:\Temp\rksl\rksl\rksl-lynx-ah\s\RKSLlynx_ah7Init.sqf
C:\Temp\rksl\rksl\rksl-lynx-se\s\RKSLlynx_ah7seInit.sqf
If (isClass (configFile >> "Extended_EventHandlers")) Then
	if (IsNil "RKSL_ExtendedInit") then {RKSL_ExtendedInit=Compile PreProcessFile "\Extended_EventHandlers\Init.sqf"};
2 matches in C:\Temp\rksl\rksl\rksl-lynx-se\s\RKSLlynx_ah7seInit.sqf
C:\Temp\rksl\rksl\rksl-system\s\RKSLSystem.sqf
If ((isClass (configFile >> "CfgPatches" >> "asr_rksl_arma2_xeh")) And (isClass (configFile >> "Extended_EventHandlers"))) exitWith {};
If (isClass (configFile >> "Extended_EventHandlers")) Then
RKSL_ExtendedInit=Compile PreProcessFile "\Extended_EventHandlers\Init.sqf";
3 matches in C:\Temp\rksl\rksl\rksl-system\s\RKSLSystem.sqf
C:\Temp\rksl\rksl\rksl-system\s\RKSLVersionErrorDlg.sqf
_CurrVer=GetNumber (configFile >> "CfgPatches" >> "Extended_EventHandlers" >> "SLX_XEH2_Version");
1 match in C:\Temp\rksl\rksl\rksl-system\s\RKSLVersionErrorDlg.sqf
C:\Temp\rksl\rksl\rksl-typhoon\s\RKSLhandler_Init.sqf
	If (isClass (configFile >> "Extended_EventHandlers")) Then
		RKSL_ExtendedInit=Compile PreProcessFile "\Extended_EventHandlers\Init.sqf";
2 matches in C:\Temp\rksl\rksl\rksl-typhoon\s\RKSLhandler_Init.sqf
TOTAL:    11 matches in 6 files  (146 other files without matches are not listed)

Will add backwards compatibility init.sqf

Brilliant! That would be fantastic :)

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

×