• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Holy Light with primary dmg - secondary heal

Status
Not open for further replies.
Level 15
Joined
Oct 29, 2012
Messages
1,474
Do you mean the ability of 'Healing' that Omniknight has in Dota? Which deals Damage in AOE and heal in the same time? well, first create an ability of no-target instant:
  • Events
    • Unit - A Unit Starts the effect of an ability
  • Conditions
    • (Ability Being Cast) Equal to Extreme Heal
  • Actions
    • Set Healer = (Triggering Unit)
    • Set Healer_Point = (Position of Healer)
    • -------- Healing The Caster --------
    • Unit - Set Healer's life to ( (Life of Healer) + 300 )
    • -------- Damaging AOE Units --------
    • Custom script: set bj_wantDestroyGroup == true
    • Unit - Pick Every Unit in (Units within Range 400 of Healer_Point matching (Matching Unit) belongs to an enemy of (Owner of Healer) Equal to true) and do multiple actions
      • Loop - Actions
        • Unit - Cause Healer to damage (Picked Unit) dealing...
    • Custom script: call RemoveLocation(udg_Healer_Point)
Afaik this is permanent , so it's MUI :)
I wish this helps
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Make a spell based off "Channel" ability, modify its fields so it targets unit, has description, etc.
Into "Data - Base order ID" set "holybolt", which is the order id of Holy Light spell.

The variables I used are:
- caster, target: variable of type "unit"
- amount: variable of type "real"

  • Holy Light
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Holy Light (Custom)
    • Actions
      • Set caster = (Triggering unit)
      • Set target = (Target unit of ability being cast)
      • Set amount = (200.00 x (Real((Level of Holy Light (Custom) for caster))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (target is Undead) Equal to True
        • Then - Actions
          • Unit - Cause caster to damage target, dealing amount damage of attack type Spells and damage type Normal
        • Else - Actions
          • Unit - Set life of target to ((Life of target) + (0.50 x amount))
      • Special Effect - Create a special effect attached to the origin of target using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
      • Special Effect - Destroy (Last created special effect)
This will make the spell deal "amount" damage to undead unit or 0,5* "amount" as a heal for living units.
Notice the calculation for amount. The function "level of ability for unit" returns an integer, but our "amount" variable is of type "real". To convert integer into real, you need to use the function "Conversion - Convert integer to real".


I left this trigger like this for reason, because I made another trigger, which checks the target of this ability when the caster is ordered to go and cast this spell.
  • Holy Light Check
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(holybolt))
      • (Level of Holy Light (Custom) for (Triggering unit)) Greater than 0
    • Actions
      • Set caster = (Triggering unit)
      • Set target = (Target unit of issued order)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (target belongs to an enemy of (Owner of caster)) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (target is Undead) Equal to False
            • Then - Actions
              • Unit - Order caster to Stop
              • -------- Display error message that you must target Undead units --------
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (target belongs to an ally of (Owner of caster)) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (target is Undead) Equal to True
            • Then - Actions
              • Unit - Order caster to Stop
              • -------- Display error message that you must target Living units --------
            • Else - Actions
        • Else - Actions
This second trigger is the reason why you need to set the "Order ID" for the custom Holy Light to "holybolt", as it is one of the conditions.
This trigger may seem confusing as there are many If/Then/Else-s, but once understood, it is really simple.
1) The trigger checks, if the target is an enemy. If yes, it checks if that target is an undead. If the target is not undead, the spell has been cast on enemy living unit, which is not what Holy Light does, hence the caster will be stopped from even approaching the enemy.
2) The second part uses same logic but for an ally. It checks if the target is an ally and if yes, if it is not undead. If it is undead unit, the caster is stopped.
All you really have to do is put in a custom error message, telling to player that he has to target an undead in case 1), or a living in case 2).
You may want to search the forum/tutorial section for how to make custom error messages.
 
Last edited:
Level 28
Joined
Sep 26, 2009
Messages
2,520
yeah, I see... strange indeed. Just a quick modification should fix it (I tested the fix, so hopefully it will work for you as well).

When you're ordering caster to stop, pause the caster, then order him to stop and after that unpause him. So instead of this:
  • Unit - Order caster to Stop
have it like this:
  • Unit - Pause caster
  • Unit - Order caster to Stop
  • Unit - Unpause caster
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
If pause action is as fast as any function call in c/c++/python/etc., then we speak in about a delay of about 0.00002... if you notice the difference, then you'll probably be the only one.
Apart from this, it pauses only units, not the execution of trigger (which is sequential anyway), so there shouldn't be any problems like with waits for example.
 
Status
Not open for further replies.
Top