• 🏆 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] How to make Firebolt heal the caster when it does damage

Status
Not open for further replies.
Level 8
Joined
Mar 15, 2007
Messages
230
Hey all, I have a question. I have a hero ability in my map called "Death Touch" that is based on Firebolt, and I want it to heal the caster when the projectile impacts the target. The amount healed is equal to the amount of damage done by the projectile. It's basically a spell that works like Death Coil from WarCraft II. Any help is much appreciated. Thanks!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Either use a Damage Engine and heal the source of the damage or heal the caster when it casts the spell (this method will heal the caster before the firebolt reaches it's target).

  • Events:
  • A unit starts the effect of an ability
  • Conditions:
  • Ability being cast equal to Firebolt
  • Actions:
  • Set life of triggering unit to life of triggering unit + X
X = the damage of fireball.
 
Level 8
Joined
Mar 15, 2007
Messages
230
I'm going to be using this damage engine by Bribe: Damage Engine 5.5.0.0

I must say that after testing, this thing is much easier to use than it first appeared. There's one problem with my triggers though. I have it set so that when the caster (a Death Knight) deals spell damage he gets healed. My only question is, how do I make it detect what ability is doing the damage?
Code:
Death Touch Heal
    Events
        Game - DamageEvent becomes Equal to 1.00
    Conditions
        IsDamageSpell Equal to True
        (DamageEventSource is in (Units of type Death Knight (Empire)).) Equal to True
    Actions
        Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + DamageEventAmount)
        Special Effect - Create a special effect attached to the chest of DamageEventSource using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
        Special Effect - Destroy (Last created special effect)
        Special Effect - Create a special effect attached to the chest of DamageEventTarget using Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
        Special Effect - Destroy (Last created special effect)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
I don't believe there's any built in method of doing this through the system, at least with abilities that have a missile/delayed damage.

However, a method I've used before was to create a unique Dummy unit and have it cast the damaging ability instead. This way if Unit-Type of DamageEventSource is equal to "Firebolt Dummy" it was obviously damage from the Firebolt spell since this Dummy would be dedicated to using that 1 ability. Then link the Dummy to it's Death Knight, this way you can reference the Death Knight in the Damage Event trigger.

So how to do it:
1) You create a unique Dummy unit that's dedicated to casting Firebolt.
2) Then you link the Death Knight to the Dummy (Unit Indexer does this easily). This way you can reference the casting Death Knight when detecting that the Dummy dealt damage.
3) Detect when the Dummy deals damage and change the DamageEventSource to it's linked Death Knight. Use the DamageModifierEvent becomes equal to 1.00 Event for this.

Edit:
Uploaded an example map.

This uses Bribe's Unit Indexer as well. GUI Unit Indexer 1.4.0.0
  • Cast Firebolt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Firebolt (Death Knight)
    • Actions
      • Set VariableSet Firebolt_Point = (Position of (Triggering unit))
      • -------- --------
      • -------- Create the Dummy --------
      • Unit - Create 1 Dummy (Firebolt) for (Triggering player) at Firebolt_Point facing Default building facing degrees
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • -------- --------
      • -------- Link the Death Knight (Caster) to the Dummy --------
      • Set VariableSet UDex = (Custom value of (Last created unit))
      • Set VariableSet Firebolt_DeathKnight[UDex] = (Triggering unit)
      • -------- --------
      • -------- Order Dummy to cast Firebolt --------
      • Unit - Set level of Firebolt (Dummy) for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
      • Unit - Order (Last created unit) to Neutral - Firebolt (Target unit of ability being cast)
      • -------- --------
      • -------- Clean up leaks --------
      • Custom script: call RemoveLocation (udg_Firebolt_Point)
  • Damage Event Modifier
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • -------- This trigger runs BEFORE most calculations are made (armor/etc) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of DamageEventSource) Equal to Dummy (Firebolt)
        • Then - Actions
          • Set VariableSet UDex = (Custom value of DamageEventSource)
          • Set VariableSet DamageEventSource = Firebolt_DeathKnight[UDex]
          • Set VariableSet Firebolt_HealDK = True
        • Else - Actions
  • Damage Event
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • -------- This trigger runs AFTER most calculations are made (armor/etc) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of DamageEventSource) Equal to Death Knight (Test)
          • Firebolt_HealDK Equal to True
        • Then - Actions
          • Set VariableSet Firebolt_HealDK = False
          • Unit - Set life of DamageEventSource to ((Life of DamageEventSource) + DamageEventAmount)
          • Special Effect - Create a special effect attached to the chest of DamageEventSource using Abilities\Spells\Undead\VampiricAura\VampiricAuraTarget.mdl
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
 

Attachments

  • Firebolt Example.w3m
    51.1 KB · Views: 21
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
I forgot to say that if you're already using a Unit Indexer in your map then you shouldn't import the Unit Indexer I provided in this example. (I believe I helped you with a Phylactery Lich thingy and used the same Unit Indexer there as well)
 
Last edited:
Status
Not open for further replies.
Top