• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[General] IsUnitVisible

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,288
Hello, I want to display a floating text if a certain unit is visible, with other words if the unit is within camera range.

My only idea was to create a temp region and calculate the size of it depending on the current camera settings. But that seems both buggy and advanced, any other ideas?

edit1: a second idea would be to calculate the distance between the unit and the center of the camera, however this wont work since my screen is not a square.
 
Just display a floating text if that unit is not in fog of war for player.

If his camera is not looking there he won't see text anyway???
 
The text is following the screen atm, but that's rather pointless if you can't see the unit that the text is "attached" to.

I think checking if the unit is visible for player X isn't good enough in my case, sorry.

You need a combination of IsUnitVisible for the local player and your suggestion on post #1, which is merely this. Just add an extra condition to see whether the unit is in the defined region.

The former will allow you to see if the unit, given that it is within the local player's camera target region, is still visible to the player (e.g. has been hidden with the action Unit - Hide unit or is invisible through spells).
 
Status
Not open for further replies.
Back
Top