Jump to content
holsterbau

Event handler does not seem to work in MP

Recommended Posts

I have a problem with an event handler in my Zeus scenarios. Basically, I want to have a revive system (specifically this one) be applied to units in my map. Though I noticed that the revive system only applies its functions to units at mission start, and not after that. After some tinkering to see how it works, I came up with adding this to my scenario's init.sqf:

gm_m addEventHandler ["CuratorObjectPlaced", {
	[] execVM "AIS\Core\fn_postinit.sqf";
}];

gm_m in this context being the curator module. It worked exactly the way I wanted it to when I tried it out in local MP, so I went ahead. I played a match of the scenario with my friend, thinking it was fixed. However, when he hosted the scenario, it turns out that the event handler does not work at all. Thinking it was some kind of problem with locality of the code being executed, I tried:

gm_m addEventHandler ["CuratorObjectPlaced", {
	[[[], "AIS\Core\fn_postinit.sqf"], "BIS_fnc_execVM", true] call BIS_fnc_MP;
}];

It did not do anything to help. It still worked in local MP, but it does not work when my friend hosts. What is even stranger, still, is that when he was the Zeus, the event handler worked exactly as in my local MP testing. Only when I am the Zeus, and he's the host (and player), does it not work at all. What is this about?

Share this post


Link to post
Share on other sites

The eventhandler might only be firing on the server.

You said init.sqf so that should be fine, but only if you don't have any more code in there that might prevent execution on the server.

 

11 hours ago, holsterbau said:

[[], "AIS\Core\fn_postinit.sqf"], "BIS_fnc_execVM", true] call BIS_fnc_MP;

BIS_fnc_MP has been replaced by remoteExec, and you can use execVM instead of BIS_fnc_execVM.

 

Also I'm not sure if running postInit, and potentially reinitializing all units that exist in the mission on every object the zeus has placed even if it's just a random prop, is a good idea.

Don't have time right now to look into the revive system to see what it's doing.

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

×