• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Custom pathing system

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
Okay, so I'll tell you what I need to do. But I don't have any idea how to do it.

When you have more than 1 unit selected, all the units need to move a relative distance between each other. I figured I could solve this by doing what (I think) SC1 does. What it does, is:

It takes all the units selected. And determines the most-center point between all the units.

Then, when the units are ordered to move as a group (Max: 12 units, because of the selection limit) it takes the distance each unit is at from the center, and then orders each unit individually to move to an offset point based on that distance the unit is from the center.

I have no idea where to even start with this, really. But I have a trigger slightly built. It's far from finished and is non-functional:

  • Modded Group Movement
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • For each (Integer PlayerInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in PlayerSelectionGroup[PlayerInt]) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in PlayerSelectionGroup[PlayerInt] and do (Actions)
                • Loop - Actions
                  • Set PointXofUnit = (X of (Position of (Picked unit)))
                  • Set PointYofUnit = (Y of (Position of (Picked unit)))
                  • Set PointXResult = (PointXResult + PointXofUnit)
                  • Set PointYResult = (PointYResult + PointYofUnit)
                  • Set PlayerSelectionGroupCenter[PlayerInt] = (Point(((X of (Position of PointArrayUnit[PlayerInt])) + (1.00 + 1.00)), (Y of (Position of PointArrayUnit[PlayerInt]))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                    • Then - Actions
                    • Else - Actions
            • Else - Actions
Here is a diagram showing what I need:

attachment.php


The three points are units. The two other points are the centers of the X and Y. I need that to stay like that when those three units are ordered to move.

EDIT: Here's a video. Watch closely how the units stay in whatever formation you put them in.

http://www.mediafire.com/watch/7tdc6yset2tuwng/bandicam_2014-10-27_21-12-44-430.avi

This is what I want to achieve. And I know how to achieve it. I just don't know how to trigger it in WC3.
 

Attachments

  • simplediagram.png
    simplediagram.png
    3.8 KB · Views: 298
Last edited:
Level 12
Joined
May 20, 2009
Messages
822
That doesn't help at all. =[

That will just make them be bigger and take more space. It doesn't actually make them keep the same shape and size and distance between all the units. They'll still all pile on at the same target point you order them to go to, and they'll still all face that point once they're done moving.

Maybe I'll record a video of SC1 and how it's pathing works and show that video. I'll see if I can get that done in about 30-40 minutes.
 
Level 12
Joined
May 20, 2009
Messages
822
Shit, I just realized that maybe I didn't say how this would be done good enough. Basically,

You get the center of all the units by doing:

Unit1X+Unit2X ...Etc /number of Xs = n.

Then now that you found the center, you determine the offset of all the units from that center. Then you take the units offset and the location they were ordered to move, and order each unit to move to the point with the offset we just got.

I have no idea how to actually do this in WC3, though. I am certain it can be done, but I don't know JASS/vJASS well enough to do it on my own.

that system is hardcoded in sc1, it cant be done in WC3 unless you build a system just like it, there is an AI formation system in the spells section but it's really not perfect as in the video...

Link? Maybe I can learn from it.

Also, SC1s group pathing is extremely simple once you get the hang of it. I just don't have the right knowledge to actually code it in JASS.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
Is this how you want it to be?
attachment.php

(you want those units to keep their formations)

I can offer you one solution:
- Seek the center
- Get angle and distance between that center and order target point
- Order each unit to move to:
(Position of each unit) offset by (distance) toward (angle)
 

Attachments

  • a.jpg
    a.jpg
    34.4 KB · Views: 208
Level 12
Joined
May 20, 2009
Messages
822
That is exactly what I want and that's a bit simpler than how I thought it would be, actually.

Do I get the angle from them toward the order point, or do I get the angle from to the center?

I'm pretty sure I get the distance they are from the center, though.

I think I do still need help figuring out how to write it, though.
 
Level 12
Joined
May 20, 2009
Messages
822
EDIT: Okay, I THINK I got the idea but it crashes the game. xD

EDIT2: Wait, I think I'm just stupid. Hold on.
EDIT3: Yeah I'm just stupid. Updating Trigger.

  • Modded Group Movement
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • For each (Integer PlayerInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in PlayerSelectionGroup[PlayerInt]) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in PlayerSelectionGroup[PlayerInt] and do (Actions)
                • Loop - Actions
                  • Set PointXofUnit = (X of (Position of (Picked unit)))
                  • Set PointYofUnit = (Y of (Position of (Picked unit)))
                  • Set PointXResult = (PointXResult + PointXofUnit)
                  • Set PointYResult = (PointYResult + PointYofUnit)
                  • Set NumberOfUnits = (NumberOfUnits + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • NumberOfUnits Equal to (Number of units in PlayerSelectionGroup[PlayerInt])
                • Then - Actions
                  • Set PlayerSelectionGroupCenter[PlayerInt] = (Point((PointXResult / (Real(NumberOfUnits))), (PointYResult / (Real(NumberOfUnits)))))
                  • Set PointXofUnit = 0.00
                  • Set PointXResult = 0.00
                  • Set PointYofUnit = 0.00
                  • Set PointYResult = 0.00
                  • Set NumberOfUnits = 0
                  • Set OrderAngle[PlayerInt] = (Angle from PlayerSelectionGroupCenter[PlayerInt] to (Target point of issued order))
                  • Unit Group - Pick every unit in PlayerSelectionGroup[PlayerInt] and do (Actions)
                    • Loop - Actions
                      • Set UnitDistance = (Distance between (Position of (Triggering unit)) and PlayerSelectionGroupCenter[PlayerInt])
                      • Trigger - Turn off (This trigger)
                      • Unit - Order (Triggering unit) to Move To ((Target point of issued order) offset by UnitDistance towards OrderAngle[PlayerInt] degrees)
                      • Trigger - Turn on (This trigger)
                • Else - Actions
            • Else - Actions
A problem occurs. They seem to just go to the center of the map. So I added
  • Lightning - Create a Chain Lightning - Primary lightning effect from source PlayerSelectionGroupCenter[PlayerInt] to target (Target point of issued order)
The Center is drawn right, but it appears that the Angle isn't being calculated correctly I think.


EDIT: This is finished! Here's the complete version. It may be sloppy, or inefficient, so if it is please let me know so I can make it cleaner. But, this works!

  • Modded Group Movement
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • For each (Integer PlayerInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set OrderPoint[PlayerInt] = (Target point of issued order)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in PlayerSelectionGroup[PlayerInt]) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in PlayerSelectionGroup[PlayerInt] and do (Actions)
                • Loop - Actions
                  • Set PointXofUnit = (X of (Position of (Picked unit)))
                  • Set PointYofUnit = (Y of (Position of (Picked unit)))
                  • Set PointXResult = (PointXResult + PointXofUnit)
                  • Set PointYResult = (PointYResult + PointYofUnit)
                  • Set NumberOfUnits = (NumberOfUnits + 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NumberOfUnits Equal to (Number of units in PlayerSelectionGroup[PlayerInt])
            • Then - Actions
              • Set PlayerSelectionGroupCenter[PlayerInt] = (Point((PointXResult / (Real(NumberOfUnits))), (PointYResult / (Real(NumberOfUnits)))))
              • Set OrderAngle[PlayerInt] = (Angle from PlayerSelectionGroupCenter[PlayerInt] to OrderPoint[PlayerInt])
              • Set PointXofUnit = 0.00
              • Set PointXResult = 0.00
              • Set PointYofUnit = 0.00
              • Set PointYResult = 0.00
              • Set NumberOfUnits = 0
              • Unit Group - Pick every unit in PlayerSelectionGroup[PlayerInt] and do (Actions)
                • Loop - Actions
                  • Set UnitDistance = (Distance between PlayerSelectionGroupCenter[PlayerInt] and OrderPoint[PlayerInt])
                  • Trigger - Turn off (This trigger)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between (Position of (Picked unit)) and PlayerSelectionGroupCenter[PlayerInt]) Greater than or equal to 350.00
                    • Then - Actions
                      • Unit - Order (Picked unit) to Right-Click (Target point of issued order)
                    • Else - Actions
                      • Unit - Order (Picked unit) to Move To ((Position of (Picked unit)) offset by UnitDistance towards OrderAngle[PlayerInt] degrees)
                  • Trigger - Turn on (This trigger)
            • Else - Actions
The last part where it checks how far they are from the center is there to force units that are too far from the group to move closer.


Update: Added a few more features to make it more like SCBW. If your target point is close enough to their center, they will group up. If units are too far away, just that one unit will move to the center of the group.

Also, here are the triggers that add and remove units into the Unit Group.

  • Group Add Selection
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
    • Conditions
    • Actions
      • For each (Integer P_Int) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to (Player(P_Int))
            • Then - Actions
              • Unit Group - Add (Triggering unit) to P_Group[P_Int]
            • Else - Actions
  • Group Remove Selection
    • Events
      • Player - Player 1 (Red) Deselects a unit
      • Player - Player 2 (Blue) Deselects a unit
      • Player - Player 3 (Teal) Deselects a unit
      • Player - Player 4 (Purple) Deselects a unit
      • Player - Player 5 (Yellow) Deselects a unit
      • Player - Player 6 (Orange) Deselects a unit
      • Player - Player 7 (Green) Deselects a unit
      • Player - Player 8 (Pink) Deselects a unit
      • Player - Player 9 (Gray) Deselects a unit
      • Player - Player 1 (Red) Deselects a unit
      • Player - Player 11 (Dark Green) Deselects a unit
      • Player - Player 12 (Brown) Deselects a unit
    • Conditions
    • Actions
      • For each (Integer P_Int) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to (Player(P_Int))
            • Then - Actions
              • Unit Group - Remove (Triggering unit) from P_Group[P_Int]
            • Else - Actions

  • Modded Group Movement
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • For each (Integer P_Int) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set P_Target[P_Int] = (Target point of issued order)
          • Set P_InitialOrder[P_Int] = (Issued order)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in P_Group[P_Int]) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in P_Group[P_Int] and do (Actions)
                • Loop - Actions
                  • Set P_XofUnit = (X of (Position of (Picked unit)))
                  • Set P_YofUnit = (Y of (Position of (Picked unit)))
                  • Set P_XResult = (P_XResult + P_XofUnit)
                  • Set P_YResult = (P_YResult + P_YofUnit)
                  • Set P_Count = (P_Count + 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • P_Count Equal to (Number of units in P_Group[P_Int])
            • Then - Actions
              • Set P_Center[P_Int] = (Point((P_XResult / (Real(P_Count))), (P_YResult / (Real(P_Count)))))
              • Set P_OrderAngle[P_Int] = (Angle from P_Center[P_Int] to P_Target[P_Int])
              • Set P_XofUnit = 0.00
              • Set P_XResult = 0.00
              • Set P_YofUnit = 0.00
              • Set P_YResult = 0.00
              • Set P_Count = 0
              • Unit Group - Pick every unit in P_Group[P_Int] and do (Actions)
                • Loop - Actions
                  • Set P_OrderUnit[P_Int] = (Picked unit)
                  • Set P_OrderPoint[P_Int] = (Position of P_OrderUnit[P_Int])
                  • Set P_Distance[P_Int] = (Distance between P_Center[P_Int] and P_Target[P_Int])
                  • Trigger - Turn off (This trigger)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between P_OrderPoint[P_Int] and P_Center[P_Int]) Greater than or equal to 350.00
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • P_InitialOrder[P_Int] Equal to (Order(smart))
                        • Then - Actions
                          • Unit - Order P_OrderUnit[P_Int] to Right-Click P_Target[P_Int]
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(move))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Move To P_Target[P_Int]
                            • Else - Actions
                      • Set P_OrderUnit[P_Int] = No unit
                      • Custom script: call RemoveLocation( udg_P_OrderPoint[udg_P_Int])
                      • Set P_Distance[P_Int] = 0.00
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between P_Target[P_Int] and P_Center[P_Int]) Less than 125.00
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(smart))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Right-Click P_Target[P_Int]
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • P_InitialOrder[P_Int] Equal to (Order(move))
                                • Then - Actions
                                  • Unit - Order P_OrderUnit[P_Int] to Move To P_Target[P_Int]
                                • Else - Actions
                          • Set P_OrderUnit[P_Int] = No unit
                          • Custom script: call RemoveLocation( udg_P_OrderPoint[udg_P_Int])
                          • Set P_Distance[P_Int] = 0.00
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(smart))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Right-Click (P_OrderPoint[P_Int] offset by P_Distance[P_Int] towards P_OrderAngle[P_Int] degrees)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • P_InitialOrder[P_Int] Equal to (Order(move))
                                • Then - Actions
                                  • Unit - Order P_OrderUnit[P_Int] to Move To (P_OrderPoint[P_Int] offset by P_Distance[P_Int] towards P_OrderAngle[P_Int] degrees)
                                • Else - Actions
                          • Set P_OrderUnit[P_Int] = No unit
                          • Custom script: call RemoveLocation( udg_P_OrderPoint[udg_P_Int])
                          • Set P_Distance[P_Int] = 0.00
                      • Set P_OrderUnit[P_Int] = No unit
                      • Custom script: call RemoveLocation( udg_P_OrderPoint[udg_P_Int])
                      • Set P_Distance[P_Int] = 0.00
                  • Trigger - Turn on (This trigger)
            • Else - Actions


I've tried adding bj_wantDestroyGroup = true but it breaks it for some reason... I'm still stupid. Doing that removes the unit group entirely. XD

Also, I think I worked out most of the leaks. Will update again.
 
Last edited:
Level 12
Joined
May 20, 2009
Messages
822
:Ơ

Why not use this?
  • Modded Group Movement
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by (Owner of (Triggering unit))) and do (Actions)
        • Loop - Actions

That will leak a group. =o

Most recent changes. I think I got rid of most of the leaks, but I think there's still some. I think this could still also be done more efficiently.

  • Modded Group Movement
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • For each (Integer P_Int) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set P_Target[P_Int] = (Target point of issued order)
          • Set P_InitialOrder[P_Int] = (Issued order)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in P_Group[P_Int]) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in P_Group[P_Int] and do (Actions)
                • Loop - Actions
                  • Set P_XofUnit = (X of (Position of (Picked unit)))
                  • Set P_YofUnit = (Y of (Position of (Picked unit)))
                  • Set P_XResult = (P_XResult + P_XofUnit)
                  • Set P_YResult = (P_YResult + P_YofUnit)
                  • Set P_Count = (P_Count + 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • P_Count Equal to (Number of units in P_Group[P_Int])
            • Then - Actions
              • Set P_Center[P_Int] = (Point((P_XResult / (Real(P_Count))), (P_YResult / (Real(P_Count)))))
              • Set P_OrderAngle[P_Int] = (Angle from P_Center[P_Int] to P_Target[P_Int])
              • Set P_XofUnit = 0.00
              • Set P_XResult = 0.00
              • Set P_YofUnit = 0.00
              • Set P_YResult = 0.00
              • Set P_Count = 0
              • Unit Group - Pick every unit in P_Group[P_Int] and do (Actions)
                • Loop - Actions
                  • Set P_OrderUnit[P_Int] = (Picked unit)
                  • Set P_OrderPoint[P_Int] = (Position of P_OrderUnit[P_Int])
                  • Set P_Distance[P_Int] = (Distance between P_Center[P_Int] and P_Target[P_Int])
                  • Trigger - Turn off (This trigger)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between P_OrderPoint[P_Int] and P_Center[P_Int]) Greater than or equal to 350.00
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • P_InitialOrder[P_Int] Equal to (Order(smart))
                        • Then - Actions
                          • Unit - Order P_OrderUnit[P_Int] to Right-Click P_Target[P_Int]
                          • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(move))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Move To P_Target[P_Int]
                              • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                            • Else - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between P_Target[P_Int] and P_Center[P_Int]) Less than 125.00
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(smart))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Right-Click P_Target[P_Int]
                              • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • P_InitialOrder[P_Int] Equal to (Order(move))
                                • Then - Actions
                                  • Unit - Order P_OrderUnit[P_Int] to Move To P_Target[P_Int]
                                  • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                                • Else - Actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(smart))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Right-Click (P_OrderPoint[P_Int] offset by P_Distance[P_Int] towards P_OrderAngle[P_Int] degrees)
                              • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • P_InitialOrder[P_Int] Equal to (Order(move))
                                • Then - Actions
                                  • Unit - Order P_OrderUnit[P_Int] to Move To (P_OrderPoint[P_Int] offset by P_Distance[P_Int] towards P_OrderAngle[P_Int] degrees)
                                  • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                                • Else - Actions
                  • Trigger - Turn on (This trigger)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • P_UnitsOrdered[P_Int] Equal to (Number of units in P_Group[P_Int])
                • Then - Actions
                  • Set P_OrderUnit[P_Int] = No unit
                  • Custom script: call RemoveLocation( udg_P_OrderPoint[udg_P_Int])
                  • Custom script: call RemoveLocation( udg_P_Target[udg_P_Int])
                  • Custom script: call RemoveLocation( udg_P_Center[udg_P_Int])
                  • Set P_UnitsOrdered[P_Int] = 0
                  • Set P_Distance[P_Int] = 0.00
                  • Set P_OrderAngle[P_Int] = 0.00
                • Else - Actions
            • Else - Actions
 
Level 12
Joined
May 20, 2009
Messages
822
EDIT2: There appears to be a simple problem with this system in general. The center of the map causes some problems with finding the angle to move in. This isn't that bad but I don't know what causes the issue so it'll take a while to fix.

EDIT3: The issue I mentioned above I have yet to see happen again...

I suppose I will see if that works just as well. I'll get back to this in about 30 minutes or so.

EDIT: It stops working like that. o.0

Stops working entirely.

  • Modded Group Movement
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • For each (Integer P_Int) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set P_Target[P_Int] = (Target point of issued order)
          • Set P_InitialOrder[P_Int] = (Issued order)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is in P_Group[P_Int]) Equal to True
            • Then - Actions
              • Unit Group - Pick every unit in P_Group[P_Int] and do (Actions)
                • Loop - Actions
                  • Set P_XofUnit = (X of (Position of (Picked unit)))
                  • Set P_YofUnit = (Y of (Position of (Picked unit)))
                  • Set P_XResult = (P_XResult + P_XofUnit)
                  • Set P_YResult = (P_YResult + P_YofUnit)
                  • Set P_Count = (P_Count + 1)
              • Set P_Center[P_Int] = (Point((P_XResult / (Real(P_Count))), (P_YResult / (Real(P_Count)))))
              • Set P_OrderAngle[P_Int] = (Angle from P_Center[P_Int] to P_Target[P_Int])
              • Set P_Distance[P_Int] = (Distance between P_Center[P_Int] and P_Target[P_Int])
              • Set P_XofUnit = 0.00
              • Set P_XResult = 0.00
              • Set P_YofUnit = 0.00
              • Set P_YResult = 0.00
              • Set P_Count = 0
              • Unit Group - Pick every unit in P_Group[P_Int] and do (Actions)
                • Loop - Actions
                  • Set P_OrderUnit[P_Int] = (Picked unit)
                  • Set P_OrderPoint[P_Int] = (Position of P_OrderUnit[P_Int])
                  • Trigger - Turn off (This trigger)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between P_OrderPoint[P_Int] and P_Center[P_Int]) Greater than or equal to 350.00
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • P_InitialOrder[P_Int] Equal to (Order(smart))
                        • Then - Actions
                          • Unit - Order P_OrderUnit[P_Int] to Right-Click P_Target[P_Int]
                          • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(move))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Move To P_Target[P_Int]
                              • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                            • Else - Actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Distance between P_Target[P_Int] and P_Center[P_Int]) Less than 125.00
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(smart))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Right-Click P_Target[P_Int]
                              • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • P_InitialOrder[P_Int] Equal to (Order(move))
                                • Then - Actions
                                  • Unit - Order P_OrderUnit[P_Int] to Move To P_Target[P_Int]
                                  • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • P_InitialOrder[P_Int] Equal to (Order(attack))
                                    • Then - Actions
                                      • Unit - Order P_OrderUnit[P_Int] to Attack-Move To P_Target[P_Int]
                                      • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                                    • Else - Actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • P_InitialOrder[P_Int] Equal to (Order(smart))
                            • Then - Actions
                              • Unit - Order P_OrderUnit[P_Int] to Right-Click (P_OrderPoint[P_Int] offset by P_Distance[P_Int] towards P_OrderAngle[P_Int] degrees)
                              • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • P_InitialOrder[P_Int] Equal to (Order(move))
                                • Then - Actions
                                  • Unit - Order P_OrderUnit[P_Int] to Move To (P_OrderPoint[P_Int] offset by P_Distance[P_Int] towards P_OrderAngle[P_Int] degrees)
                                  • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • P_InitialOrder[P_Int] Equal to (Order(attack))
                                    • Then - Actions
                                      • Unit - Order P_OrderUnit[P_Int] to Attack-Move To (P_OrderPoint[P_Int] offset by P_Distance[P_Int] towards P_OrderAngle[P_Int] degrees)
                                      • Set P_UnitsOrdered[P_Int] = (P_UnitsOrdered[P_Int] + 1)
                                    • Else - Actions
                  • Trigger - Turn on (This trigger)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • P_UnitsOrdered[P_Int] Equal to (Number of units in P_Group[P_Int])
                • Then - Actions
                  • Set P_OrderUnit[P_Int] = No unit
                  • Custom script: call RemoveLocation( udg_P_OrderPoint[udg_P_Int])
                  • Custom script: call RemoveLocation( udg_P_Target[udg_P_Int])
                  • Custom script: call RemoveLocation( udg_P_Center[udg_P_Int])
                  • Set P_UnitsOrdered[P_Int] = 0
                  • Set P_Distance[P_Int] = 0.00
                  • Set P_OrderAngle[P_Int] = 0.00
                • Else - Actions
            • Else - Actions
Just changed the groups to "Units selected by Owner of Unit" and it stopped working...
 
Last edited:
Status
Not open for further replies.
Top