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

Creep Auto Attack by Point Order

Status
Not open for further replies.
Level 2
Joined
Sep 11, 2012
Messages
8
I've already done the creep spawns trigger. But here's my problem:

pxmkZ.jpg


Creep spawns in 1 2 3 4 and I want them to move by this order:
2 -> A -> B -> C -> D -> 4 -> H...
3 -> D -> C -> B -> A -> 1 -> E...
1 -> E -> F -> G -> H -> 3 -> D...
4 -> H -> G -> F -> E -> 2 -> A...
How the hell can I make this simple.. ?
It will be crazy too create so many dump trigger..
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Make a regions at each point. In the initialization store the regions under variables with index or in hashtable. Then with loop add the condition to the trigger which would move them that a unit enters a region[x].

For action loop them and if the unit enter region[x] make it move (depending of its unit-type maybe?) to region[x+1] or region [x-1].

@rulerofiron99 I think he's saying that he's too lazy to make triggers for each region...
 
Level 2
Joined
Sep 11, 2012
Messages
8
I'm new to this. I've just learned some war3 basic trigger for a few days. It's different from Starcraft so..

When you create each unit, add it to a unit group based on where it spawned.

Make a region for each location, and an associated trigger. In this trigger, the entering unit is ordered to a new location based on which unit group it is in.

I think it will be a mess if I use Entering event like that..

can he querry commands? for example,

attack ground region A attack ground region B, like using the shift in real game time?

I dunno about querry commands. Please, more clearly.

Make a regions at each point. In the initialization store the regions under variables with index or in hashtable. Then with loop add the condition to the trigger which would move them that a unit enters a region[x].

For action loop them and if the unit enter region[x] make it move (depending of its unit-type maybe?) to region[x+1] or region [x-1].

@rulerofiron99 I think he's saying that he's too lazy to make triggers for each region...

"Then with loop add the condition to the trigger which would move them that a unit enters a region[x]. "
"(depending of its unit-type maybe?)"

Further please.

My plan is to create 4 group unit of player 12 in 1 2 3 4 and make them move by other. I only have done the spawn trigger. I could make it move from 1 -> A but A -> B will be crazy.. Also the group from 3 -> D -> C -> B -> A. I think it means I can't use the entering event.

Thanks for answer guys.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Event - Unit enters region A
Conditions - none
Actions -
If boolean - unit is in unit group - triggering unit is in (spawnedAt2)
Then - Order triggering unit to attack move to region B
Else - none

Now you can have multiple of these if/then/else functions in each trigger. So you'll create one trigger for each of the regions that units enter, and tell them where to go based on which group they are in.

You add them to the unit group when they spawn using the Unit Group - Add (last created unit group) to (spawnedAt2 - your unit group variable)
 
Level 2
Joined
Sep 11, 2012
Messages
8
Hmn.. So i can make them move 2 -> A -> B -> C -> D -> 4 but will they move to H -> G -> F -> E -> 2 -> A... ?
And how do I add spawned unit to group? I mean I created only one trigger for spawning in 1 2 3 4 with at least 2 unit in one Action.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Like this:
  • Spawn trigger
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 4 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to spawn1
      • Unit - Create 4 Footman for Player 1 (Red) at (Center of Region 000 <gen>) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to spawn1
And an example of the region trigger:
  • Point A
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in spawn1) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Center of Region 002 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in spawn2) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Center of Region 001 <gen>)
        • Else - Actions
Note that these all have memory leaks, here's a tutorial on removing them: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/basic-memory-leaks-5889/
 
Level 2
Joined
Sep 11, 2012
Messages
8
Your example of the region trigger means I must make at least 1 trigger/region ? So I must create about 12 triggers for that? ._.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Level 2
Joined
Sep 11, 2012
Messages
8
I still not clearly about memory leaks. What is it? Why should I remove it?

Also In my map. I want to make creep patrol forever in the Region so I dont need to use: call DestroyGroup( udg_tempGroup ) Right?

And an example of the region trigger:
  • Point A
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in spawn1) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Center of Region 002 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in spawn2) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Center of Region 001 <gen>)
        • Else - Actions

Where do I add the custom script in this trigger?
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
You just need to destroy the point/location leaks with RemoveLocation.

You should remove them because they will cause the map to lag after a while. Each memory leak takes up a bit of RAM, and when you run out of memory space, it slows down.

This is false, as he is using a center of a region which he will most likely use over and over it is suffcient enough to just store the location and re-use the variable.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
This is false, as he is using a center of a region which he will most likely use over and over it is suffcient enough to just store the location and re-use the variable.

Then how is what I said false?

We're already at two arrays to keep track of, no need to over complicate it with another.

I've done the script in Creep spawn trigger but what about Region trigger?
You should do it there as well.
 
Level 2
Joined
Sep 11, 2012
Messages
8
No I mean Where?

  • Dark Force 01 Move
    • Events
      • Unit - A unit enters Dark Force 01 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in TopRightSpawn) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of Top Right 01 <gen>)
        • Else - Actions
  • TopRight 01 Move
    • Events
      • Unit - A unit enters Top Right 01 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in TopRightSpawn) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of Top Right 02 <gen>)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in BottomRightSpawn) Equal to True
        • Then - Actions
          • Unit - Order (Triggering unit) to Attack-Move To (Center of Dark Force 03 <gen>)
        • Else - Actions
Btw: this is my creep spawn trigger, check it for me please.

  • Spawn Test
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Set DarkForce01 = Dark Force 01 <gen>
      • Set DarkForce02 = Dark Force 02 <gen>
      • Set DarkForce03 = Dark Force 03 <gen>
      • Set DarkForce04 = Dark Force 04 <gen>
      • Unit - Create 5 Assassin for Player 12 (Brown) at (Center of Dark Force 03 <gen>) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to BottomRightSpawn
      • Unit - Create 4 Enforcer for Player 12 (Brown) at (Center of Dark Force 03 <gen>) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to BottomRightSpawn
      • Unit - Create 2 Bandit Lord for Player 12 (Brown) at (Center of Dark Force 03 <gen>) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to BottomRightSpawn
      • Unit - Create 5 Assassin for Player 12 (Brown) at (Center of Dark Force 01 <gen>) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to TopRightSpawn
      • Unit - Create 4 Enforcer for Player 12 (Brown) at (Center of Dark Force 01 <gen>) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to TopRightSpawn
      • Unit - Create 2 Bandit Lord for Player 12 (Brown) at (Center of Dark Force 01 <gen>) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to TopRightSpawn
      • Custom script: call RemoveLocation( udg_DarkForce01 )
      • Custom script: call RemoveLocation( udg_DarkForce02 )
      • Custom script: call RemoveLocation( udg_DarkForce03 )
      • Custom script: call RemoveLocation( udg_DarkForce04 )
 
Last edited:
Level 25
Joined
Jul 10, 2006
Messages
3,315
When it comes to move unit from this to that, destroying is absolutly not necessary.

I just made a testmap where I reference (center of region) 300 times a second, my memory usage went up by over 1MB a second. Of course this is me stress testing it, but the point is that if you reference a (center of region), you are going to have a bad time.


@ topic:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
    • ((Triggering unit) is in TopRightSpawn) Equal to True
  • Then - Actions
    • Set pointVariable = Center of Top Right 02 <gen>
    • Unit - Order (Triggering unit) to Attack-Move To pointVariable
    • Custom script: call RemoveLocation(udg_pointVariable)
  • Else - Actions
 
Status
Not open for further replies.
Top