calculor 0 Posted February 9, 2007 Hello all. I was wondering if there was a command to see if shots were fired in a specific area. For instance when a unit ( any unit ) is in a trigger and fires it will activate a squads patrol. Thanks in advance. Share this post Link to post Share on other sites
Lolsav 0 Posted February 9, 2007 Why not using one of the options of the trigger itself, "Detected by EASt/WEST" whatever you want Share this post Link to post Share on other sites
kronzky 5 Posted February 9, 2007 You would need to attach an event handler to each of the relevant units, and you also need a trigger over the active area. The event handler can be done in the init line of the unit: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired","FIRED=true"]This sets a global variable to signal that a shot has been fired. Then, in the trigger, you test for the presence of the unit, as well as for the status of this variable: * Activation: (select side) / Repeatedly * Condition: this && FIRED * On Activation: FIRED=false; hint "shot fired" Share this post Link to post Share on other sites
calculor 0 Posted February 9, 2007 I can't use the detected by option because I only want the trigger to go off if a unit fires. The second suggestion worked perfectly. Thanks. Share this post Link to post Share on other sites
Eda Mrcoch 0 Posted February 9, 2007 You would need to attach an event handler to each of the relevant units, and you also need a trigger over the active area.The event handler can be done in the init line of the unit: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired","FIRED=true"] This sets a global variable to signal that a shot has been fired.Then, in the trigger, you test for the presence of the unit, as well as for the status of this variable: * Activation: (select side) / Repeatedly * Condition: this && FIRED * On Activation: FIRED=false; hint "shot fired" Maybe I am missing something here, but doesn't the trigger get activated even in case when anybody (from the selected side) is present at the trigger area and any other unit with the evendhandler (that might be on the other side of island) fires? IMO there should also be condition if the unit that fired is in thislist of the actual trigger. Share this post Link to post Share on other sites