• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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,013
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