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

Buff & Healing

Status
Not open for further replies.
Level 2
Joined
Aug 14, 2019
Messages
21
Hello Hiver, I had been attempting for some time to make a spell which works by casting a buff on a unit, if this unit is slain while it still has the buff all friendly units within 500 range of it will regain 100 health, for some reason this doesn't seem to work. THe trigger specifically checks whether the unit has the buff once its slain and then heals.

I know the healing part occurs/works because I;ve tested it with a different condition, am I doing something wrong?
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
Units don't have any buffs when they die. It would be really nice for Blizzard to keep buffs in on-death events but so far your only options are this:
  • Use a damage detection system to detect fatal damage (after-mitigation damage - unit current hp < 0.406), then check for the buff and do things accordingly.
  • Keep track of all units that have the buff periodically (say every 0.20 seconds) in a unit group. Remove a unit from the group if it no longer has the buff. If a unit dies and it's in the group it (probably) had the buff active so do things accordingly. This method is more resource intensive than the first but this can be mostly mitigated by adding units to the group when the spell is cast on them rather than searching through every unit on the map to see what has the buff.
 
Level 5
Joined
Aug 8, 2019
Messages
113
Units don't have any buffs when they die. It would be really nice for Blizzard to keep buffs in on-death events but so far your only options are this:
  • Use a damage detection system to detect fatal damage (after-mitigation damage - unit current hp < 0.406), then check for the buff and do things accordingly.
  • Keep track of all units that have the buff periodically (say every 0.20 seconds) in a unit group. Remove a unit from the group if it no longer has the buff. If a unit dies and it's in the group it (probably) had the buff active so do things accordingly. This method is more resource intensive than the first but this can be mostly mitigated by adding units to the group when the spell is cast on them rather than searching through every unit on the map to see what has the buff.

This is accurate to my knowledge. I haven't done this for multi-castable spells. But I did it for an ultimate, and the way it worked was it had a trigger that checked every 0.5 seconds if the unit had the buff and gave a bolean true or false and another that fired only if the unit was no longer alive which checked whether the bolean set by the first was true. I multi-castable version of the spell would do the same thing but as Pyrogasm said would allocate units to a unit group. Then have the second trigger fire when they are no longer alive but have their presence in the unitgroup as one of the conditions. If I were you I would first build a simple version of the spell, then make it more complex as to suite your needs. It's much easier to learn triggers step by step.

Also I just thought about another method you could set this up, re-work black arrow (under neutral hostile) or parasite (neutral passive) to summon a dummy unit. Then create a trigger that checks the unit type of a summoned unit, when this dummy is summoned have a trigger heal all friendly units that are close.
 
Level 20
Joined
Aug 29, 2012
Messages
826
Silly idea: does the goblin mine AoE damage on death accept negative values? If so, you could try to change the allowed targets to friendlies, add the ability to the buffed unit and it would theorically trigger a heal.

I doubt that works, but who knows :gg:
 
Level 1
Joined
Aug 20, 2019
Messages
8
This is accurate to my knowledge. I haven't done this for multi-castable spells. But I did it for an ultimate, and the way it worked was it had a trigger that checked every 0.5 seconds if the unit had the buff and gave a bolean true or false and another that fired only if the unit was no longer alive which checked whether the bolean set by the first was true. I multi-castable version of the spell would do the same thing but as Pyrogasm said would allocate units to a unit group. Then have the second trigger fire when they are no longer alive but have their presence in the unitgroup as one of the conditions. If I were you I would first build a simple version of the spell, then make it more complex as to suite your needs. It's much easier to learn triggers step by step.

Also I just thought about another method you could set this up, re-work black arrow (under neutral hostile) or parasite (neutral passive) to summon a dummy unit. Then create a trigger that checks the unit type of a summoned unit, when this dummy is summoned have a trigger heal all friendly units that are close.

The potential this last idea has...is enormous.
In the past I have tried doing things before to get a similar affect, only now do I see the proper way to do this. Thank you for illustrating this
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
EDIT:
I realized that the stuff I posted earlier didn't actually work properly. If you didn't see it then don't worry about it.

@White Wolf
Do what Pyrogasm said and use Bribe's Damage Detection System. It's an awesome tool to have in your map and it's not difficult to use either. I can create a map with an example of your ability using the DamageDetectionSystem, it would be very easy to import into your map.
 
Last edited:
Level 5
Joined
Aug 8, 2019
Messages
113
Here is a very simple way to implement this, I've just tried it with black arrow and it works

Ok I've done it with the black arrow ability being at level 3, so it summons a "Greater Dark Minion"

I've given this Dark minnion the "essence of blight ability" and 100 mana in both the maximum mana amount field and the initial amount field so the unit can cast the spell
upload_2019-8-22_20-13-16.png


Give this unit (Greater Dark Minion) the "essence of blight ability", set the healing value of the ability(essence of blight) to whatever you want

Also set the summoned unit duration field in dark arrow to 3 seconds or so, so the dummy doesn't hang around

upload_2019-8-22_21-29-24.png

Remove the model from the unit so it does not appear in game, do this by going to model file > custom and putting a space there and leaving it empty

upload_2019-8-22_20-16-40.png


Now use this trigger to make the unit cast the healing ability upon its creation
upload_2019-8-22_20-19-59.png


Rework parts of this schematic to get the desired result, best of luck to you
 
Last edited:
Level 2
Joined
Aug 14, 2019
Messages
21
Ok.

I am a bit confused; can you please give me a step-by-step version of how to make this ability so that it heals all friendlies in the area by 100 hit points when your enemy gets slain.
 
Level 5
Joined
Aug 8, 2019
Messages
113
@White Wolf

Alright I will make this as simple as possible…

1. Open up the object editor, go to abilities, go to undead, go to units, select essence of blight and copy it

2. Open up this copied essence of blight (Change the art to whatever you want to), change the Data – Hit Points gained field to 100, change the Data – Maximum Units effected to 100, change the Stats – Cooldown to 10, Finally change the Stats – Mana cost field to 0 (Look at illustration below)

upload_2019-8-23_4-7-35.png


3. Create an invisible dummy unit (plenty of tutorials on this) Just make sure it has no model, set model to custom and leave it blank, and make sure it takes up no room by setting its collision size to 0, maybe making it a flying unit, etc. Give it the reworked essence of blight ability described above

4. Go to object editor, go to abilities, go to neutral hostile, go to units, and copy Black Arrow

Rename it to whatever you want it to be called, set Data – Damage Bonus to 0 (or whatever bonus you want), Set Data – Summoned unit Duration (Seconds) to 3, Set Data – Summoned Unit Type to the invisible dummy unit you created before

upload_2019-8-23_4-7-53.png



5. Create the following trigger

Event = Unit - A unit Spawns a summoned unit

Condition = (Unit-type of (Summoned unit)) Equal to Dummy unit

Action = Unit - Order (Summoned unit) to Undead Obsidian Statue - Essence of Blight

upload_2019-8-23_4-8-17.png



6. Now give your unit the reworked black arrow, make sure it’s on auto cast by putting it in Abilities – Default active ability field


upload_2019-8-23_4-9-2.png
 
Level 2
Joined
Aug 14, 2019
Messages
21
Ok - i got it to work after many tries

is there a way to make the slaying unit regain a bigger amount of health than the other friendlies?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
Added a new version that should do everything you want. It doesn't use a DDS but instead keeps track of the units using Indexing. It isn't a perfect system as it doesn't recycle the indices in a proper fashion but it should work just fine.

I'm happy with it now. Pretty configurable and easy to use. Appears to be bug free as far as I can tell.

To use, first enable "Automatically create unknown variables" in File/Preferences/General in the World Editor. Then Copy and Paste the Heal Ability folder into your map.
Lastly, simply configure the "Heal Ability Setup" trigger to suit your needs:
  • Heal Ability Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Set Ability Information --------
      • Set ha_Ability = Heal Ability
      • -------- - --------
      • Set ha_Buff = Heal Ability
      • -------- - --------
      • Set ha_BuffDuration = 10.00
      • -------- - --------
      • Set ha_AreaOfEffect = 300.00
      • -------- - --------
      • Set ha_HealAmount = 100.00
      • -------- - --------
      • Set ha_HealKillAmount = 200.00
      • -------- - --------
      • -------- The Special Effect that is created at the position of the dying unit (Leave blank if you don't want a Special Effect to play) --------
      • Set ha_SpecialEffectArea = Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
      • -------- - --------
      • -------- The Special Effect that is created on each healed unit (Leave blank if you don't want a Special Effect to play) --------
      • Set ha_SpecialEffectUnit = Abilities\Spells\Other\HealingSpray\HealBottleMissile.mdl
      • -------- - --------
      • -------- The attachment point for SpecialEffectUnit (Won't do anything if SpecialEffectUnit is blank) --------
      • Set ha_SfxAttachmentPoint = origin

Also, to filter out which units you should and shouldn't heal make sure to add conditions to this If Else Statement in the Heal Ability Effect trigger. By default I tried to make it match what most abilities can target so you probably won't have to touch this.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Picked unit) belongs to an enemy of (Owner of TempDyingUnit)) Equal to True
      • ((Picked unit) is alive) Equal to True
      • ((Picked unit) is A structure) Equal to False
      • ((Picked unit) is Mechanical) Equal to False
      • ((Picked unit) is hidden) Equal to False
    • Then - Actions
    • Else - Actions
Edit: Added v.6. Fixed a bug that had to do with the fact that the buff from the Heal Ability had a very slight delay before it was applied (Since the buff is applied by Acid Bomb which uses a Missile). This time just to be sure I tested the ability using 100 Grunts, casting the ability on all of them, and then killing them all, and everything worked.

I think if I used an ability like Slow that instantly puts a buff on the unit instead of having to rely on Acid Bomb this wouldn't have been a problem.
 

Attachments

  • Heal Ability v.6.w3x
    25 KB · Views: 13
Last edited:
Level 1
Joined
Aug 20, 2019
Messages
8
@White Wolf

Alright I will make this as simple as possible…

1. Open up the object editor, go to abilities, go to undead, go to units, select essence of blight and copy it

2. Open up this copied essence of blight (Change the art to whatever you want to), change the Data – Hit Points gained field to 100, change the Data – Maximum Units effected to 100, change the Stats – Cooldown to 10, Finally change the Stats – Mana cost field to 0 (Look at illustration below)

View attachment 331145

3. Create an invisible dummy unit (plenty of tutorials on this) Just make sure it has no model, set model to custom and leave it blank, and make sure it takes up no room by setting its collision size to 0, maybe making it a flying unit, etc. Give it the reworked essence of blight ability described above

4. Go to object editor, go to abilities, go to neutral hostile, go to units, and copy Black Arrow

Rename it to whatever you want it to be called, set Data – Damage Bonus to 0 (or whatever bonus you want), Set Data – Summoned unit Duration (Seconds) to 3, Set Data – Summoned Unit Type to the invisible dummy unit you created before

View attachment 331146


5. Create the following trigger

Event = Unit - A unit Spawns a summoned unit

Condition = (Unit-type of (Summoned unit)) Equal to Dummy unit

Action = Unit - Order (Summoned unit) to Undead Obsidian Statue - Essence of Blight

View attachment 331148


6. Now give your unit the reworked black arrow, make sure it’s on auto cast by putting it in Abilities – Default active ability field


View attachment 331149

For step 6 setting essence of blight as the default active ability is redundant because you have a trigger setting it off
 
Level 1
Joined
Aug 20, 2019
Messages
8
Another thing -isnt the parasite ability much better for this purpose than black arrow

black arrow is meant to add more damage to an attack & will fire every time its caster attacks and has enough mana to cast it

parasite is a regular spell, it can be autocasted too, but not like black arrow ->i think its the better option here
 
Level 5
Joined
Aug 8, 2019
Messages
113
Maybe

I think it's what you prefer

With the created spell black arrow is re-worked to make your unit's killing blows heal you and your allies

The parasite version allows you to cast a buff on a unit which heals you and your allies when the unit is slain

so in this regard parasite is more in-line with White Wolf original intent


but we went the black arrow rather than the parasite route, if you want to explore and experience the alternative be my guest
 
Level 1
Joined
Aug 20, 2019
Messages
8
No thanks. Id rather leave that to someone more resourceful and experience with the editor such as yourself :)
 
Level 2
Joined
Aug 14, 2019
Messages
21
Wait

One thing everyone here is forgetting; It's easy to identify the casting unit when black arrow is used but if we use parasite it will be harder/not possible to identify the caster. So after looking over all this I think black arrow is the better choice
 
Level 1
Joined
Aug 20, 2019
Messages
8
I think you are simply lazy and do not want to experiment with the editor yourself -a solution might just be around the corner
 
Level 5
Joined
Aug 8, 2019
Messages
113
I don't think the parasite route will be impossible, just harder

Also it wouldn't make sense: a unit casts a spell, the slaying of the unit makes all your allies recover hp, but somehow the caster recovers more? I would make much more sense if it was only the caster that recovered hp from this....
 
Level 2
Joined
Aug 14, 2019
Messages
21
Also it wouldn't make sense: a unit casts a spell, the slaying of the unit makes all your allies recover hp, but somehow the caster recovers more? I would make much more sense if it was only the caster that recovered hp from this....

precisely this

Im more than satisfied with the spell you guys helped me develop
 
Level 5
Joined
Aug 8, 2019
Messages
113
The simplest way I can think of is re-working either the frost nova or acid bomb abilities. They both do single target damage as well as AOE

Both produce a buff but if you set the duration of it to 0.01 seconds it will be unnoticeable.

Main difference between the two I believe is that acid bomb allows the caster to “throw” a projectile at the target unit, whereas frost nova simply produces an animation at the target’s location.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,540
@vectorr
For an ability that simple I'd personally use triggers. Find the Hero ability "Channel" and copy and paste it. Channel is a very useful ability, it doesn't actually do anything because it's designed to be used with triggers but it has all sorts of options that you can customize. Channel (hence the name) can be used for Channeling abilities but it can also be made to function like a normal ability.

In this case look for these fields in the Channel ability and change them to this:
Art Duration: 0
Base Order ID: Any orderid that your casting unit doesn't already use (so if your unit has the Shockwave ability then DON'T set this to shockwave)
Disable other Abilities: False
Options: Visible
Target Type: Unit
Then set the Cast Range, Cooldown, Mana, Levels, Tooltips, etc... like you normally would with any ability.

Then one simple trigger and a few variables is all you need:
CastingUnit = Unit variable
TargetUnit = Unit variable
TargetPoint = Point variable
SpellDamage = Real variable
  • Spell Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Set CastingUnit = (Casting unit)
      • Set TargetUnit = (Target unit of ability being cast)
      • Set TargetPoint = (Position of TargetUnit)
      • -------- - -------- ///Note: This is a Comment. I use it to space out the Actions and make things look neat.
      • Set SpellDamage = 200.00
      • Unit - Cause CastingUnit to damage TargetUnit, dealing SpellDamage damage of attack type Spells and damage type Normal
      • -------- - --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 300.00 of TargetPoint) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Not equal to TargetUnit
              • ((Picked unit) belongs to an enemy of (Triggering player)) Equal to True ///Note: Triggering Player in this case is the owner of the casting unit
              • ((Picked unit) is alive) Equal to True
              • ///Note: This is where you Filter the units you do/don't want to target. You can add as many conditions here as you want like "Picked unit is a structure equal to False".
            • Then - Actions
              • Unit - Cause CastingUnit to damage (Picked unit), dealing (SpellDamage / 2.00) damage of attack type Spells and damage type Normal
            • Else - Actions
      • -------- - --------
      • Custom script: call RemoveLocation (udg_TargetPoint)
The Custom Script stuff is used to clean up leaks in the game's memory. Because whenever you store a Point (Like how I set TargetPoint to the position of TargetUnit) it permanently stores this Point into the game's memory until it is removed. The point isn't needed anymore in this trigger so we can destroy it at the very end once we're done using it.

"Custom script: call RemoveLocation (udg_TargetPoint)" - Removes TargetPoint from the memory. Note that "udg_" is a prefix that you have to put before the variables name in this case.
"Custom script: set bj_wantDestroyGroup = true" - Removes the very next Unit Group created below it. That's why I intentionally have it placed above "Pick every unit" because that Action creates a Unit Group and Unit Groups leak just like points do.

If you have ever played a map that gets progressively slower/less fps as the game goes on that probably means the map has a bunch of memory leaks. Read up on this Things That Leak if you want to avoid these problems. The most important thing to remember in my opinion is to get rid of Point leaks. Point leaks are all over the place, for example: "Create 1 Footman at Center of Playable Map area" leaks a point, that point being the center of the map. To fix this leak you want to set "Center of Playable Map area" to a variable like "TargetPoint" and then Create the unit at TargetPoint instead. Then remove TargetPoint via "Custom script: call RemoveLocation (udg_TargetPoint)" like how I do it in the trigger above.
 
Last edited:
Status
Not open for further replies.
Top