# [Spell]Dummy Angle help

Status
Not open for further replies.

#### FallenAngel1999

Level 3
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

#### Wrda

Spell Reviewer
Level 26
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

#### Pyrogasm

Level 41
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.

#### Wrda

Spell Reviewer
Level 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.)
Yes, true...my mistake for thinking of something else while doing this trigger

#### FallenAngel1999

Level 3
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.

#### Pyrogasm

Level 41
Yes you can put it on one loop -3...3 and negative degrees are fine.

#### Licheus

Level 10
"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

#### FallenAngel1999

Level 3
Thanks for all good replies. For some reasons when I first loop on -3 to 3, it didn't work, but after restarting WE, it worked right away. +Rep

Status
Not open for further replies.

Replies
2
Views
600
Replies
7
Views
819
Replies
3
Views
782
Replies
14
Views
2K
Replies
19
Views
979