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

Question about forcing unit ability

Status
Not open for further replies.
Level 5
Joined
Oct 20, 2019
Messages
60
Hello, i have a question about forcing units to do spells

Right now i have triggered my units to be forced to use spells when attacked and use the spells on the attacker

  • Tauren Shockwave
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Tauren Warrior 9
    • Actions
      • Set VariableSet TaurenShockwave = (Position of (Attacking unit))
      • Unit - Order (Attacked unit) to Orc Tauren Chieftain - ShockwaveTaurenShockwave
      • Custom script: call RemoveLocation(udg_TaurenShockwave)
But i wonder if its possible to force units to use thier spells as soon as A friendly unit is attacked and cast the spell on that attacker

I hope you understand what i mean, i have tried with some various things but with no success

Ty for help
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
  • Ally Is Attacked
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set VariableSet TempPoint = (Position of (Attacked unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 600.00 of TempPoint.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Sorceress
              • ((Picked unit) belongs to an ally of (Owner of (Attacked unit)).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) is an illusion) Equal to False
            • Then - Actions
              • Unit - Order (Picked unit) to Human Mountain King - Storm Bolt(Attacking unit)
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
Unit-type of Picked Unit Equal to Sorceress <-- Set this to the unit that will cast a spell on the Attacker.
Human Mountain King - Storm Bolt <-- Set this to the order string that you want your unit to cast.

Note that this could cause performance problems with a lot of units all attacking at once as this trigger will run A LOT.
 

Attachments

  • Cast Spell On Attacker.w3m
    17.4 KB · Views: 16
Last edited:
Status
Not open for further replies.
Top