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

Put attacked units to sleep if their HP is mire than 50%

Status
Not open for further replies.
Level 3
Joined
Apr 18, 2018
Messages
58
Heyo,

I created a trigger that puts all attacking units to sleep if their HP is equal or greater than 50%. My trigger works just fine, however I would like to know how can I change it to Aura skill. I will post trigger here. Would be grateful if you also help me out with possible leaks.

  • Infinite Sleep
    • Events
      • Unit - A unit is Attacked
    • Conditions
      • (Level of Infinite Sleep for (Attacked unit)) greater than 0
      • (Percentage life of (Attacking unit)) greater or equal 50.00
    • Actions
      • Unit - Create 1 Dummy for (Owner of (Attacked unit)) at (Position of (Attacking unit)) facing standard building orientation degrees
      • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
      • Unit - Add Sleep (Infinite Sleep) to (Last created unit)
      • Unit - Order (Last created unit) to Dreadlord (undead) - Sleep (Attacking unit)
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
If Infinite Sleep is an aura that bestows that buff then it will do what you want.

You are leaking a point when you create the dummy: Things That Leak

You’re not setting the level of the dummy sleep ability before casting it, so if it should have variable effects based on the aura level you will need to do that. Buffs can’t have levels so if you want to detect the level from just the buff you’ll need to use a different buff for each level. Then use a series of If blocks to see which buff it is and set the level appropriately.

Don’t use the “unit is attacked” event. It’s exploitable because it fires when the attack starts not when it connects. Instead use a damage detection system like Damage Engine 5.4.2.3 (I believe this was linked in another recent thread of yours).
 
Level 7
Joined
Jul 4, 2007
Messages
249
That is going to put ever unit in a certain area to Sleep? Well, obviously I would need to set an area
No it does exactly the same as the trigger you posted, but not necessarily to the unit that has the ability, but to every unit that bestows the aura.
 
Level 3
Joined
Apr 18, 2018
Messages
58
If Infinite Sleep is an aura that bestows that buff then it will do what you want.

You are leaking a point when you create the dummy: Things That Leak

You’re not setting the level of the dummy sleep ability before casting it, so if it should have variable effects based on the aura level you will need to do that. Buffs can’t have levels so if you want to detect the level from just the buff you’ll need to use a different buff for each level. Then use a series of If blocks to see which buff it is and set the level appropriately.

Don’t use the “unit is attacked” event. It’s exploitable because it fires when the attack starts not when it connects. Instead use a damage detection system like Damage Engine 5.4.2.3 (I believe this was linked in another recent thread of yours).

I didn't set the level of Dummy ability because is it always the same level, it is like an aura for the Boss. Regarding "A unit is attacked trigger", I was thinking on replacing it, so it could be an aura skill (I just could not find proper event that would do that), because so far it puts to sleep units that attack unit with the buff. Will take a look at Things that leak and damage engine.
 
Level 3
Joined
Apr 18, 2018
Messages
58
Yes isn't that what you wanted? Or what is it you want the aura to do exactly? Elaborate.

I will try to elaborate. I created a boss on my map, I want this Boss to put every unit asleep, whose HP is more than 50%, within 900 range. I want it to be an aura skill, however I don''t want it to spread on Boss Guardians, meaning I want only the Boss have that kind of Aura, that affects all the player units.
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
I think it’s not clear what you mean by “aura skill”. Should each unit only be slept when it attacks the boss? Or when it attacks any unit that has the IS buff (bestowed by the boss)? Or should the boss sleep all units in 900 range periodically?
 
Status
Not open for further replies.
Top