stridev 0 Posted March 3, 2009 I need a better way to break out of "never fire" mode and this would be ideal, if anyone knows how. If its not possible, is there a way to detect if any group member has been injured? Currently I've set it up so we're "never fire" until one of us has been killed, but that's not exactly what I want, cuz its often pretty obvious that we're being shot at. This is for a "don't fire unless fired upon" mission, if that wasn't already clear. Thanks for any input. Share this post Link to post Share on other sites
YO 0 Posted March 3, 2009 hi, u may want to try adding a hit EventHandler to your AI or creating a loop that tracks if someone of them are injured, like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_dontFire = true; while {_dontFire} do { { if (damage _x >= 0.1) then {_dontFire = false}; } forEach (units group player); sleep 1; }; (units group player) setCombatMode "Yellow"; Another way, if you don't set the AI behaviour, woud be to wait until it turns to "combat", wich means they've detected an enemy. Share this post Link to post Share on other sites
Namikaze 0 Posted March 3, 2009 Being shot at and being shot have key differences in both terminology and implementation. Being shot is fairly easy to check. Just put a "hit" Event Handler on each person in the squad and have them activate combat mode when the EH triggers. The problem you will encounter here is that sometimes a single shot can deal enough damage to kill a person while bypassing the "hit" event handler. Being shot at is a bit more complicated to check for. You would need to check the area around the group for nearestObjects and try to find a bullet that passes nearby. The problems you will encounter doing this would be that the bullets travel so fast you'd have to be checking nearestObjects almost constantly, and doing that will pretty much lock up the game with near-constant loops. Of course, all of this might go out the window if you're dealing with multiplayer, which I have no experience dealing with. Share this post Link to post Share on other sites
stridev 0 Posted March 6, 2009 Thanks for the help, both of you. I ended up using a combination of hit eventhandlers for everyone and a separate trigger for when we lose a man completely (in case its a headshot or whatever). It works nicely. I still think there must be some way for the AI to know if its being shot at other than checking for bullets around whatever radius. They do it all the time. Anyway, its working the way I need, thanks again. Share this post Link to post Share on other sites