# Creating Units facing of the triggering unit with pointset

Status
Not open for further replies.

#### alexcs

Level 3

Hi i need help, im having trouble making a trigger where when u cast a abilty it creates a line of units in the same facing point of the casting unit
with an offset of 300
basically the example in the picture i put.
im not really that good at triggers i came back to this community 4 months ago and i only remember some stuff that i knew back when i was a kid so expect for me to be confused alot lol

also i only know GUI i have no clue abt JASS coding

#### Devalut

Level 24
If something below is confusing, feel free to keep posting.

• example
• Events
• Unit - A unit Starts the effect of an ability
• Conditions
• (Ability being cast) Equal to Animate Dead
• Actions
• Set VariableSet UnitVariable[0] = (Triggering unit)
• Set VariableSet PointVariable[0] = (Position of UnitVariable[0])
• For each (Integer IntegerVariable) from 1 to 3, do (Actions)
• Loop - Actions
• Set VariableSet PointVariable[1] = (PointVariable[0] offset by (300.00 x (Real(IntegerVariable))) towards (Facing of UnitVariable[0]) degrees.)
• Unit - Create 1 dummy for (Owner of UnitVariable[0]) at PointVariable[0] facing Default building facing degrees
• Unit - Add a 0.30 second Generic expiration timer to (Last created unit)
• Custom script: call RemoveLocation(udg_PointVariable[1])
• Custom script: call RemoveLocation(udg_PointVariable[0])
Lastly some excellent tutorials.

#### Dr Super Good

Spell Reviewer
Level 63
Are you sure units will always perfectly face the target to cast? I recall there being some slack to improve responsiveness. If that is a problem then you need to compute the angle from the caster position to the target point of ability being cast and use that instead of unit facing.

#### Devalut

Level 24
Are you sure units will always perfectly face the target to cast? I recall there being some slack to improve responsiveness. If that is a problem then you need to compute the angle from the caster position to the target point of ability being cast and use that instead of unit facing.
Good Doctor~! My liege~! senpai~!
It was made according to the OP's specification on unit facing alone; it was this one's assumption that the OP would request such a deviation from their original request if given enough time to review this one's first attempt.

If they would prefer that then they would need only change PointVariable[1] to:
• Set VariableSet PointVariable[1] = (PointVariable[0] offset by (300.00 x (Real(IntegerVariable))) towards (Angle from PointVariable[0] to PointVariable[2]) degrees.)
Where PointVariable[2] is simply the targetpoint of the casting ability (If any.)

#### alexcs

Level 3
Good Doctor~! My liege~! senpai~!
It was made according to the OP's specification on unit facing alone; it was this one's assumption that the OP would request such a deviation from their original request if given enough time to review this one's first attempt.

If they would prefer that then they would need only change PointVariable[1] to:
• Set VariableSet PointVariable[1] = (PointVariable[0] offset by (300.00 x (Real(IntegerVariable))) towards (Angle from PointVariable[0] to PointVariable[2]) degrees.)
Where PointVariable[2] is simply the targetpoint of the casting ability (If any.)
If something below is confusing, feel free to keep posting.

• example
• Events
• Unit - A unit Starts the effect of an ability
• Conditions
• (Ability being cast) Equal to Animate Dead
• Actions
• Set VariableSet UnitVariable[0] = (Triggering unit)
• Set VariableSet PointVariable[0] = (Position of UnitVariable[0])
• For each (Integer IntegerVariable) from 1 to 3, do (Actions)
• Loop - Actions
• Set VariableSet PointVariable[1] = (PointVariable[0] offset by (300.00 x (Real(IntegerVariable))) towards (Facing of UnitVariable[0]) degrees.)
• Unit - Create 1 dummy for (Owner of UnitVariable[0]) at PointVariable[0] facing Default building facing degrees
• Unit - Add a 0.30 second Generic expiration timer to (Last created unit)
• Custom script: call RemoveLocation(udg_PointVariable[1])
• Custom script: call RemoveLocation(udg_PointVariable[0])
Lastly some excellent tutorials.
Hey sorry for the late reply Thanks for the help but i somehow actually figured it out myself yesterday by playing with stuff
i came up with this :
• create units facing same point as caster
• Events
• Unit - A unit Starts the effect of an ability
• Conditions
• (Ability being cast) Equal to Myability
• Actions
• Set p1 = (Position of (Triggering unit))
• Set p2 = (p1 offset by 400.00 towards (Facing of (Triggering unit)) degrees)
• Set p3 = (p2 offset by 400.00 towards (Facing of (Triggering unit)) degrees)
• Set p4 = (p3 offset by 400.00 towards (Facing of (Triggering unit)) degrees)
• Unit - Create 1 dummyunit for (Owner of (Triggering unit)) at p2 facing (Facing of (Triggering unit)) degrees
• Unit - Create 1 dummyunit for (Owner of (Triggering unit)) at p3 facing (Facing of (Triggering unit)) degrees
• Unit - Create 1 dummyunit for (Owner of (Triggering unit)) at p4 facing (Facing of (Triggering unit)) degrees
• Custom script: call RemoveLocation(udg_p1)
• Custom script: call RemoveLocation(udg_p2)
• Custom script: call RemoveLocation(udg_p3)
• Custom script: call RemoveLocation(udg_p4)
works the way i wanted to, and after a couple of tries it doesn't seem to have issues but let me know if somethings wrong
anyways thanks for your help, i still appreaciate the effort

Status
Not open for further replies.

Replies
2
Views
297
Replies
14
Views
2K
Replies
9
Views
879
Replies
2
Views
383
Replies
11
Views
797