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

Level 5
Joined
Jan 15, 2018
Messages
128
Seeking to create a spell which cast entangling roots in an area around the Hero. Spell is based on channel

  • RootTendrils
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to |cff228b22Root Tendrils|r (2,1 Ent)
    • Actions
      • Set VariableSet RT_Caster = (Triggering unit)
      • Set VariableSet RT_TempP = (Position of RT_Caster)
      • Set VariableSet RT_UG = (Units within 500.00 of RT_TempP.)
      • Unit Group - Pick every unit in RT_UG and do (Actions)
        • Loop - Actions
          • Set VariableSet RT_TempU = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (RT_TempU is alive) Equal to True
                  • (RT_TempU belongs to an enemy of Player 2 (Blue).) Equal to True
                  • Or - Any (Conditions) are true
                    • Conditions
            • Then - Actions
              • Unit - Create 1 Dummy2 for (Owner of RT_Caster) at RT_TempP facing Default building facing degrees
              • Set VariableSet RT_TempU2 = (Last created unit)
              • Unit - Add Dummy: Entangling Roots to RT_TempU2
              • Unit - Order RT_TempU2 to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
              • Unit - Add a 1.00 second Generic expiration timer to RT_TempU2
            • Else - Actions
          • Custom script: call RemoveLocation(udg_RT_TempP)
          • Custom script: call DestroyGroup(udg_RT_UG)
 
Level 23
Joined
Apr 3, 2018
Messages
460
  • Custom script: call RemoveLocation(udg_RT_TempP)
  • Custom script: call DestroyGroup(udg_RT_UG)
These two lines aren't supposed to run before you are finished picking the units and dummy casting.
Move them so they are no longer inside the "pick every unit" block.

Also you don't need the "and" and "or" blocks for the conditions.
Just put the "is unit alive" and "is unit enemy" conditions straight under the "if-conditions" of your if block.
The normal if block already only works if both conditions are true so you don't need the "and" block, and the "or" block has no conditions inside so it's useless.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
What others said. Here's the final product:
  • RootTendrils
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to |cff228b22Root Tendrils|r (2,1 Ent)
    • Actions
      • Set VariableSet RT_Caster = (Triggering unit)
      • Set VariableSet RT_TempP = (Position of RT_Caster)
      • Set VariableSet RT_UG = (Units within 500.00 of RT_TempP.)
      • Unit - Create 1 Dummy2 for (Owner of RT_Caster) at RT_TempP facing Default building facing degrees
      • Set VariableSet RT_TempU2 = (Last created unit)
      • Unit - Add Dummy: Entangling Roots to RT_TempU2
      • Unit - Add a 0.20 second Generic expiration timer to RT_TempU2
      • Custom script: call RemoveLocation(udg_RT_TempP)
      • Unit Group - Pick every unit in RT_UG and do (Actions)
        • Loop - Actions
          • Set VariableSet RT_TempU = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (RT_TempU is alive) Equal to True
              • (RT_TempU belongs to an enemy of Player 2 (Blue).) Equal to True
            • Then - Actions
              • Unit - Order RT_TempU2 to Night Elf Keeper Of The Grove - Entangling Roots RT_TempU
            • Else - Actions
      • Custom script: call DestroyGroup(udg_RT_UG)
Note how the Custom Script is not inside of the Loop - Actions. You want to clean up your memory leaks when you're doing using them, not WHILE you're using them.

You also only need 1 Dummy unit. Your Dummy unit should be setup in the Object Editor like so:

1) Copy and paste the Locust unit.
2) Change it's Model/Shadow/Attacks Enabled/Movement Type to None and Speed Base to 0.

Now your Dummy unit can cast any number of spells any number of times within the same game frame (assuming those spells don't channel).
 
Level 5
Joined
Jan 15, 2018
Messages
128
Apologies for the delay, ive got a case of editors block. I made the trigger based on your recommendation above, and it will not function still.
Maybe its the dummy unit not casting? Does the cooldown need to be set to 0 on the chosen spell?
I gave the dummy a copy and paste Entagling Roots spell.

  • RootTendrils
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to |cff228b22Root Tendrils|r (2,1 Ent)
    • Actions
      • Set VariableSet RT_Caster = (Triggering unit)
      • Set VariableSet RT_TempP = (Position of RT_Caster)
      • Set VariableSet RT_UG = (Units within 500.00 of RT_TempP.)
      • Unit - Create 1 Dummy2 for (Owner of RT_Caster) at RT_TempP facing Default building facing degrees
      • Set VariableSet RT_TempU2 = (Last created unit)
      • Unit - Add Dummy: Entangling Roots to RT_TempU2
      • Unit - Add a 0.20 second Generic expiration timer to RT_TempU2
      • Custom script: call RemoveLocation(udg_RT_TempP)
      • Unit Group - Pick every unit in RT_UG and do (Actions)
        • Loop - Actions
          • Set VariableSet RT_TempU = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (RT_TempU is alive) Equal to True
              • (RT_TempU belongs to an enemy of Player 2 (Blue).) Equal to True
            • Then - Actions
              • Unit - Order RT_TempU2 to Night Elf Keeper Of The Grove - Entangling Roots RT_TempU
            • Else - Actions
      • Custom script: call DestroyGroup(udg_RT_UG)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
Can a unit without mana cast a spell that costs mana? Can a unit cast a spell that's on cooldown? Can a unit cast a spell on a target that's outside of it's cast range?

Of course the answer to these questions is: No.

All you're doing is creating an unselectable unit and ordering it to cast a spell. It's no different then when you click a unit in-game and do the same. All of the same casting requirements apply -> Mana costs, cooldowns, cast range, area of effect, targets allowed, tech requirements, alliance settings, etc.
 
Top