• 🏆 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!

[General] Mass unit controll causing wierd issues

Status
Not open for further replies.
Level 15
Joined
Jul 9, 2008
Messages
1,552
ok so on my map you use alot of units and i have created a few triggerd abilitys to controll them but after they are used the units dont move properly. they tend to move then stop and wait for each other then move and stop and wait for each other ect...ect. also if u try to controll the units afterwould they dont seam to respond and only face the direction ur trying to move them.

here are the triggers for the abilitys they are very simple
  • Mass send
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Send
    • Actions
      • Set Mass_Point = (Target point of ability being cast)
      • Set TempGroup = (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To Mass_Point
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_Mass_Point)
  • Mass Retreat
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Retreat
    • Actions
      • Set Mass_Point = ((Owner of (Casting unit)) start location)
      • Set TempGroup = (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Move To Mass_Point
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_Mass_Point)
 
Level 6
Joined
May 20, 2014
Messages
228
Both triggers pick every unit in the map (since you didn't specify the unit owned by what player), and attempts to order them to move. Normally it's fine if you don't have many units, but a lot of units (maybe over 100?) will cause unit movement to lag and not be smooth (and will also have a hard time responding to commands).

If you try and trigger them with less than that amount then it will be fine and they should move smoothly. But there's no way to fix unit movement lag in WC3.
 
Level 12
Joined
May 20, 2009
Messages
822
You don't have to do your group that way. You can just do,
  • Set afasf = (Units owned by (Owner of (Triggering unit)))
It's incredibly likely that it's because you're destroying the point, before they even reach their destination. I had this same problem with my custom movement system and it's why I had to set it up the way it's set up right now. When you destroy that point, you're also destroying the point that they are getting ordered to since it's all the same point, and so they can't continue the order when the point is destroyed. This is because that variable is referencing the same point in memory that their orders are referencing. You will need a periodic timer that checks every so often if each individual unit is within a reasonable distance of the target point, then destroy it. The most clever way would be to just keep track of every unit in the group and make sure they are all within range before destroying the point, but that would have some problems. (Namely, the point may never be destroyed because some units might not be able to reach it at all like ships or units across impassable Terrain). Or, you could just index each unit and create a new point for each one and compare their distance to this point then destroy it. This way each unit has their own point they are compared to. You could also make a timer to check if they've taken too long to reach the point for both of these.

This is just from my understanding of how point variables work in WC3, which I may be wrong but I'm pretty sure I'm right.

That is most-likely what it is, but after doing some small testing it appears that sometimes if the path finding cannot find a way to the point, the unit doesn't move at all but will still turn. Though usually they will at least try to find a path by moving around, probably to see if there is a path that is just obstructed by fog. This probably isn't it, but it is a possibility.
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
Both triggers pick every unit in the map (since you didn't specify the unit owned by what player), and attempts to order them to move. Normally it's fine if you don't have many units, but a lot of units (maybe over 100?) will cause unit movement to lag and not be smooth (and will also have a hard time responding to commands).

If you try and trigger them with less than that amount then it will be fine and they should move smoothly. But there's no way to fix unit movement lag in WC3.

i do select the units by the owner of the triggering unit (unit casting the spell)

i believe its got somthing to do with there being to manny units it does seem to work fine with less units tho the units dont clump up and stuff with the big amount of units if i move them manualy.

You don't have to do your group that way. You can just do,
  • Set afasf = (Units owned by (Owner of (Triggering unit)))
It's incredibly likely that it's because you're destroying the point, before they even reach their destination. I had this same problem with my custom movement system and it's why I had to set it up the way it's set up right now. When you destroy that point, you're also destroying the point that they are getting ordered to since it's all the same point, and so they can't continue the order when the point is destroyed. This is because that variable is referencing the same point in memory that their orders are referencing. You will need a periodic timer that checks every so often if each individual unit is within a reasonable distance of the target point, then destroy it. The most clever way would be to just keep track of every unit in the group and make sure they are all within range before destroying the point, but that would have some problems. (Namely, the point may never be destroyed because some units might not be able to reach it at all like ships or units across impassable Terrain). Or, you could just index each unit and create a new point for each one and compare their distance to this point then destroy it. This way each unit has their own point they are compared to. You could also make a timer to check if they've taken too long to reach the point for both of these.

This is just from my understanding of how point variables work in WC3, which I may be wrong but I'm pretty sure I'm right.

That is most-likely what it is, but after doing some small testing it appears that sometimes if the path finding cannot find a way to the point, the unit doesn't move at all but will still turn. Though usually they will at least try to find a path by moving around, probably to see if there is a path that is just obstructed by fog. This probably isn't it, but it is a possibility.

so ur saying that the removal of the variable point they are set to move to is removed could be causing the issue?

You would have to set the location variable and destroy it inside the loop action.

tryed that and still had issues
  • Unit Group - Pick every unit in TempGroup and do (Actions)
    • Loop - Actions
      • Set Mass_Point = (Target point of ability being cast)
      • Unit - Order (Picked unit) to Attack-Move To Mass_Point
      • Custom script: call RemoveLocation(udg_Mass_Point)
 
Level 12
Joined
May 20, 2009
Messages
822
so ur saying that the removal of the variable point they are set to move to is removed could be causing the issue?

Yes, because your variable is referencing the same point they are ordered to move and you destroy that point before any of them get a chance to move. With that in mind, it should still break even if there's only 1 unit. Try testing that.
 
Level 12
Joined
May 20, 2009
Messages
822
so how can i trigger it so i dont have problems with leaks

As I said, you can either compare the distance of every unit in that group to the targeted point then remove the point when everyone is reasonably close enough or compare each unit to their own point that they are moving to. The former would probably be less stressful on the system. So You'd have to keep track of it as well, probably by removing the unit from the group. It will probably look something like this:

  • Mass send
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Send
    • Actions
      • Set Mass_Point[(Player number of (Triggering player))] = (Target point of ability being cast)
      • Set TempGroup[(Player number of (Triggering player))] = (Units owned by (Owner of (Triggering unit)))
      • Unit Group - Pick every unit in TempGroup[(Player number of (Triggering player))] and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack-Move To Mass_Point
  • mass send loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
  • For each (Integer integer) from 1 to 15, do (Actions)
    • Loop - Actions
      • Unit Group - Pick every unit in TempGroup[integer] and do (Actions)
        • Loop - Actions
          • Set TempPoint[integer] = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between TempPoint[integer] and Mass_Point[integer] Less than or equal to 200.00
            • Then - Actions
              • Unit Group - Remove (Picked unit) from TempGroup[integer]
            • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup[integer] Less than 1
        • Then - Actions
          • Custom script: call RemoveLocation(udg_Mass_Point[integer])
        • Else - Actions

You also don't need to destroy the group because you're never making more than 1 group throughout the entire game, and you also need to make your variables arrays because this actually will only work for one player.
 
Last edited:
Status
Not open for further replies.
Top