• 🏆 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!

Frost Aura thing

Status
Not open for further replies.
Level 6
Joined
Aug 5, 2017
Messages
251
Don't get me wrong. The code works great, but the Invisibility lasts for a few seconds. Is there a way to make it last permanently and can only be turned off if the Hero's life is over 10%?
  • Get them
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Frost Armor (my version)) Equal to True
      • (Percentage life of (Attacked unit)) Less than 10.00
      • One_Time Equal to 0
    • Actions
      • Hero - Create Invisibility and give it to (Attacked unit)
      • Set One_Time = 0
      • Set Attacked_Unit = (Attacked unit)
  • Invisibility
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacked unit) has an item of type Invisibility) Equal to True
          • (Percentage life of (Attacked unit)) Less than 10.00
          • One_Time Equal to 0
        • Then - Actions
          • Hero - Order (Attacked unit) to use (Item carried by (Attacked unit) of type Invisibility)
          • Wait 0.01 seconds
          • Item - Remove (Item carried by (Attacked unit) of type Invisibility)
          • Set One_Time = (One_Time + 1)
        • Else - Actions
  • One Time Per Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to (Unit-type of (Attacked unit))
    • Actions
      • Set One_Time = 0
 
Level 13
Joined
Jul 15, 2007
Messages
763
I think you would need to check periodically to see if your unit is above 10% health in order to remove the invisibility. (e.g. every 0.5 sec, if unit is above 10% HP, remove invisibility).

I assume your "Invisibility" item is basically a Rune that casts Invisibility on your target? You should instead add Permanent Invisibility to the target (if you want it to last forever, and to restore after the unit attacks/uses items/casts spells), or as Damage says, if you want limited one-time invisibility, use the Sorceress invisibility and set its duration to 0.
 
Level 13
Joined
Jul 15, 2007
Messages
763
And that invisiblity item has the permanent invisibility ability? The answer should be the same, setting the duration to 0 means the invisibility does not break when the unit makes actions.

If you want to disable the invisibility, you will still need to check the unit for when it is higher than 10% HP, and then either remove the item or replace it with one that does not have invis.
 
Level 14
Joined
Aug 31, 2009
Messages
775
Well, to put no finer point on it, "Some guy on YouTube" is terrible at making custom spells...

As Marcos said, it'd be much better making it multi-unit instanceable (i.e. any number of units can use the ability and it won't interfere with others using the skill) by using some unit indexing - similar to how I made that Surge skill for you. Indexing is a technique, not a specific resource.
 
Status
Not open for further replies.
Top