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

Making multiple selected units form a line

Status
Not open for further replies.
Level 2
Joined
Jan 22, 2010
Messages
9
Im wondering if this is possible only in JASS? I need:
1st of the units selected by player red move to region 1. 2nd move to region 2. Repeat through to 6.

What I want to do is make upto 6 of the selected units form a line in a certain place with 1 click.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
No need to use regions.
  • Set Point1 = Target Point of Current Order
  • Set Offset = 0
  • Set i = 0
  • Set Group = Units currently selected by Player
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit from (6 Random units in Group)
    • Set i = i + 1
    • Set Unit[i] = (Picked Unit)
  • For each integer A from 1 to 5 do (Actions):
    • Set Offset = offset + 32
    • Set Point2 = Point 1 offset Offset towards 90º
    • Unit - Order Unit[i] move to Point2
    • Custom script: call DestroyLocation(udg_Point2)
  • Custom script: call DestroyLocation(udg_Point1)
  • Custom script: call DestroyGroup(udg_Group)
Something like that.
 
Level 2
Joined
Jan 22, 2010
Messages
9
Sorry but i dont understand your trigger. I tried to make it work but couldnt.
Heres a copy of what i replicated:

  • form a line
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • ((Triggering unit) is in (Units owned by Player 1 (Red))) Equal to True
    • Actions
      • Set iPoint1 = (Target point of issued order)
      • Set iOffset = 0
      • Set i = 0
      • Set iGroup = (Units currently selected by Player 1 (Red))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Random 6 units from iGroup) and do (Actions)
        • Loop - Actions
          • Set i = (i + 1)
          • Set iUnit = (Picked unit)
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set iOffset = (iOffset + 32)
          • Set iPoint2 = (iPoint1 offset by 32.00 towards 90.00 degrees)
          • Unit - Order iUnit to Move To iPoint2
          • Custom script: call DestroyLocation(udg_Point2)
      • Custom script: call DestroyLocation(udg_Point1)
      • Custom script: call DestroyGroup(udg_Group)
Its interesting that you dont use Point1 at all. Can you tell me which variables need to be arrays? Also i needed to disable your 3 scripts at the bottom cause they caused a crash.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Set Unit. It's an array. The idea is to pick 6 units and set them Unit[1], Unit[2], etc. Also, the loop is from 1 to 6, I miswrited 5. ALso the Offset is is a Real variable... And the "IPoint2) is "offset by Offset" means Offset by Variable_Called_Offset

Also, order Unit[Integer A] move to iPoint2
 
Status
Not open for further replies.
Top