• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Creating units moving spirally

Status
Not open for further replies.
Level 10
Joined
May 27, 2009
Messages
494
Creating units that move spirally

I'm about to make a spell but it's killing me 'cause I don't know how to make a unit spirally (smooth and.. really spiral movement...)

Well this is a dynamic spiral shape.. wherein if the distance of the units from a point (let's say 350) they'll go to another "imaginary spiral" or "imaginary circle"

well here's a pic

Untitled.jpg
The red x is the starting point and the green x is the end point (or vice versa.. whatever you like)
the dashed arcs of those circles are the path the the units will take... making them show that they move "spirally"

any helps?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
This is a bit of a mess and not MUI since I'm a bit tired, but it works.


  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set p1 = (Position of Paladin 0002 <gen>)
      • Set r1 = (Random real number between 128.00 and 192.00)
      • Set r2 = (Random real number between 0.00 and 360.00)
      • Set p2 = (p1 offset by r1 towards r2 degrees)
      • -------- ---------------------------------------- --------
      • Unit - Kill (Last created unit)
      • Unit - Create 1 Dummy for Player 1 (Red) at p2 facing Default building facing degrees
      • Unit Group - Add (Last created unit) to GRP
      • -------- ---------------------------------------- --------
      • Custom script: call RemoveLocation(udg_p1)
      • Custom script: call RemoveLocation(udg_p2)
      • -------- ---------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 2) Equal to 1
        • Then - Actions
          • Set BOOL = True
          • Set MAX = (Random real number between (ANGLE + 90.00) and (ANGLE + 270.00))
        • Else - Actions
          • Set BOOL = False
          • Set MAX = (Random real number between (ANGLE - 270.00) and (ANGLE - 90.00))
      • Set DIST = r1
      • Set ANGLE = r2
      • Set TIMES = 0
      • Set P11 = (Position of Paladin 0002 <gen>)
  • Untitled Trigger 002
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GRP and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BOOL Equal to True
            • Then - Actions
              • Set ANGLE = (ANGLE + 3.00)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ANGLE Greater than or equal to MAX
                • Then - Actions
                  • Set p2 = (P11 offset by DIST towards MAX degrees)
                  • Unit - Move (Last created unit) instantly to p2
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TIMES Equal to 5
                    • Then - Actions
                      • Unit - Kill (Last created unit)
                      • Unit Group - Remove (Last created unit) from GRP
                    • Else - Actions
                      • Set DIST = (Random real number between 128.00 and 192.00)
                      • Custom script: call RemoveLocation(udg_P11)
                      • Set P11 = (p2 offset by DIST towards MAX degrees)
                      • Set TIMES = (TIMES + 1)
                      • Game - Display to Player Group - Player 1 (Red) the text: times
                      • Set ANGLE = (ANGLE - 180.00)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • BOOL Equal to True
                        • Then - Actions
                          • Set BOOL = False
                          • Set MAX = (Random real number between (ANGLE - 270.00) and (ANGLE - 90.00))
                        • Else - Actions
                          • Set BOOL = True
                          • Set MAX = (Random real number between (ANGLE + 90.00) and (ANGLE + 270.00))
                  • Custom script: call RemoveLocation(udg_p2)
                • Else - Actions
                  • Set p2 = (P11 offset by DIST towards ANGLE degrees)
                  • Unit - Move (Last created unit) instantly to p2
                  • Custom script: call RemoveLocation(udg_p2)
            • Else - Actions
              • Set ANGLE = (ANGLE - 3.00)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ANGLE Less than or equal to MAX
                • Then - Actions
                  • Set p2 = (P11 offset by DIST towards MAX degrees)
                  • Unit - Move (Last created unit) instantly to p2
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TIMES Equal to 5
                    • Then - Actions
                      • Unit - Kill (Last created unit)
                      • Unit Group - Remove (Last created unit) from GRP
                    • Else - Actions
                      • Set DIST = (Random real number between 128.00 and 192.00)
                      • Custom script: call RemoveLocation(udg_P11)
                      • Set P11 = (p2 offset by DIST towards MAX degrees)
                      • Set TIMES = (TIMES + 1)
                      • Game - Display to Player Group - Player 1 (Red) the text: times
                      • Set ANGLE = (ANGLE + 180.00)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • BOOL Equal to True
                        • Then - Actions
                          • Set BOOL = False
                          • Set MAX = (Random real number between (ANGLE - 270.00) and (ANGLE - 90.00))
                        • Else - Actions
                          • Set BOOL = True
                          • Set MAX = (Random real number between (ANGLE + 90.00) and (ANGLE + 270.00))
                  • Custom script: call RemoveLocation(udg_p2)
                • Else - Actions
                  • Set p2 = (P11 offset by DIST towards ANGLE degrees)
                  • Unit - Move (Last created unit) instantly to p2
                  • Custom script: call RemoveLocation(udg_p2)


http://www.hiveworkshop.com/forums/pastebin.php?id=eg1vuh

I hope you can figure it out.
 
Level 10
Joined
May 27, 2009
Messages
494
yeah but not really a perfect spiral i think?

chances are.. a circle will created inside the current circle (which in case creates a spiral movement) or it may create a circle just like the first pic...

here's another pic o.o

Untitled.jpg

anyways i might check maker's spell
 
Level 10
Joined
May 27, 2009
Messages
494
No and no... it will start from the caster's location then it will make the movement...

well here's the simplest pic i can make o.o

somewhat similar to what maker did but there's an addition which will make a loop inside the circle before going into another circle.. almost similar to a spiral movement...

Hmm i'm planning to make it for 2 or more units

hope you understand o.o
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    22.3 KB · Views: 163
Level 12
Joined
Mar 13, 2012
Messages
1,121
Hm I dont really understand what you actually want. But if you dont want to use too many triggers, it may help you to use SetUnitPropWindow to a small value and just let the units move to a special point to gain circular movement.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
somewhat similar to what maker did but there's an addition which will make a loop inside the circle before going into another circle.. almost similar to a spiral movement.

Edit my system, set the DIST to 0 initially and increase it periodically. When randomizing an angle set the min to 360 + x and max to 360 + y. Change the negative direction range in similar fashion.
 
Status
Not open for further replies.
Top