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

Creeps not following regions with attack-ground order

Status
Not open for further replies.

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
Hi! I've been trying to make the creeps follow a given route of regions, and made a trigger for this. For some reason, they walk to route to the first region decently, but after that they start going off in different directions; either back to the spawn point, or staying at the region, or going to the next and THEN returning. I've been experimenting with a few different settings in the trigger, to no good result. I'll post the trigger below here.


Ghoul Move Copy
Events
Unit - A unit enters Scourge Base West <gen>
Unit - A unit enters West WP7 <gen>
Unit - A unit enters West WP6 <gen>
Unit - A unit enters West WP5 <gen>
Unit - A unit enters West WP4 <gen>
Unit - A unit enters West WP3 <gen>
Unit - A unit enters West WP2 <gen>
Unit - A unit enters West WP1 <gen>
Conditions
(Owner of (Entering unit)) Equal to Player 11 (Dark Green)
Actions
Unit Group - Pick every unit in (Units in Scourge Base West <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP7 <gen>))
Unit Group - Pick every unit in (Units in West WP7 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP6 <gen>))
Unit Group - Pick every unit in (Units in West WP6 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP5 <gen>))
Unit Group - Pick every unit in (Units in West WP5 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP4 <gen>))
Unit Group - Pick every unit in (Units in West WP4 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP3 <gen>))
Unit Group - Pick every unit in (Units in West WP3 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP2 <gen>))
Unit Group - Pick every unit in (Units in West WP2 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP1 <gen>))
Unit Group - Pick every unit in (Units in West WP1 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Night Elf West Spawn <gen>))


This is my trigger, and for some reason it screws up. The regions are named WP1-7, where 1 is the closest to my base, and 7 the furthest. Help very much appreciated. :)
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
  • Ghoul Move Copy
    • Events
      • Unit - A unit enters Scourge Base West <gen>
      • Unit - A unit enters West WP7 <gen>
      • Unit - A unit enters West WP6 <gen>
      • Unit - A unit enters West WP5 <gen>
      • Unit - A unit enters West WP4 <gen>
      • Unit - A unit enters West WP3 <gen>
      • Unit - A unit enters West WP2 <gen>
      • Unit - A unit enters West WP1 <gen>
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 11 (Dark Green)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Scourge Base west) contains (triggering unit)) equal to true
        • Then - Actions
          • Unit Group - Pick every unit in (Units in Scourge Base West <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP7 <gen>))
          • Else - Actions
        • If (all conditions are true) then do (then actions) else do (else actions)
          • If - Conditions
            • ((West WP7 <gen>) contains (triggering unit)) equal to true
          • Then - actions
            • Unit Group - Pick every unit in (Units in West WP7 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP6 <gen>))
            • Else - actions
          • If (all conditions are true) then do (then actions) else do (else actions)
            • If - conditions
              • ((West WP6 <gen> ) contains (triggering unit)) equal to true
            • Then - actions
              • Unit Group - Pick every unit in (Units in West WP6 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP5 <gen>))
              • Else - actions
        • If (all conditions are true) then do (then actions) else do (else actions)
          • If - conditions
            • ((West WP5 <gen>) contains (triggering unit)) equal to true
          • Then - actions
            • Unit Group - Pick every unit in (Units in West WP5 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP4 <gen>))
            • Else - actions
        • If (all conditions are true) then do (then actions) else do (else actions)
          • If - conditions
            • ((West WP4 <gen>) contains (triggering unit)) equal to true
          • Then - actions
            • Unit Group - Pick every unit in (Units in West WP4 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP3 <gen>))
          • Else - actions
        • If (all conditions are true) then do (then actions) else do (else actions)
          • If - conditions
            • ((West WP3 <gen>) contains (triggering unit)) equal to true
          • Then - actions
            • Unit Group - Pick every unit in (Units in West WP3 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP2 <gen>))
            • Else - actions
          • If (all conditions are true) then do (then actions) else do (else actions)
            • If - conditions
              • ((West WP2 <gen>) contains (triggering unit)) equal to true
            • Then - actions
              • Unit Group - Pick every unit in (Units in West WP2 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of West WP1 <gen>))
              • Else - actions
            • If (all conditions are true) then do (then actions) else do (else actions)
              • If - conditions
                • ((West WP1 <gen>) contains (triggering unit)) equal to true
              • Then - actions
                • Unit Group - Pick every unit in (Units in West WP1 <gen>) and do (Unit - Order (Picked unit) to Attack-Move To (Center of Night Elf West Spawn <gen>))
                • Else - actions
There fixed
 
  • Like
Reactions: Esa

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
Thanks a great deal for the answer, and the fix! You guys are talking about something leaking, is that the fix of "InfinateAnswers" you're talking about? If it is, do you have any suggestion to prevent the leaking?

To clarify what I am talking about here, this is almost a dota copy. Three sets of monsters spawn at three separate places, and walks three separate "lanes" to the same target.
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
That fix appeared to solve my problem, but spawned a new problem. The monsters appear to be stopping when they reach a region. I tried to increase the size of the region, thinking that "the centre of" said region would be too small. That worked, but then they stopped at the next region, and resizing there did not cut it. Any tips? My current trigger is equal to the one up above, except I've used "triggering unit" instead of "unit group" as you said. Also, I used attack-move to "center of said region".
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
Yes, that is true. I think I did correct that, so this is how it looks now:
  • Archers Move
    • Events
      • Unit - A unit enters Night Elf West Spawn <gen>
      • Unit - A unit enters West WP1 <gen>
      • Unit - A unit enters West WP2 <gen>
      • Unit - A unit enters West WP3 <gen>
      • Unit - A unit enters West WP4 <gen>
      • Unit - A unit enters West WP5 <gen>
      • Unit - A unit enters West WP6 <gen>
      • Unit - A unit enters West WP7 <gen>
    • Conditions
      • (Owner of (Entering unit)) Equal to Player 12 (Brown)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Night Elf West Spawn <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of West WP1 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (West WP1 <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of West WP2 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (West WP2 <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of West WP3 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (West WP3 <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of West WP4 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (West WP4 <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of West WP5 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (West WP6 <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of West WP7 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (West WP7 <gen> contains (Triggering unit)) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of Scourge Base West <gen>)
        • Else - Actions
Did I stop the leak with this? Or is it still leaking, and how can I find out if/where and how to fix it?
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
The monsters still stop at random regions. Is this something that can be caused by other trigger leaks? I have a lot of triggers in addition to the one you just fixed.

edit: Ah, lol, thanks Raven. Will correct that then recheck this statement.

edit2: Nope, they still stop at 2 specific regions, and only the scourge side does. The triggers are 100% identical, only refitted to suit the other faction. Only the scourge side is stopping, and that is at West WP7 and East WP4.
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
How do you suggest that I fix that leak? By doing what you wrote above?
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
So if i use a respawn system, Create 1 boar in (random point) within (region), its leaking?

Yes it does.

JASS:
function GetRandomLocInRect takes rect whichRect returns location
    return Location(GetRandomReal(GetRectMinX(whichRect), GetRectMaxX(whichRect)), GetRandomReal(GetRectMinY(whichRect), GetRectMaxY(whichRect)))
endfunction

You make a point variable and each time there is a new center, you set it.

First you set it, after use you call custom script: call RemoveLocation(udg_NAMEOFVARIABLE)
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
I did, but I am afraid I need it dumbed down even more. I am guessing that
  • Set loc = Somewhere
  • Unit - Create 1 unit at loc
  • Custom script: call RemoveLocation(udg_loc)
is what I need to use, as I don't use unit groups or variables. Can you explain to me how I prevent a leac by setting the location then deleting it? Also, how should I do it? In front of every trigger I have, should I set a location, then delete the location after the unit has been made? If that is the general idea, I understand the concept, just not how to do it.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
When a location is created. That location stays in the games memory, so that predetermined location wont be used again, but the game saves it. So you keep creating new locations, and it keeps saving them. Without deleting the locations once you are done with them, the game will keep making them. 1 leak wont bother the game that much, but if you have alot of triggers that leak, then your game will lag once you reach a point and the triggers have leaked enough.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
I did, but I am afraid I need it dumbed down even more. I am guessing that
  • Set loc = Somewhere
  • Unit - Create 1 unit at loc
  • Custom script: call RemoveLocation(udg_loc)
is what I need to use, as I don't use unit groups or variables. Can you explain to me how I prevent a leac by setting the location then deleting it? Also, how should I do it? In front of every trigger I have, should I set a location, then delete the location after the unit has been made? If that is the general idea, I understand the concept, just not how to do it.

That's how you do it. Before refering to any location,for example: creating unit at location,you need to set that location in a variable,create unit at location variable and then clear it.

InfinateAnswers,
That has been explained in links i gave.
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
I may be stupid in this kind of stuff, but I am not ignorant Infinate. I did read it, but as I said I needed it dumbed down more. ^_^ Meh, sorry to bother you lot with all this, I'm sure I could've googled it (not that I didn't try), but having someone to explain it I guess made it go faster.

A question, is the variable I'm making a point variable, or real? And I am guessing it is not array. I didn't understand that in any of the link, how I can tell without asking what it should be. I have made an attempt now, and it looks like this:


  • Events
    • Time - Every 25.00 seconds of game time
  • Conditions
  • Actions
    • Set loc = (Center X of Night Elf West Spawn <gen>)
    • Unit - Create 3 Sentry for Player 12 (Brown) at (Center of Night Elf West Spawn <gen>) facing 0.00 degrees
    • Custom script: Custom script: call RemoveLocation(udg_loc)
Also, how do I deal with this when talking of multiple locations in 1 trigger? I have a trigger that spawns monsters at 6 different places every 300 seconds.

edit: I tried saving the map with that change made to all my spawning triggers, but it wasn't valid or something. Then they got disabled, so loaded from my backup now.
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
Well a real is a number, and a point is a location. So using a point is your best bet for location leaks. Now array is useful because you dont have to create 100 variables if your doing the same thing, fixing a location leak. What you can do is check the array, and for every new location leak when it asks for index put +1 higher number than you used last time. So 1 variable can fix 1000+ leaks as many times as you use the triggers.
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
I tried making the said changes to the variable, but still got the error. This is what the trigger looks like:


  • Actions
    • Set loc[0] = (Center of Night Elf West Spawn <gen>)
    • Unit - Create 3 Sentry for Player 12 (Brown) at (Center of Night Elf West Spawn <gen>) facing 0.00 degrees
    • Custom script: Custom script: call RemoveLocation(udg_loc)
I tried adding "()" behind udg_loc, and also tried (center X of Night Elf West Spawn <gen>) but got the same result. Also tried adding "[0]" behind udg_loc.
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
Ah, okay. And when I'm talking of other spawn points, what should I call them? loc[1] and so on?

  • Actions
    • Set loc[0] = (Center of Night Elf West Spawn <gen>)
    • Unit - Create 3 Sentry for Player 12 (Brown) at loc[0] facing 0.00 degrees
    • Custom script: Custom script: call RemoveLocation(udg_loc[0])
This trigger just got the same error. It's a point variable with array. :eek: I set the variable by a value, not arithmetic (0+1)
 
Level 4
Joined
Jul 24, 2010
Messages
85
Hi! I've been trying to make the creeps follow a given route of regions, and made a trigger for this. For some reason, they walk to route to the first region decently, but after that they start going off in different directions; either back to the spawn point, or staying at the region, or going to the next and THEN returning.

The reason that units don't move to area or stop because of AI Script.
I do believe that the reason is not about leak but because of AI system.

  • AI - Ignore the guard positions of all Player 1 (Red) units
Try this, if still have problem, tell us more.

Leak isn't problem but it is important.
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
As an initializing trigger? Player 1,3,4,5 are night elf players, whilst 2,6,7,8 are scourge. Should I make that trigger for each of those players? The computers are 11(scourge) and 12(nightelf).

I have removed the melee ai in this game.
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
THen by that logic, then there is something wrong with what I am ordering them to do, as they stop in two locations. :p
 
Level 4
Joined
Jul 24, 2010
Messages
85
Then it doesn't matter... If melee AI is removed computer players's units are just like dummies-you have to controll them manually by triggers and they won't deny to do what you make them to do :D

It seems to be strange. If you remove melee AI, the computer still have AI for no reason (Melee AI only remove building base AI, they can still attack, move, and use ability). That's why we need to turn Guard AI off.

Set it as initialization.

Stop in two location means its reason definitely comes from AI script as the trigger can't be random location.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Ah, okay. And when I'm talking of other spawn points, what should I call them? loc[1] and so on?

  • Actions
    • Set loc[0] = (Center of Night Elf West Spawn <gen>)
    • Unit - Create 3 Sentry for Player 12 (Brown) at loc[0] facing 0.00 degrees
    • Custom script: Custom script: call RemoveLocation(udg_loc[0])
This trigger just got the same error. It's a point variable with array. :eek: I set the variable by a value, not arithmetic (0+1)

If you still get error with this trigger,then the error is obvious.
  • Custom script: Custom script: call RemoveLocation(udg_loc[0])
this line contains "Custom Script" twice,you don't have to write it. Just change it to this
  • Custom script: call RemoveLocation(udg_loc[0])
Lulz
 

Esa

Esa

Level 4
Joined
Nov 10, 2010
Messages
79
Hm, that'd be splendid. I don't think I did the double custom error, but that could be. Doh. Will recheck it later.
 
Status
Not open for further replies.
Top