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

Adding a Taunt Effect to a spell?

Level 1
Joined
Mar 3, 2024
Messages
1
I am working on a single player rpg map. A character has an ability based off of Locust Swarm. The effect I want to add to this ability is when the Locust attacks a target, it taunts the enemy to attack the hero. I have made a really simple trigger, but it isn't functioning how I hope.

EVENT - Unit is Attacked

CONDITION - Attacking Unit is Locust

ACTION -
  • Order Attacked Unit to Attack "Hero"
  • Wait 0.01 Second
  • Order Attacked Unit to Attack "Hero"
  • Wait 0.01 Second
  • Order Attacked Unit to Attack "Hero"
  • Wait 0.01 Second
 

Attachments

  • Screenshot (1).png
    Screenshot (1).png
    20.2 KB · Views: 10
Level 12
Joined
Feb 5, 2018
Messages
521
  • Locust taunt
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Locust
    • Actions
      • -------- We should set some max range to prevent odd behaviour --------
      • -------- This should match the spells AoE field or it could +50/-50 around it too --------
      • Set VariableSet LocustRange = 600.00
      • -------- Set locations for the range check --------
      • Set VariableSet LocustLoc1 = (Position of Crypt Lord 0010 <gen>)
      • Set VariableSet LocustLoc2 = (Position of (Damage Target))
      • -------- Check if within a reasonable range --------
      • Set VariableSet LocustDistance = (Distance between LocustLoc1 and LocustLoc2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LocustDistance Less than or equal to LocustRange
        • Then - Actions
          • Set VariableSet LocustTarget = (Damage Target)
          • Unit - Order LocustTarget to Attack Crypt Lord 0010 <gen>
        • Else - Actions
      • -------- Clean up leaks --------
      • Custom script: call RemoveLocation(udg_LocustLoc1)
      • Custom script: call RemoveLocation(udg_LocustLoc2)
There is no reason to use waits, the event response might break. Better to store the unit/units into a variable. I also added an additional range check condition to make the units get taunted within a reasonable range. Altought this might be unneccesary. I tested this a new map and it ran as it should. You can create variables within the trigger editor by pressing CTRL + B or CTRL + L.

Variable types I used:

LocustRange = Real Variable
Locustoc1 and Locustoc2 = Point variables
LocusDistance = Real Variable
LocustTarget = Unit variable
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
  • Locust taunt
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Locust
    • Actions
      • -------- We should set some max range to prevent odd behaviour --------
      • -------- This should match the spells AoE field or it could +50/-50 around it too --------
      • Set VariableSet LocustRange = 600.00
      • -------- Set locations for the range check --------
      • Set VariableSet LocustLoc1 = (Position of Crypt Lord 0010 <gen>)
      • Set VariableSet LocustLoc2 = (Position of (Damage Target))
      • -------- Check if within a reasonable range --------
      • Set VariableSet LocustDistance = (Distance between LocustLoc1 and LocustLoc2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LocustDistance Less than or equal to LocustRange
        • Then - Actions
          • Set VariableSet LocustTarget = (Damage Target)
          • Unit - Order LocustTarget to Attack Crypt Lord 0010 <gen>
        • Else - Actions
      • -------- Clean up leaks --------
      • Custom script: call RemoveLocation(udg_LocustLoc1)
      • Custom script: call RemoveLocation(udg_LocustLoc2)
I really don't think you need the distance check, what odd behavior would it prevent?
 
Top