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

[Solved] Avatar

Status
Not open for further replies.
Level 6
Joined
Jun 1, 2014
Messages
165
So, i want to make Avatar to be usable ONLY if/when the unit (Mountain King) has LESS than 50% life. When he has life greater than 50%, he cannot use it (for balancing purposes in my map). So, how do i do that? How do i have the ability unusable, when the unit has more than 50% life and usable once it has less than 50% life.
Oh, also, when the Avatar's used, the unit's max HP increase for a short/brief period of time, so if it is used at 33% life, with the Avatar on, he will go above 50% life. So i wonder if this can somehow mess up with the trigger(s)?
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,887
You can disable the ability or/and hide it from UI. What's even supposed to happen if it has 40% hp, you enable the avatar ability, he casts it and then gets healed to 70%? Will you disable the ability and let it waste mana and cooldown get triggered? Or just hide it? Do you want it to be visible and not castable? Please be more clear.
 
Level 6
Joined
Jun 1, 2014
Messages
165
It could be visible, but the player can use it (click it or Hotkey it) only once the unit has less than 50% life. Like... the player can see the Avatar ability button, but cannot click it, or even if can, it won't do anything :D
Any can work, i just could not do it myself, but i need it, for balancing purposes in my map. Otherwise, players can just use the Avatar at 100% of Mountain's King life, and go kill him then. The thing is, i want it, the Avatar to feel more like a "last resort" ability or a trick up the sleeve, when it's needed.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Does more than one unit per player have this avatar ability? You can give it a techtree requirement of a unit that you manually create/remove for each player based on how much % health their unit has. This will not work if multiple units per player have the avatar ability.
 
Level 6
Joined
Jun 1, 2014
Messages
165
It's a MOBA map, Only one player can have the dwarf. So it will work, based on your theory. Can you explain to me how to do that?
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Create a unit called "Less than 50% health"; disable its minimap display & attacks, remove its food used/produced, and give it the ability Locust. Then add it to the techtree requirements for Avatar (and make sure "check dependencies" is active for the ability).

  • Events
    • Time - Every 0.50 seconds of game-time
  • Conditions
    • (DWARF has buff Avatar) equal to false //don't change state while the ability is active
  • Actions
    • Set LifePCT = (Percentage life of DWARF)
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • LifePCT less than or equal to 50.00
        • AvatarReqUnit equal to No Unit
      • Then - Actions
        • Set TempPoint = Somewhere on your map that players
        • Unit - Create 1 Less than 50% health for (Owner of DWARF) at TempPoint facing (Default building facing degrees)
        • Set AvatarReqUnit = (Last created unit)
      • Else - Actions
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • LifePCT greater than 50.00
        • AvatarReqUnit not equal to No Unit
      • Then - Actions
        • Unit - Remove AvatarReqUnit
        • Set AvatarReqUnit = (No unit)
      • Else - Actions
You could use a faster frequency than 0.50 if you want but that's probably good enough. If you have a Damage Detection System in your map you could use an event from that too to check for health. Health regen/healing would be trickier though and probably still require a periodic event.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
Pyrogasm's method works pretty good and will have a nice visual effect (disabled icon when unusable) but just for simplicity's sake:

  • Cast Avatar
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Avatar (Test)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Percentage life of (Triggering unit)) Greater than 50.00
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
Edit 2: This will spend mana even though the ability won't be used. Use the "Order" trigger Pyrogasm posted below if you want something similar to this that works.
 
Last edited:
Pyrogasm's method works pretty good and will have a nice visual effect (disabled icon when unusable) but just for simplicity's sake:

  • Cast Avatar
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Avatar (Test)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Percentage life of (Triggering unit)) Greater than 50.00
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop
        • Else - Actions
Edit: Misunderstood your post and deleted some stuff. This should work fine as is.

This will drain the units mana without activating the spell. It can be used if you save the mana to a variable and set the mana of the unit after it has been ordered to stop.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
It's as simple as it sounds.

  • Cast Avatar
    • Events
      • Unit - A unit is issued an order with no target
    • Conditions
      • (Issued Order) equal to Mountain King - Avatar
      • (Level of Avatar (Test) for (Triggering Unit) greater than 0
      • (Percentage life of (Triggering unit)) Greater than 50.00
    • Actions
      • Unit - Order (Triggering unit) to Stop
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
Whoops, forgot about that. Another thing you could do (maybe this is overkill) is set the mana cost of the ability to 0 using the new natives when you begin casting the ability/issue the order. Then set it back to what it's normal value was afterwards.
 
Level 6
Joined
Jun 1, 2014
Messages
165
So many solutions, wow, wonder which to choose. Alright, imma try them all, i was sleeping till now.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
So many solutions, wow, wonder which to choose. Alright, imma try them all, i was sleeping till now.
I'd recommend going with either of Pyrogasm's posts. His first post with timers and requirements will probably look the best.

But the second post with
  • Unit - A unit is issued an order with no target
will be a bit more precise/less performance heavy, although it won't have that cool disabled button effect.
 
Level 6
Joined
Jun 1, 2014
Messages
165
Pyrogasm's solution was the best, and it worked so well! Rep. given, thread can be locked now!
However, one time, during testing, when Avatar was activated, its duration stood filled, altho. after the 60 seconds, the Avatar timed out, so it's no prob., but still, i wonder why that happened. I mean, you know how you can see the bar for duration diminishing with each second, and in this case it stood filled, as if the Avatar had an hour of duration :D .
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
Which method did you use?

Regardless, there's all sorts of weird UI bugs with the new patches. I have the same problem when changing the cooldown of abilities with triggers. Sometimes the cooldown animation doesn't play and if I clear unit selection and re-select the unit it will fix the issue. It's a purely visual bug so I imagine it will eventually be fixed.
 
Status
Not open for further replies.
Top