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

Help with a hero spell

Status
Not open for further replies.
Level 6
Joined
Aug 5, 2017
Messages
251
I'm close to making a spell(autocast) for a hero that allows him to heal units based on the amount of monks owned by the player at the cost of 2 defense. I need 3 monks for this to work,as the hero will heal units, depending on the monks owned by the player, but I solved it myself:
  • Player - Limit training of Monk to 3 for Player 1 (Red)
  • .......................................................................
  • Player - Limit training of Monk to 3 for Player 12 (Brown)
I need help only with the action part, because I can take care of the rest myself.
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
i believe this will do what you're after
make the ability heal nothing and trigger the heal

  • heal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your spell
    • Actions
      • Custom script: set bj_wantDestroyGroup=true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Monk)) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + x amount you want per monk)
 
Level 6
Joined
Aug 5, 2017
Messages
251
I know my code is inefficient, but I think it's the one I want. Besides, I think I did a good job:
  • ToE
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Tear of Enlightment (Autocast)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living Monk units owned by (Owner of (Casting unit))) Greater than 0
        • Then - Actions
          • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + (((Real((Number of living Monk units owned by (Owner of (Casting unit))))) x 2.00) x 100.00))
        • Else - Actions
          • Unit - Set life of (Target unit of issued order) to ((Life of (Target unit of ability being cast)) + 100.00)
I also made the hero heal 100 hit points to a unit if there's no monk around.
Besides, I tested the code myself and works as intended.
 
Status
Not open for further replies.
Top