Jump to content
Sign in to follow this  
SOLDIER X

event handler question

Recommended Posts

Hi all.

I have searched and searched the forums but cant find an answer.

Is it possible to add a fired event handler and then call a script or set a variable for every unit within a trigger area? I have seen it is possible to add an EH to each member of a group, but can i add it to each unit within a defined area.

i have a long winded solution in operation by adding the EH to each unit individually, but i cant imagine this will be doing the performance of the scenario any good.

please forgive my ignorance but i am a recent convert to the world of ARMA and i am loving it.

many thanks in advance

X

Share this post


Link to post
Share on other sites

It's possible. You just have to remember that EHs are local to the machine you add them on.

Share this post


Link to post
Share on other sites

hi SHK

thanks for the reply, i dont suppose you could give an example of the correct syntax please.

i have a trigger zone called area1 and would like to set a variable say basealert to true if anyone within area1 fires a weapon.

many thanks X

Share this post


Link to post
Share on other sites

Hey thanks Joshii

nice one mate !

edit

been playing about a bit with code and cant get my script to execute.

init.sqf

_tlist = list _areaone;

{_x addEventHandler ["fired",{_this exec "gunfire.sqs"}] } forEach  _tlist;

gunfire.sqf

basealert = true;
publicvariable "basealert";
hint "Enemy units have been alerted by the sound of gunfire";

nothing seems to be happening any help would be great

Regards X

Edited by SOLDIER X
update

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  

×