Crimson Mage 2 Posted April 19, 2017 Hi, I need help with my mission. I have made voice clips for my characters and I want one of my characters to say a line in the beginning of a mission when they are being shot at. I used to use "Detected By BLUFOR" but it just wouldn't line up correctly. So is it possible for a trigger to be activated when a Independent shoots? Share this post Link to post Share on other sites
beno_83au 1369 Posted April 19, 2017 Yes, but instead of using a trigger, add an event handler of the type "Fired" to the independent units. https://community.bistudio.com/wiki/addEventHandler Share this post Link to post Share on other sites
Crimson Mage 2 Posted April 19, 2017 How would I attach it the independent units? Share this post Link to post Share on other sites
sarogahtyp 1108 Posted April 19, 2017 Show your code of triggers onAct field pleaseGesendet von meinem SUNNY mit Tapatalk Share this post Link to post Share on other sites
beno_83au 1369 Posted April 19, 2017 As an example, in the unit's init field you would have something like: this addEventHandler ["Fired", {code}]; The examples on the wiki are a really good way to work it out, so wrap your head around those and you'll be off to a good start. Then once you think you've got something to work with, post it here with any problems or questions you still have. Share this post Link to post Share on other sites
Crimson Mage 2 Posted April 19, 2017 How do you make it so that the event handler will be triggered when a group or any independent soldier shoot? I just wantit to shoot once. I have tried a array of unit variable names but it did not work. Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted April 19, 2017 Just now, Crimson Mage said: How do you make it so that the event handler will be triggered when a group or any independent soldier shoot? I just wantit to shoot once. I have tried a array of unit variable names but it did not work. Follow the comment from beno_83au above your post. Or show what you have tried already. Cheers Share this post Link to post Share on other sites
pierremgi 4905 Posted April 19, 2017 {_x setVariable ["firing", _x addEventHandler ["Fired", { < your code here>; {_x removeEventHandler ["fired", _x getVariable "firing"]} forEach yourArray; }] ]} forEach yourArray; Why? Because you want to fire just once the code, regardless of the units of your array. Then no more units must trigger this EH and you must remove it on every unit. The only way to identify the good EH to remove, as far as you can have other "fired" EH in addons or else, is to pass it through a variable attached to the unit. That works. Share this post Link to post Share on other sites