KeyCat 131 Posted February 12, 2007 Anyone got a small example of this command? Can't get it to work and the info currently available on the Wiki is not much help... /KC Share this post Link to post Share on other sites
NeMeSiS 11 Posted February 12, 2007 From the formation.fsm: Quote[/b] ]_enemy = _this findNearestEnemy (position _this); Share this post Link to post Share on other sites
KeyCat 131 Posted February 12, 2007 Hmm, thats close to how I tried it before (used getpos instead), maybe I'm just to tired... Will give another go later. Thanks! /KC Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 12, 2007 You should take notice of this comment on the wiki: Quote[/b] ]Returns the nearest enemy the group knows about, not the true nearest enemy. Returns a null object if the group does not know about any enemies. Share this post Link to post Share on other sites
NeMeSiS 11 Posted February 12, 2007 Does this command have a maximum distance (like nearestobject in OFP)? Otherwise zombie scripts are suddenly *very* easy to make Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 12, 2007 Does this command have a maximum distance (like nearestobject in OFP)? Otherwise zombie scripts are suddenly *very* easy to make Read what I just posted. Share this post Link to post Share on other sites
NeMeSiS 11 Posted February 12, 2007 Does this command have a maximum distance (like nearestobject in OFP)? Otherwise zombie scripts are suddenly *very* easy to make Read what I just posted. Sorry, your post didnt say anything specific about a maximum distance, which is actually quite logical if there isnt a maximum, but i assumed that you just didnt mention anything about it. Share this post Link to post Share on other sites
fasad 1 Posted February 12, 2007 In OFP a unit can not knowAbout any unit that is further away than the viewdistance setting away from any unit in it's group for more than one AI cycle (updates every ~1 second). I assume ArmA would be similar. Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 13, 2007 Does this command have a maximum distance (like nearestobject in OFP)? Otherwise zombie scripts are suddenly *very* easy to make Read what I just posted. Sorry, your post didnt say anything specific about a maximum distance, which is actually quite logical if there isnt a maximum, but i assumed that you just didnt mention anything about it. Yes, as fasad said (which you could have figured out if you put two and two together), findNearestEnemy only works for enemies that the unit knows about. If the enemies are too far away, they can't possibly know about them can they. Share this post Link to post Share on other sites
fasad 1 Posted February 13, 2007 Its not just a "out of sight" issue, it's "out of AI consideration range" too. The reveal command will only help if you execute the findNearestEnemy command before the AI flushes its knowledge. Share this post Link to post Share on other sites
charonos 0 Posted February 13, 2007 The command findnearestEnemy does work somehow, but if you need to apply it on a time-critical basis, you should look for a quicker solution. I have tested this with 2 opposing units standing right next to each other (1 m distance), used a mutual reveal on both of them and still it can take SOMETIMES up to 10 seconds until findnearestEnemy came up with a result other than nullobject.It is unpredictable. Probably due to the same reason why opposing units would not open fire at each other if they are very close to each other, which has been a known bug in OFP already and has not been fixed. Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 13, 2007 Probably due to the same reason why opposing units would notopen fire at each other if they are very close to each other, which has been a known bug in OFP already and has not been fixed. That had nothing to do with seeing the enemy. This was likely caused by minimum range values for weapons, where the AI wouldn't use the weapon if the target's distance was less than their weapon's minimum range. All weapons have minimum ranges too. Share this post Link to post Share on other sites
charonos 0 Posted February 13, 2007 Sounds like a very plausible cause, still i have seen enemies stand around 5-10 meters away from each other and not fire their guns, i assume the minimum range for an M16/Ak47 will probably be something like 1 meter, but who knows. Share this post Link to post Share on other sites
Big Dawg KS 6 Posted February 13, 2007 Sounds like a  very plausible cause, still i have seen enemiesstand around 5-10 meters away from each other and not fire their guns, i assume the minimum range for an  M16/Ak47 will probably be something like 1 meter, but who knows. There are other reasons too, but if they're at least aiming at the enemy then they see them. As for findNearestEnemy, well you said you used reveal but reveal doesn't always work anyway, and even if it does findNearestEnemy only works when the unit knows that the other unit is an enemy, which he might not at first. Share this post Link to post Share on other sites
deanosbeano 0 Posted February 13, 2007 and dont forget the daylight factor i did a test sometime ago and found that without nvgs the magic time for everyone seeing everyone with a decent line of sight and distance was roughly @daylight . at roughly 4.36 am they can see without nvg . of course this is after dark and until 4.6 am they cannot see without nvg. Share this post Link to post Share on other sites
fasad 1 Posted February 13, 2007 Unfortunately that would only be the correct time on one specific day. In ArmA, daylight hours change with the seasons. Share this post Link to post Share on other sites
deanosbeano 0 Posted February 13, 2007 Quote[/b] ]Unfortunately that would only be the correct time on one specific day. In ArmA, daylight hours change with the seasons. a little pedantic dont you think ? considering i put at roughly 4.36 am they can see i fear your statement is wrong in its current state.it has merrit over a year but you went a little ott with only good for a specific day i think it is correct for a number of months Share this post Link to post Share on other sites
fasad 1 Posted February 14, 2007 Given the high latitude of Sahrani, the time of day with a specific amount of light will change by several minutes per day. In winter it could be 7am before the AI can see. Share this post Link to post Share on other sites
KeyCat 131 Posted February 14, 2007 Just wanted to say thanks for your input guys! Tried it again when not so sleepy and findNearestEnemy works fine As someone already mention I also guess findNearestEnemy is somhow tied to knowsAbout. /KC Share this post Link to post Share on other sites