Jump to content
Sign in to follow this  
1para{god-father}

Add addEventHandle to a Group

Recommended Posts

Is this correct I am trying to add a addEventHandle to the group bu i do not thiunk the EH is being added !?

_enemyCount=12;
_grpbuild1 = [getMarkerPos "dubrovkaspawn", east, _enemyCount] call BIS_fnc_spawnGroup;

_grpbuild1 addEventHandler ["killed", {_this execVM "f\common\f_removeBody.sqf"}];

_grpbuild1 execVM "PlaceInBuilding.sqf";

Thanks

Share this post


Link to post
Share on other sites

Can't add to group, need to add to the individual units of the group instead:

{
  _x addEventHandler ["Killed", {/* .. */}];
} forEach (units _grpBuild1);

Share this post


Link to post
Share on other sites

Well, I guess adding killed event handlers to all units in a group might be quite a bit overkill. In case you wanna execute something as soon as the group is dead, you're probably better off with a simple trigger, counting alive units in a given group or a small fsm doing the same.

And on a second thought: adding killed event handlers to all units in a group might also be problematic if that group changes. For example if other units join that group... A trigger/fsm checking the amount of alive units in a given group would take care of that too.

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  

×