• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Creating Units facing of the triggering unit with pointset

Status
Not open for further replies.
Level 3
Joined
Jan 5, 2022
Messages
6

help pic cast.png
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

that's all, thanks in advance

also i only know GUI i have no clue abt JASS coding
 
Level 24
Joined
Feb 9, 2009
Messages
1,786
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 64
Joined
Jan 18, 2005
Messages
27,239
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.
 
Level 24
Joined
Feb 9, 2009
Messages
1,786
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.)
 
Level 3
Joined
Jan 5, 2022
Messages
6
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:thumbs_up:
anyways thanks for your help, i still appreaciate the effort
 
Status
Not open for further replies.
Top