• 🏆 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] How to create a target-unit spell using a passive spell as a dummy? (Solved)

Status
Not open for further replies.
Level 7
Joined
Jul 17, 2018
Messages
185
Hi everyone, I have a problem with creating a spell using Lightning Shield (As a caster spell) and Health Regeneration Aura (As a dummy spell), I want the unit receiving the spell to heal the units around it. And I don't know how to do it. I know it may sound basic and I'm sorry. XD
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Unfortunately it's not as basic as you'd expect it to be.

  • Cast LS
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Shield
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in LS_Group.) Equal to False
        • Then - Actions
          • Unit - Add Life Regeneration Aura (Neutral) to (Target unit of ability being cast)
          • Unit Group - Add (Target unit of ability being cast) to LS_Group
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (LS Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on LS Loop <gen>
        • Else - Actions
This trigger is Initially OFF by default. It's only on when a unit is affected by Lightning Shield.
  • LS Loop
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LS_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Lightning Shield) Equal to False
            • Then - Actions
              • Unit - Remove Life Regeneration Aura (Neutral) from (Picked unit)
              • Unit Group - Remove (Picked unit) from LS_Group.
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in LS_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
Pretty simple concept, we add the target of Lightning Shield to a Unit Group, add Life Regeneration to it, and then turn on LS Loop.

LS Loop runs every 0.25 seconds, picking each unit in the Unit Group. When it picks a unit, it checks if that picked unit has the Lightning Shield buff. If it no longer has the buff then we know that Lightning Shield has been removed and it's safe to remove Life Regeneration from the unit as well.

We also remove the picked unit from LS_Group (the Unit Group) since we no longer need to keep an eye on it. Then we check if any units are left in the Unit Group. If it's empty then we can turn the trigger off as it's not doing anything and this will help with performance. After all, there's no reason to Pick every unit in LS_Group if we know that LS_Group is empty.
 

Attachments

  • Lightning Shield Example 2.w3m
    17.4 KB · Views: 17
Last edited:
Level 7
Joined
Jul 17, 2018
Messages
185
Unfortunately it's not as basic as you'd expect it to be.

  • Cast LS
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Shield
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) is in LS_Group.) Equal to False
        • Then - Actions
          • Unit - Add Life Regeneration Aura (Neutral) to (Target unit of ability being cast)
          • Unit Group - Add (Target unit of ability being cast) to LS_Group
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (LS Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on LS Loop <gen>
        • Else - Actions
This trigger is Initially OFF by default. It's only on when a unit is affected by Lightning Shield.
  • LS Loop
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LS_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Lightning Shield) Equal to False
            • Then - Actions
              • Unit - Remove Life Regeneration Aura (Neutral) from (Picked unit)
              • Unit Group - Remove (Picked unit) from LS_Group.
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in LS_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions

Oops I thought it was simple, although I more or less understand it, but unfortunately I do not have the updated version, could you pass me the types of variables, please? :cry:
 
Hi everyone, I have a problem with creating a spell using Lightning Shield (As a caster spell) and Health Regeneration Aura (As a dummy spell), I want the unit receiving the spell to heal the units around it. And I don't know how to do it. I know it may sound basic and I'm sorry. XD

Have you tried setting the damage dealt by the dummy Lightning Shield ability to negative values? If that didn't work, then Uncle's solution might be the way to go.
 
Level 7
Joined
Jul 17, 2018
Messages
185
Hello sorry for the delay, I had some urgent business so I was forced to leave my city :goblin_cry:, well I handled it through the idea of the @Uncle and it worked, only the unit that receives the charitable spell does not show it (In the image). On the idea of @MyPad I would do it, but I need those values to be positive and therefore I cannot set it to negative.

@Devalut What is W3exit'ers?

EDIT: I managed to solve the problem of the benefit spell... Thank you very much everyone for your attention. +Rep!! :thumbs_up:
 

Attachments

  • NUMa.png
    NUMa.png
    160.6 KB · Views: 31
Last edited:
Status
Not open for further replies.
Top