• 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.

How to make a unit move in a circle?

Status
Not open for further replies.
Level 7
Joined
Dec 20, 2007
Messages
151
k i ve made a spell so

in spell int i've selected the group :

  • Set KamuiGroup = (Units within 400.00 of KamuiPoint1[KamuiInt] matching ((((Matching unit) belongs to an enemy of (Owner of KamuiCaster[KamuiInt])) Equal to True) and (((Matching unit) is alive) Equal to True)))
and in loop

  • Unit Group - Pick every unit in KamuiGroup and do (Actions)
    • Loop - Actions
      • Set KamuiDamage[KamuiInt] = ((Angle from (Position of KamuiDummy[KamuiInt]) to (Position of (Picked unit))) + 270.00)
      • Set KamuiPoint1[KamuiInt] = (Position of (Picked unit))
      • Set KamuiPoint2[KamuiInt] = (KamuiPoint1[KamuiInt] offset by 5.00 towards KamuiDamage[KamuiInt] degrees)
      • Special Effect - Create a special effect attached to the chest of (Picked unit) using KamuiEffect.mdx
      • Special Effect - Destroy (Last created special effect)
      • Unit - Move (Picked unit) instantly to KamuiPoint2[KamuiInt]
      • Unit - Cause KamuiCaster[KamuiInt] to damage (Picked unit), dealing 3.00 damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation (udg_KamuiPoint1[udg_KamuiInt])
      • Custom script: call RemoveLocation (udg_KamuiPoint2[udg_KamuiInt])
hope you will understand
 
Although the thread title may be misleading, this is related.

Here are some specific posts that could help you:
http://www.hiveworkshop.com/forums/1957460-post2.html (the basic principle in GUI)
http://www.hiveworkshop.com/forums/1958541-post11.html (keeps units spinning forever, JASS)


Basically you're just taking the center of the circle and move the unit around it (well, duh).
Further explanation:
If a unit "U" is 200 range away from the center of the circle, and is currently at an angle of 90º (that means at the top of the circle, I hope you still know the all-important Unit Circle).
If you want to make him move in a circle (let's say counter-clockwise, which is the easiest), then you just have to move unit U 200 range from the center of the circle towards 92º!
And after that 94º, 96º, 98º, etc... until we complete our circle. Our unit will now move in a circular movement around the center location. If we speed up this process to about 30 movements a second, then it will move seamlessly.

I'm afraid I cannot explain this any better without having to delve deeper into the very basics of math, which I do hope you already know.
 
Status
Not open for further replies.
Top