Warcraft III resources & community, 2003–2006 · archived

IsUnitInvisible

not rated
Submitted by GraterFunctions0 downloads
Many abilities are not supposed to work on invisible units, like trueshot aura doesn't work while the priestess is hiding. This function simply returns if the unit is invisible, hiding etc.

Source

function IsUnitInvisible takes unit whichUnit returns boolean
   return not IsUnitVisible(whichUnit, Player(bj_PLAYER_NEUTRAL_EXTRA))
endfunction

Comments

2
All the Neutral players have permament full vision of the map, presumably to save the processing burden of calculating visibility. So actually any of the neutral players could be used in place of Neutral Extra, I just figured that Extra is the least used player.

For completeness sake I should mention the two ways to break this invisible detection:
1) Give Neutral Extra invisible detection.
2) Make players share vision with Neutral Extra. There is in fact a reason to do this - so that Neutral Extra units can heal (or cast other spells) on allied player units that are hiding.

However given that there are 4 Neutral players it is highly unlikely that all 4 would need 1) or 2). So basically just pathological cases to watch out for ;)
neutral extra is able to see any unit that is not invisible? that's good to know