malick 0 Posted February 24, 2007 Hi all, I just restarted scripting for a mission and I encounter some troubles using addeventhandler command. I want all units in a group to fire a script when they are killed. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{_x addEventHandler ["Killed", {_this exec {friendly\killed.sqs}}]} forEach units player_group But an error message tells me that a ; is missing before the forEach command. I also tried another syntax that I already used in OFP, with no better results: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"_x addEventHandler [""Killed"", {_this exec {friendly\killed.sqs}}]" forEach units player_group Has anyone got an idea ? Thanks Malick Share this post Link to post Share on other sites
baddo 0 Posted February 24, 2007 Hi, try <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{_x addEventHandler ["Killed", {_this exec "friendly\killed.sqs"}]} forEach units player_group Regards, Baddo. Share this post Link to post Share on other sites
malick 0 Posted February 24, 2007 Thanks Baddo, it works. I thought I had tried this syntax already, but it seems not Malick Share this post Link to post Share on other sites