• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Simple Question about AoE spell

Status
Not open for further replies.
Level 7
Joined
Dec 9, 2008
Messages
114
I have created simple spell that damages units in small AoE.
I wanted to do that it would look as a "sword/slash" skill, so it should attack units in front of the casting unit, but it attacks units around him self.
Any suggestions??

  • Events Unit starts casting an ability
  • Conditions (Ability being cast) Equal to <Slash>
  • Actions
  • Set <Damage_AoE> = 125
  • Set <Caster> = (Triggering Unit)
  • Set <Cast_Loc> = (Position of <Caster>)
  • Set <DamagedUnits> = (Units with in <Damage_AoE of (<Cast_Loc>))
  • Unit Group - Pick every unit in <DamagedUnits> and do (Actions)
  • Unit - Cause <Caster> to damage (Picked unit), dealing (Random real number between 50.00 and 100.00) damage of attack type Normal and damage type Normal.
  • ...Etc
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You could also damage units inside a cone shaped area.


  • Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Set u3 = No unit
      • Set u1 = (Triggering unit)
      • Set p1 = (Position of u1)
      • Set r1 = (Facing of u1)
      • Set player = (Owner of u1)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 200.00 of p1 matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of u1)) Equal to True))) and do (Actions)
        • Loop - Actions
          • Set u2 = (Picked unit)
          • Set p2 = (Position of u2)
          • Set r2 = (Angle from p1 to p2)
          • Set r3 = (Abs((r1 - r2)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • r3 Greater than or equal to 180.00
            • Then - Actions
              • Set r3 = (360.00 - r3)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • r3 Less than 45.00 // This is the width of the cone in angles. 45 ° to left and right from center
            • Then - Actions
              • Unit - Cause u1 to damage u3, dealing 100.00 damage of attack type Spells and damage type Normal
              • Special Effect - Create a special effect attached to the chest of u3 using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
              • Special Effect - Destroy (Last created special effect)
              • Floating Text - Create floating text that reads I'm hit! above u2 with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.70 seconds
            • Else - Actions
          • Custom script: call RemoveLocation(udg_p2)
      • Custom script: call RemoveLocation(udg_p1)
 

Attachments

  • Attack.w3x
    21.8 KB · Views: 50
Status
Not open for further replies.
Top