TJ_au 0 Posted June 23, 2007 Hi, Is there a simple way to tell if a group is taking fire. Not nessecarily bieng hit but bieng fired at?. Thanks Share this post Link to post Share on other sites
Second 0 Posted June 23, 2007 Suppression scripts which i made have two mechanism to do this. another way is pretty easy and another isn't that easy. (you find them by searching this same section of forums... suppression script pack is the name) Easy way is to make small script that uses 'nearestobject'-command and searches for specific ammo-classnames near the unit/group. If mission hold's large variety of weapons, then each ammo that all those weapons uses need to added to list... Here's one example. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> bullet = nearestObject [(man), "B_545x39_Ball"] ?(bullet distance (man)) < 30: hint "we have been fired upon. Another way is better as it's compatible with each kind fast flying objects. Here's small example, which wont function with only this code sample! And there might be flaws in it, as i edited it to be bit more readible. Also this way doesn't care who shot the bullet, important is the direction where bullet is heading : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> #loop1 _lead = getdir leader _grp _nObject = position leader _grp nearobjects 40 _count = count _nObject #loop2 ?(_count < 0): goto "loop1" ?(_b >= _count): goto "loop1" if ((speed (_nObject select _b)) > 200) then {goto "loop2.1"} _nObject = _nObject - [(_nObject select _b)]; _count = count _nObject; goto "loop2" #loop2.1 ?(sin (getdir (_nObject select _b) - _lead)) > -0.80 and (sin (getdir (_nObject select _b) - _lead)) < 0.80 and (cos (getdir (_nObject select _b) - _lead) > 0.30): _nObject = _nObject - [(_nObject select _b)]; _count = count _nObject; goto "loop2" #Loop3 hint "we have been shot at" Obviously now that i have learned more about ArmA commands i notice that there are couple of things that could have been done differently. If you don't know much about scripting skills, i might help you out with it Share this post Link to post Share on other sites
TJ_au 0 Posted June 24, 2007 The first one works well for what I'm trying to do. Thanks. Share this post Link to post Share on other sites
TJ_au 0 Posted June 25, 2007 Is there a more elegant way to do this. I tried the first method but find it doesn't register quickly enough. However the AI respond almost immediately by lying down. There must be a way of detecting the AI change of state?. Share this post Link to post Share on other sites
Second 0 Posted June 25, 2007 Is there a more elegant way to do this. I tried the first method but find it doesn't register quickly enough. However the AI respond almost immediately by lying down. There must be a way of detecting the AI change of state?. It registrates bullets quickly if used with script and checking for every 0.001 seconds (or something like that) are there bullets near by (bullet is fast so script needs to as fast). If you used it with trigger, then it's not usable as triggers checks it's codition in much slower tempo, only every 0.5 seconds if i remeber it right. Other way: One way is to use <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">behaviour leader == "combat" in triggers condition-field. But it works only when groups behaviour is set to aware. And that trick can't be used to detect just bullets. If they spot enemy or friendly unit is shot and they are aware of it, then their behaviour automatically is set to combat also. So it easily leads to undesired results... usefulness of it is dependant of what you want from it. That way i mentioned before is very good and simple way to detect actual bullets, but it needs a simple script, trigger wont do. One way would be to do it with eventhandlers, but i think that it's more complicated that way (needs scripting too). Share this post Link to post Share on other sites