Jump to content
Sign in to follow this  
JacobJ

addeventhandler problem

Recommended Posts

Hey all

in and {} foreach list; I am trying to put an eventhandler (killed). But I have a problem.

I need it only to be run, when west kills the units in the list.

As I have read, the eventhandler killed returns [unit, killer]. But how do I compare the killer with west-side and how do I make the eventhandler only fire, when west kills the unit?

/Jacob

Share this post


Link to post
Share on other sites

Assuming you have the unit that west should kill in _targets array:

{
  _x addEventHandler ["killed", {
        _unit = _this select 0;
        _killer = _this select 1; 
        if (side _killer != west) exitWith {};
        //Do your stuff here.
   }];
} forEach _targets;

Share this post


Link to post
Share on other sites

Thank you very much / Tak mange gange - Just what I needed. Now I just have to get the civilians to be counted right, then I am ready to try out my points system. If you can help me with that too, then try to take a look at this thread.

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  

×