Reliable Unit Visibility detection

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Hi there :D I'm back for a bit.

My problem today is that I cannot reliably detect that a unit is visible to a player. If I use IsUnitVisible(unit,player) == true, then it only checks for units within acquisition ranges (which is not an option). If I use IsFoggedToPlayer(unit/x:y,player) == false, it will see units through the fog, but if I use IsFoggedToPlayer(unit/x:y,player) == true, then it only sees fogged units :confused:

I'm really stumped and quite frustrated; it's the only obstacle in the way of my (pretty sexy) AI system. Any useful help is greatly appreciated! Big mention in the final map if you can come up with a solution.
 

LurkerAspect

Now officially a Super Lurker
Reaction score
118
Found a solution:

I simply created a dummy unit (with 1500 acquisition range, a melee attack with 1 damage and 2 range, 2000 sight range day&night, locust, and belongs to the owner of the AI unit) and attached it to the struct of my AI unit. Whenever a 'scan' is performed, the dummy is moved ahead of the unit to 'look' for targets. It works very well. With this system, IsUnitVisible works perfectly. The scan is only performed 1 time per second, so it's very light on system resources.

I'm open for any simpler (and working) suggestions though.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top