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

[Trigger] [How to] Making a unit check / heal

Status
Not open for further replies.
Level 4
Joined
Jun 4, 2009
Messages
52
Hey, I want to have this spell that heals allies for x hp at lvl 1, x hp at lvl 2, etc in 900 range of the triggering unit.

I used the Resurrection as the spell base, because of the effect when casted.
I would also like this effect to happen on the healed allied units (within 900 range).

What I have so far affects all units, and I'm not sure how to make it affect only allied units.

  • Heal
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Unit Group - Pick every unit in (Units within 900.00 of (Position of (Casting unit))) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 900.00)
 
Level 7
Joined
Dec 8, 2008
Messages
243
When you say you used the resurrection spell as the spell base, do you mean, you made a custom spell, based off of the Paladin's Resurrect spell? I think you're after a single target spell, like storm bolt.

Make an integer, then do
  • set <integer name> to (hero level of spell being cast * X)
Then in your for loop, where your setting the life of the unit, have, set life of picked unit to life of picked unit + <integer name>

Remember that in the object manager you can change the special effects of spells, and the spell data. So, you can make it so spells don't perform their actual actions, and you can change things to be how you want them to.
 
Level 7
Joined
Dec 8, 2008
Messages
243
Here. The custom script wont work (since I can never remember it off by heart), but the spell will work.

  • Heal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Set Spell_Heal_PointofCastingUnit = (Position of (Triggering unit))
      • Set Spell_Heal_AmountHealed = ((Level of (Triggering unit)) x 75)
      • Unit Group - Pick every unit in (Units within 900.00 of Spell_Heal_PointofCastingUnit) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(Spell_Heal_AmountHealed)))
      • Custom script: destroyLocation(udg_Spell_Heal_PointofCastingUnit)
Remember to use: A unit Starts the effect of an ability, for the event, otherwise the trigger will fire, but the spell wont drain mana or use the cooldown.
 
Level 4
Joined
Jun 4, 2009
Messages
52
Excuse me, but could you tell me the variable type of the two you used?

Edit:
And how you made the last action.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
use rejuvenation as your healing...

  • Heal
  • Events
    • Unit - A unit starts the effect on ability
  • Conditions
    • (Ability being cast) Equal to Heal
  • Actions
    • Custom script - set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units within 900.00 of (Position of (Casting unit))) and do (Actions)
      • Loop - Actions
        • Set Unit = position of picked unit
        • Unit - Create dummy at Unit
        • Unit - add REJUVENATION ability to last created unit
        • Unit - set level of REJUVINATION of last crreated unit to level of Heal of triggering unit
        • Unit - add 1 second expiration timer to last created unit
        • Unit - Order last created unit to REJUVENATE picked unit
        • Custom script - call RemoveLocation(udg_Unit)
 
Level 4
Joined
Jun 4, 2009
Messages
52
Ok, I can't get this to work.
Can anyone help?

  • Heal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Set Spell_Heal_PointofCastingUnit = (Position of (Triggering unit))
      • Set Spell_Heal_AmountHealed = (((Level of Heal for (Triggering unit)) x 300) + ((Intelligence of (Triggering unit) (Include bonuses)) x 3))
      • Unit Group - Pick every unit in (Units within 900.00 of Spell_Heal_PointofCastingUnit) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) is an ally of (Triggering player)) Equal to True
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(Spell_Heal_AmountHealed)))
            • Else - Actions
              • Do nothing
 
Level 4
Joined
Oct 9, 2009
Messages
50
I have some questions for this spell.

When you cast this ability, do you want to be able to target who you want to heal?

Example: You click spell. You then click on which ally you want to heal. Heal then restores HP to primary target, and heals all nearby friends.

In that case, you need conditions (and probably a new base spell).


  • AoE Heal Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to AoE Heal
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Set Temp_Group = (Units within 400.00 of Temp_Point matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True)))
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 100.00)
          • Floating Text - Create floating text that reads +100 above (Picked unit) with Z offset 60.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 15.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 1.70 seconds
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call DestroyGroup(udg_Temp_Group)
That is a unit spell I made a while ago (there was a damage portion I snipped out). You can disable the Floating Text if you want (I like seeing that it heals, personally). Temp_Point is a Location Variable, Temp_Group is a Unit Group Variable. It is leakless (as far as I know).

If you want to add levels, do something like this:
  • Holy Nova Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (Archbishop) Holy Nova
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Set Temp_Group = (Units within 400.00 of Temp_Point matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Archbishop) Holy Nova for (Triggering unit)) Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 100.00)
              • Floating Text - Create floating text that reads +100 above (Picked unit) with Z offset 60.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 15.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.70 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Archbishop) Holy Nova for (Triggering unit)) Equal to 2
            • Then - Actions
              • Unit Group - Pick every unit in Temp_Group and do (Actions)
                • Loop - Actions
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 100.00)
                  • Floating Text - Create floating text that reads +100 above (Picked unit) with Z offset 60.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 15.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 1.70 seconds
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of (Archbishop) Holy Nova for (Triggering unit)) Equal to 3
                • Then - Actions
                  • Unit Group - Pick every unit in Temp_Group and do (Actions)
                    • Loop - Actions
                      • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 100.00)
                      • Floating Text - Create floating text that reads +100 above (Picked unit) with Z offset 60.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 15.00% transparency
                      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Change the lifespan of (Last created floating text) to 1.70 seconds
                • Else - Actions
      • Custom script: call RemoveLocation(udg_Temp_Point)
      • Custom script: call DestroyGroup(udg_Temp_Group)
Of course, if you don't want Floating Combat Text, then it's a lot shorter (and simpler), just change the values. If you want the AoE to grow bigger per level, you set the Variables inside of the If/Then/Else(Multiple Functions) section, on a per-level basis.

Or do you want the heal to heal the user, and all nearby allies just upon being clicked (like Resurrection is, you don't pick a target)?

Example: You click spell. The unit heals him/herself, and all nearby allies receive health as well.

In that case, you can modify the Obsidian Statue ability, "Essence of Blight", which is an auto-castable AoE heal that restores health to all nearby allies. You can adjust the cost and cooldown to make it balanced, and when you convert it to a Hero Ability, you can change the AoE, cooldown, mana cost, and healing done. Just remember to change the Stats - Levels field.

EDIT: Didn't see your response. Your trigger's condition is incorrect. I would use:

  • Heal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Set Spell_Heal_PointofCastingUnit = (Position of (Triggering unit))
      • Set Spell_Heal_AmountHealed = (((Level of Heal for (Triggering unit)) x 300) + ((Intelligence of (Triggering unit) (Include bonuses)) x 3))
      • Unit Group - Pick every unit in (Units within 900.00 of Spell_Heal_PointofCastingUnit) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((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)) + (Real(Spell_Heal_AmountHealed)))
            • Else - Actions
              • Do nothing
This is because in your condition, you were picking every unit within a range, not picking a player. Thus, "picked player" can't be used, but "picked unit belongs to an ally of (owner of triggering unit)" will work.

Also, your trigger leaks a unit group. Setting the unit group into a variable, like in my example above, then destroying the unit group would be leakless. Your version is only a small leak though, and you probably won't notice it if you don't change it.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
  • Set Spell_Heal_PointofCastingUnit = (Position of (Triggering unit))
  • Set Spell_Heal_AmountHealed = (((Level of Heal for (Triggering unit)) x 300) + ((Intelligence of (Triggering unit) (Include bonuses)) x 3))
    • Unit Group - Pick every unit in (Units within 900.00 of Spell_Heal_PointofCastingUnit) Matching player owner of unit is an ally of triggering unit do (Actions)
      • Loop - Actions
        • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(Spell_Heal_AmountHealed)))
EDIT: btw your trigger has many leaks
 
Level 4
Joined
Jun 4, 2009
Messages
52
Ok, I'm trying this now..
(Reason I'm not using custom script is it causes the trigger to be turned off)
(Still doesn't work)

  • Heal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Set Spell_Temp_Heal_Point = (Position of (Triggering unit))
      • Set Spell_Temp_Heal_Group = (Units within 900.00 of Spell_Temp_Heal_Point matching ((((Matching unit) is A structure) Equal to False) and (((Matching player) is an ally of (Owner of (Triggering unit))) Equal to True)))
      • Set Spell_Heal_AmountHealed = (((Level of Heal for (Triggering unit)) x 300) + ((Intelligence of (Triggering unit) (Include bonuses)) x 3))
      • Unit Group - Pick every unit in Spell_Temp_Heal_Group and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(Spell_Heal_AmountHealed)))
          • Floating Text - Create floating text that reads (String(Spell_Heal_AmountHealed)) above (Picked unit) with Z offset 60.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 15.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 1.70 seconds
 
Level 4
Joined
Oct 9, 2009
Messages
50
"Set Spell_Temp_Heal_Group = (Units within 900.00 of Spell_Temp_Heal_Point matching ((((Matching unit) is A structure) Equal to False) and (((Matching Unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True)))"

Boolean Comparison - Function: Unit - Unit Belongs To An Ally Of Player

Edit: Proper custom script shouldn't disable a trigger. For the variables you have, you will want them to read:
Custom script: call RemoveLocation(udg_Spell_Temp_Heal_Point)
Custom script: call DestroyGroup(udg_Spell_Temp_Heal_Group)

But if it's still causing the triggers to turn off, it's not that important yet. Let's get it working, then we can make it leakless.
 
Level 4
Joined
Jun 4, 2009
Messages
52
Thanks Matt, that helped.
Now, I added a damage to it, but, it kills everything (more damage than health obviously) instead of just enemies.
Any help?
(I didn't finish destroying the temporary variables, because I wasn't sure how to)

  • Heal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Heal
    • Actions
      • Set Spell_Heal_Temp_Point = (Position of (Triggering unit))
      • Set Spell_Heal_Temp_Level = (Level of Heal for (Triggering unit))
      • Set Spell_Heal_Temp_Ally_Group = (Units within 900.00 of Spell_Heal_Temp_Point matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an ally of (Triggering player)) Equal to True)))
      • Set Spell_Heal_Temp_AmountHealed = ((Spell_Heal_Temp_Level x 300) + ((Intelligence of (Triggering unit) (Include bonuses)) x 3))
      • Unit Group - Pick every unit in Spell_Heal_Temp_Ally_Group and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(Spell_Heal_Temp_AmountHealed)))
          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
          • Floating Text - Create floating text that reads (String(Spell_Heal_Temp_AmountHealed)) above (Picked unit) with Z offset 60.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 15.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 1.70 seconds
      • Custom script: call DestroyGroup(udg_Spell_Heal_Temp_Ally_Group)
      • Set Spell_Heal_Temp_Enemy_Group = (Units within ((Real(Spell_Heal_Temp_Level)) x 300.00) of Spell_Heal_Temp_Point matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True)))
      • Set Spell_Heal_Temp_AmountDamage = (50 x ((Level of Heal for (Triggering unit)) x 3))
      • Unit Group - Pick every unit in Spell_Heal_Temp_Enemy_Group and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius ((Real(Spell_Heal_Temp_Level)) x 300.00) at Spell_Heal_Temp_Point, dealing (Real(Spell_Heal_Temp_AmountDamage)) damage of attack type Spells and damage type Normal
          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Undead\RegenerationAura\ObsidianRegenAura.mdl
          • Floating Text - Create floating text that reads (String(Spell_Heal_Temp_AmountDamage)) above (Picked unit) with Z offset 60.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 15.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 1.70 seconds
      • Custom script: call DestroyGroup(udg_Spell_Heal_Temp_Enemy_Group)
      • Custom script: call RemoveLocation(udg_Spell_Heal_Temp_Point)
 
Level 4
Joined
Oct 9, 2009
Messages
50
Ok, so it looks like it's killing everything because you are picking every unit in the group, then doing an AoE damage, so if you have 10 units nearby, 5 friendly ones get healed, but then it does 10 explosions that don't pick friend from foe.

Change the "damage circular area" to just "Cause (Triggering unit) to damage (picked unit).

EDIT: I suggest changing the color of the text between the heal and damage. I personally use Red for damage (color (100.00%,0.00%,0.00%)) and Blue for healing (color (0.00%,100.00%,0.00%)). You can preview what colors the percentages will be when you edit them, but when you have 20 numbers pop up over enemies and allies alike, color distinguishing or +/-s help determine if it worked correctly.
 
Status
Not open for further replies.
Top