mr.peanut 1 Posted May 28, 2008 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">waitUntil {not isNull (position _this nearestObject "BulletBase")}; 1) Make the above a one line script 2) execVM the script from a unit's init 3) Approach unit and shoot firearm 4) Watch ArmA hiccup terribly I can replace the above with two scripts. One is: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">while {TRUE} do { Â smb_bullet = (position _this nearestObject "BulletBase"); Â sleep 0.001; }; The other is: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">waitUntil {not isNull smb_bullet}; However, when sleep is set long enough to not cause a hiccup, the bullet is not always detected. Yes I am trying to catch bullets from the target, not the creation point. Â A recent OFPEC thread about the dammaged event handler got me curious. Now, for the first example, I know that waitUntil is trying check its condition each engine timeslice, and that the condition in question is a resource hog. Is there any way to improve this situation? Share this post Link to post Share on other sites
t_d 47 Posted May 28, 2008 I guess that nearestObject is the problem because it is very slow. You would need to find an alternative faster method to reduce the lag. Share this post Link to post Share on other sites
General Barron 0 Posted May 28, 2008 It might be more efficient to add 'fired' event handlers to all units / vehicles on the map. If they fired somewhat in the direction / vicinity of the player, then you could follow or extrapolate the path of the bullet to see if it goes near the player. Share this post Link to post Share on other sites