• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Elegant way for Unit visibility detection

Status
Not open for further replies.
Level 10
Joined
Oct 5, 2008
Messages
355
Hey there,

im currently triggering on an AI for my map and am seeking for a well made way to detect if an invisible unit is visible for a player e.g. through true sight. My current solution is to have all units with truesight possessing an aura which affects eneny units. When im checking for targets, i check if, when the unit is invisible, it has the buff o not.

So, im looking for a more elagant, not aura usibg way to detect revealed invisible units and at best a way which does not involve iterating through all units with true sight.
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
native IsUnitVisible takes unit whichUnit, player whichPlayer returns boolean
A unit that is invisible, but visible to a player is revealed to that player.
 
Level 10
Joined
Oct 5, 2008
Messages
355
Thank you very much. I had discarded that condition, thinking it would only show if a unit is within the vision radius of a unit (and because the map doesnt have fog of war, i wasnt using it...). I really should have tesred that function.

-i mark this as solved then :)
 
Status
Not open for further replies.
Top