Jump to content
Devastator_cm

Event Handlers in Config.cpp

Recommended Posts

 Hi Guys,

the init eventhandler defined in vehicle config, runs on each machine at mission start and when object spawned via commands?

How to make it run only on the server? Is there any parameter for it?

Share this post


Link to post
Share on other sites

I already use isserver etc. It behaves fine if vehicle is on the map of mission but if it is created via Zeus (Ares mod on) then init script is not running as far as I see. So question is, is the init eventhandler which is set via config behaves different when unit is spawned or added over EDEN?

Share this post


Link to post
Share on other sites
On 12.10.2018 at 2:48 PM, Devastator_cm said:

So question is, is the init eventhandler which is set via config behaves different when unit is spawned or added over EDEN?

Might be that init event only runs locally on the machine that spawns the vehicle.
Zeus placed objects are initialized on the Players machine. 3DEN placed objects are initialized on the server.

Do you have CBA per chance? CBA's init handler works everywhere.

Share this post


Link to post
Share on other sites

yeah I have dependency to CBA and good hint! I will check the CBA init handler and try to use that one instead of default vanilla init.. And yes, I also suspect the init kicks in by zeus guy instead of Server...

Share this post


Link to post
Share on other sites

Ok now I see another weird thing which I cannot figure out...

In the init file which I call now via CBA Init XEH, I set some variables on the object i.e.  _Submarine setvariable ["Weapon Switches", _WeaponSwitches, true];

When I try to access this variable I can see the value if submarine was already on map at mission start. For the spawned submarines (via zeus interface), the variable is not set and giving back nil value.

In rpt file I actually see that it was set,  when I put in init file following thing 

diag_log format ["%1", _Submarine getvariable "Weapon Switches"];

 

Why variable setting is ignoring the public bit of the command (varspace setVariable [name, value, public])? :(

Share this post


Link to post
Share on other sites

It might be that the object is not initialized enough yet to handle public variables. Maybe use initPost XEH instead.

  • 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

×