RazorX 10 Posted July 21, 2011 I.E. i want to return false (or a number) if the unit is covered behind a building or is behind the observer. I'm currently using knowsAbout but it has some issues like the value still stays highest even if the unit has gone out of the field of view. Any ideas? Share this post Link to post Share on other sites
CarlGustaffa 4 Posted July 21, 2011 You'll have to create such a function yourself, but it's not something you run many times per second as it has a performance impact. Create an object and in a for loop move it from the observer to the target in x number of steps. If the objects position select 2 is more than intended, you have a ray intersect hit and you can exit the loop with "novisual". Share this post Link to post Share on other sites
RazorX 10 Posted July 21, 2011 That's what I thought about, but the tricky part is, this must be executed on many units at the same time. Performance is crucial. But there must be a built-in function for calculating the view of a unit - hell, the game would not work without it :P Share this post Link to post Share on other sites
kylania 568 Posted July 21, 2011 Give your units guns and put them on opposite sides. They'll shoot each other once they can see each other. Once you hear gunfire, you know they can see each other. ;) Share this post Link to post Share on other sites
RazorX 10 Posted July 21, 2011 Give your units guns and put them on opposite sides. They'll shoot each other once they can see each other. Once you hear gunfire, you know they can see each other. ;) Awesome, dude :D Share this post Link to post Share on other sites
galzohar 31 Posted July 22, 2011 Sickboy suggested in another thread to use nearTargets and check for perceived position compared to actual position. So far this solution seems to work rather well for "can see" checks. It will of course think the target is not in LOS if it is too far or behind, not only if it is out of LOS, and might still think it's in LOS if target makes enough noise to get pinpointed. So it's not a true LOS check but it does tell if their group can see the target or not. Share this post Link to post Share on other sites
CarlGustaffa 4 Posted July 22, 2011 Sounds like a good workaround to me. The context I used the approach I described first was to check if artillery could use a low angle trajectory without hitting anything. Share this post Link to post Share on other sites
twirly 11 Posted July 22, 2011 (edited) Works fine for groups of one.... but if the guy is the leader of a group of more than one..... it seems he will know about all the targets that the members of his group knows about....even after they are dead and buried! Just today I had a group leader calling artillery on enemy he clearly could not see.... after the rest of his group was dead. Using a nearestTargets list.... and then knowsAbout values of the targets in that list. There should have been no targets in the list to get a knowsAbout from! Edited July 22, 2011 by twirly Share this post Link to post Share on other sites
maturin 12 Posted July 22, 2011 Groups of the same side will share information silently. Share this post Link to post Share on other sites