• 🏆 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!

[Trigger] unit dummies as missiles

Status
Not open for further replies.
Level 9
Joined
Jan 14, 2008
Messages
366
can anyone give me the basics for doing this? complex spells often require to create unit dummies as missiles.

basically the one thing i cant figure out is how to EXACTLY make the unit move in an infinite line towards the direction it was cast.

any help appreciated.
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
  • Set temppoint1 = Position of (Last created unit)
  • Set temppoint2 = temppoint1 offset by 20000 towards (Facing of (Triggering Unit)) degrees
  • Unit - Order (Last created unit) to move temppoint2
  • Custom script: call RemoveLocation(udg_temppoint1)
  • Custom script: call RemoveLocation(udg_temppoint2)
As triggering unit refers to the caster ;)
 
Level 9
Joined
Jan 14, 2008
Messages
366
thanks alot squiggy!

the problem tough is unit rotation speed. since it is not instant, a hero casting a spell to the exactly opposite direction in wich he is facing, will start casting instantly, therefore the points will be assigned instantly. the hero although will only then start moving towards the correct angle, therefore the direction in wich the dummy will travel, will not be the desired direction, but somewhat distorted.

=/

that is the basic problem.
 
Level 9
Joined
Jan 14, 2008
Messages
366
unit rotation speed can be set to values between 0.00 and 3.00 but setting it to 0.00 will not be actual zero, but a somewhat slower rotation speed. 3.00 on the other hand will not result in an instant facing rotation but in a somewhat faster rotation speed.

cant solve the problem this way.

you need to somehow mathematically get the angle formed by the two points:

point1: casting unit
point2: target of ability cast

and then offset point3 by 3000 in the direction those two points create.

but how?
 
Level 7
Joined
Jul 20, 2008
Messages
377
In the GUI editor, when you're editing an angle, you will see a pulldown option for "Polar offset." That's what you're looking for, it basically takes an initial position, an angle, and the distance to offset in that direction.

Although to prevent that from leaking, you'll want to first assign the initial position (pos of caster) to a variable, then assign the polar offset (using the variable for the initial position) to another variable.
 
Level 2
Joined
Feb 8, 2009
Messages
11
Or....create the unit facing the same way as the casting unit using...
  • Unit - Create 1 dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing (Facing of (Casting unit)) degrees
Or somthing like that, never wanted to do this personally.
 
Status
Not open for further replies.
Top