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

[Trigger] Golden Spiral

Status
Not open for further replies.
Level 9
Joined
Apr 7, 2008
Messages
176
I have been trying to make 4 Units move in a Golden Spiral inward to a center point. I know they will never reach the point, but when they get close I will trigger a new action. Unfortuately I cant get them to move in a spiral.
Here's my trigger right now.

  • Beam Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Cannon Beam 1) and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 10.00 towards (Sign(76.00)) degrees), facing Target_Point[Unit_ID]
          • Animation - Play (Picked unit)'s stand animation
That makes them move Right.

On the positive side I did make this.


  • Beam Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Cannon Beam 1) and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 10.00 towards ((Facing of (Picked unit)) x (Distance between (Position of (Picked unit)) and Target_Point[Unit_ID])) degrees), facing (Position of (Triggering unit))
          • Animation - Play (Picked unit)'s stand animation

This will make the units move in a completely random manner, each time it is cast they follow a different path.
 
It leaks super badly, fix the location leaks. Other than that, it seems ok, I guess. Exept it also leaks the unit group. Look at things that leak

  • Beam Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units of type Cannon Beam 1) and do (Actions)
        • Loop - Actions
          • Set TempLocA = (Position of (Picked unit))
          • Set TempLocB = (TempLocA) offset by 10.00 towards ((Sign(76.00)) degrees)
          • Unit - Move (Picked unit) instantly to TempLocB, facing Target_Point[Unit_ID]
          • Animation - Play (Picked unit)'s stand animation
          • Custom script: call RemoveLocation(udg_TempLocA)
          • Custom script: call RemoveLocation(udg_TempLocB)
 
Level 6
Joined
Jul 25, 2005
Messages
221
His question didn't have to do with leaks. To make cool shapes and sizes, read up on this site Graphics - Static Shapes (GUI)

I'm not really sure what you wanted but, here you go, I made this map for you that you can take a look at. Easier than reading that link if you're not good at math.

This map isn't perfect, but you'll get the principal idea of how it could work.
(Again, this isn't perfect, haven't had time to give it better formulas)

Here're the triggers if you don't want to download the map ( it has a theme :cute:)

At spellcast
  • InitSpiraling
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spiraling
    • Actions
      • For each (Integer B) from 0 to (integer_HowManyDummies - 1), do (Actions)
        • Loop - Actions
          • Unit - Kill unit_Dummy[(Integer B)]
      • Set real_CircleSize = 360.00
      • Set integer_HowManyDummies = 1
      • Set real_Offset = 500.00
      • Set real_SpiralingOffset = real_Offset
      • Set real_InOrOut = -5.00
      • Set point_Caster = (Position of (Triggering unit))
      • Set real_SpiralSpeed = 5.00
      • Set real_DistanceSpeed = 5.00
      • -------- Create Dummies at seperate locations --------
      • For each (Integer A) from 0 to (integer_HowManyDummies - 1), do (Actions)
        • Loop - Actions
          • Unit - Create 1 Spiral Dummy for (Owner of (Triggering unit)) at (point_Caster offset by real_Offset towards ((Real((Integer A))) x (real_CircleSize / (Real(integer_HowManyDummies)))) degrees) facing Default building facing degrees
          • Set unit_Dummy[(Integer A)] = (Last created unit)
      • Countdown Timer - Start timer_MovingTimer as a Repeating timer that will expire in 0.04 seconds
Moving
  • Moving
    • Events
      • Time - timer_MovingTimer expires
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • real_SpiralingOffset Less than or equal to 0.00
        • Then - Actions
          • Set real_InOrOut = real_DistanceSpeed
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • real_SpiralingOffset Greater than or equal to real_Offset
        • Then - Actions
          • Set real_InOrOut = (-1.00 x real_DistanceSpeed)
        • Else - Actions
      • Set real_SpiralingOffset = (real_SpiralingOffset + real_InOrOut)
      • For each (Integer A) from 0 to (integer_HowManyDummies - 1), do (Actions)
        • Loop - Actions
          • Set point_DummyCurrentPosition = (Position of unit_Dummy[(Integer A)])
          • Set real_DummyCurrentDegree = (Angle from point_Caster to point_DummyCurrentPosition)
          • Unit - Move unit_Dummy[(Integer A)] instantly to (point_Caster offset by real_SpiralingOffset towards (real_DummyCurrentDegree + real_SpiralSpeed) degrees)
          • Custom script: call RemoveLocation(udg_point_DummyCurrentPosition)
This trigger list is incomplete, the rest of the triggers are commands that you can play around with, spin and distance speed, relative, clockwise, counter-clockwise etc.
 

Attachments

  • Inward Spiraling.w3x
    62.9 KB · Views: 45
Last edited:
Level 6
Joined
Jul 25, 2005
Messages
221
Hm, well, it's not perfect math, I could enhance it so it is though. but I don't think I'm uploading it. I can probably do this in the help section...
 
Status
Not open for further replies.
Top