Jump to content
Sign in to follow this  
dupa

addEventHandler vs locality

Recommended Posts

Hello all, I'm having locality problems with addEventHandler. I'm trying to make a missile warning script.

_vec addEventHandler ["incomingmissile", {playSound "snd_missile"; player sidechat "Incoming missile!"}];

The wiki says that in ArmA 1 this type of EH is global, but no info for ArmA 2. I assume that it remained the same, from which I conclude that the EH should be triggered when the aircraft is fired upon, no matter on which machine it was added (someone please correct me if I'm wrong).

To make things short:

1. Is this type of EH actually global, and if so, does it mean that I can add it from ANY of the connected machines?

2. Are there any problems with multiple EHs of the same type for the same vehicle? (I do have some of these)

3. When a vehicle is deleted using deleteVehicle, are the EHs destroyed automatically or should I manually remove them prior to deletion?

Thanks in advance.

Share this post


Link to post
Share on other sites

Along the lines of #2 here, I'm running into an issue where I have AI in a group with Group Respawn active. I'm using an addEventHandler "Fired" to remove a weapon once it's been used (one shot m136 solution) and it works fine for the players. The problem is once you respawn into an AI body the eventhandler is no longer active.

I tried re-adding the EH using the onPlayerRespawnOtherUnit event script and absolutely nothing happened, that script never ran.

Is there a problem with adding multiple EH's as dupa asked above? The server adding one to prevent AI from shooting constantly and then the player adding another one to the same unit just with different locality (assuming I can ever figure out how to add it...)?

Share this post


Link to post
Share on other sites

Was the event script an .sqs and called with exec? Some of these refuse to execute as .sqf and execVM. If you try a script called myscript.sqs, it can contain [] execVM "myscript.sqf". I've never toyed with onPlayerRespawnOtherUnit though. I know in the past I've had issues with event scripts, but right now I'm not sure if they were related to being sqf or if the sqf had problems.

Share this post


Link to post
Share on other sites

biki said onPlayerKilled had to be run as SQS, but didn't mention the others, I'll try SQS :)

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  

×