• 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.

Detecting if unit is invisible / invulnerable

Status
Not open for further replies.
Level 3
Joined
Dec 14, 2008
Messages
41
How can i do this conditions "((Triggering unit) is invulnerable) Equal to True" or "((Triggering unit) is invisible) Equal to True".
 
Level 5
Joined
Oct 17, 2006
Messages
151
I don't think its possible....

What I would do is like set a variable to true (turn it to true when the ability is used) and then after say 30 sec (whenever the invis or invul would go away) i would set it to false. However the invis part wouldn't really work if its like wind walk where you can go uninvis when attacking. That thar wood mays ye up fur gude!
 
Level 17
Joined
Jan 21, 2007
Messages
2,014
I don't think its possible....

What I would do is like set a variable to true (turn it to true when the ability is used) and then after say 30 sec (whenever the invis or invul would go away) i would set it to false. However the invis part wouldn't really work if its like wind walk where you can go uninvis when attacking. That thar wood mays ye up fur gude!

You can always check for the buff of the invisiblilty.
 
Level 6
Joined
Sep 5, 2007
Messages
264
For Invisibility:
IsUnitInvisible(unit, to_player)

For Invulnerability:
GetUnitAbilityLevel(unit, 'Avul') > 0
This is to check for "Invulnerable (Neutral)"
To check to see if unit has an invulnerability buff, just swap 'Avul' for the raw-code of the buff... Press control-D in the object editor.

That should steer you well. :thumbs_up:
 
Level 6
Joined
Sep 5, 2007
Messages
264
Do you mean the "Invulnerable (Neutral)" ability? That also works. And I'm surprised there's no "Unit is Invulnerable equal to True"... Always thought it'd be in the Boolean section.

I thought so too. I swear that I remember something along those lines...

Another way is to store the life of the unit, deal 0.01 damage to it, check if any damage was done, reset the life back to what it was... If no damage was done, then unit is invulnerable, otherwise, it's not.

That IsUnitInvisible() is more effective than just checking the buff... it checks if a given player can see the unit. Meaning an ally returns false, an enemy returns true (unless the unit is attacking, etc).
 
Status
Not open for further replies.
Top