• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[Spell] Dummy Angle help

Status
Not open for further replies.
Level 3
Joined
Feb 15, 2015
Messages
26
Hi! I need help with the initiation of my spell. Basically what it does is releasing 7 arrows flying towards and damaging enemy. I know how to slide the dummy units already, I just don't know how to make them face the desired angle. I have attached an image for clarification

If you still aren't clear, let me explain. The arrow (4) faces the angle between the caster and the targeted point, while other arrows are symmetrical pairs. Suppose that the angle mentioned above is 0 degree:

+ Arrow (5) flies toward 20 degree, Arrow (3) flies toward 340 degree.
+ Arrow (6) flies toward 40 degree, Arrow (2) flies toward 320 degree.
+ Arrow (7) flies toward 60 degree, Arrow (1) flies toward 300 degree.

Is there any formula to achieve this? I'm kinda lost when it comes to math
7 arrows.png
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
2,008
Something like this:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Set Point2 = (Target point of ability being cast)
      • Set Facing = (Angle from Point to Point2)
      • Set Point3 = (Point offset by 10.00 towards Facing degrees)
      • Unit - Create 1 Missile for (Owner of (Triggering unit)) at Point3 facing Facing degrees
      • -------- set a unit variable for dummy I suppose? --------
      • Custom script: call RemoveLocation(udg_Point2)
      • Custom script: call RemoveLocation(udg_Point3)
      • For each (Integer IntLoop) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set Deviation = (Deviation x (Real(IntLoop)))
          • Set Point2 = (Point offset by 10.00 towards (Facing + Deviation) degrees)
          • Unit - Create 1 Missile for (Owner of (Triggering unit)) at Point2 facing (Facing + Deviation) degrees
          • -------- same here --------
          • Custom script: call RemoveLocation(udg_Point2)
          • Set Deviation = 20.00
      • For each (Integer IntLoop) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set Deviation = (Deviation x (Real(IntLoop)))
          • Set Point2 = (Point offset by 10.00 towards (Facing - Deviation) degrees)
          • Unit - Create 1 Missile for (Owner of (Triggering unit)) at Point2 facing (Facing - Deviation) degrees
          • -------- same here --------
          • Custom script: call RemoveLocation(udg_Point2)
          • Set Deviation = 20.00
 
Level 44
Joined
Feb 27, 2007
Messages
5,572
The Set Deviation = 20.00 lines need to be the first ones in the loops, not the last. (First time deviation is 0 so the first deviated arrow isn't and goes straight down the middle.)

You can use the Integer A/B variable loops instead of the specific integer variable loop Wrda wrote, it makes no difference.
 
Level 3
Joined
Feb 15, 2015
Messages
26
The Set Deviation = 20.00 lines need to be the first ones in the loops, not the last. (First time deviation is 0 so the first deviated arrow isn't and goes straight down the middle.)

You can use the Integer A/B variable loops instead of the specific integer variable loop Wrda wrote, it makes no difference.

So if I use integer loop, I presume I have to loop from -3 through 3 right? Will the system be able to read negative degrees? Thanks a lot.
 
Level 10
Joined
Apr 18, 2009
Messages
601
"Math - Angle Between Points" is a very nice function which returns the angle from point A to point B.

You can input the position of the caster as the first point, and the target position of the spell as the second point. You will get a real number which is the angle a unit on caster position would have if facing the target position.

So, create your first dummy facing this angle (angle from position of caster to target position).

If you store this facing value in a temporary variable "middleArrowFacing", then the other dummies would be created with the following facing angles:

middleArrowFacing - 20 * 3
middleArrowFacing - 20 * 2
middleArrowFacing - 20
middleArrowFacing + 20
middleArrowFacing + 20 * 2
middleArrowFacing + 20 * 3
 
Status
Not open for further replies.
Top