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

[Spell] Autocast ability that heals friendly units whenever it deals damage

Status
Not open for further replies.
Level 2
Joined
May 18, 2016
Messages
25
Hello there, I'm having problems trying to make an autocast ability that heals friendly nearby units whenever it deals damage to an enemy. I've tried to do something, however I'm none too skilled when it comes to spell triggers, so it just doesn't work.

Here's what I tried:

  • Smite
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Smite
    • Actions
      • Set Location = (Position of (Triggering unit))
      • Set HolySmiteGroup = (Units within 800.00 of Location matching ((((Matching unit) belongs to an ally of (Owner of (Picked unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • Unit Group - Pick every unit in HolySmiteGroup and do (Actions)
        • Loop - Actions
          • Unit - Create 1 DUMMY 1 for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
          • Unit - Add Holy Light to (Last created unit)
          • Unit - Order (Last created unit) to Human Paladin - Holy Light (Random unit from HolySmiteGroup)
          • Unit - Add a 0.75 second Generic expiration timer to (Last created unit)
      • Custom script: call DestroyGroup(udg_HolySmiteGroup)
      • Custom script: call RemoveLocation(udg_Location)
Mayhaps someone here can aid me?
 
Level 6
Joined
May 20, 2014
Messages
228
I think the 0.75 generic timer might be too short, and also if someone in the group is full health it can't be healed with Holy Light since it only works if the target isn't full health.
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
Make it into something like this:
  • Smite
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Smite
    • Actions
      • Set Location = (Position of (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 800.00 of Location) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + YourValueHere)
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_Location)
This way, it will heal even the unit with full health.
 
Level 2
Joined
May 18, 2016
Messages
25
It works now, but only when manually casting the ability. Autocasting doesn't seem to trigger it. Is there any way to change that?
 
Status
Not open for further replies.
Top