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

Waves

Status
Not open for further replies.
  • Wave Spawn
    • Events
      • Time - Every x seconds of game time
    • Conditions
      • Conditions
    • Actions
      • Set Spawn_Area = (Where you want the units to spawn)
      • Set Attack_Move_Loc = (Where you want the units to attack move)
      • Unit - Create units... at Spawn_Area
      • Custom script - call RemoveLocation(udg_Spawn_Area)
      • -------- If you created 1 unit of that type --------
      • Unit - Order (Last Created Unit) to Attack-Move to Attack_Move_Loc
      • Custom script - call RemoveLocation(udg_Attack_Move_Loc)
      • -------- If you created more than 1 unit of that type --------
      • Custom script - set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Last Created Unit Group) to do Unit - Attack-Move to Attack_Move_Loc
      • Custom script - call RemoveLocation(udg_Attack_Move_Loc)
My first attempt at making a leakless trigger; tell me if I did it right, please.
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Wave Spawn
    • Events
      • Time - Every x seconds of game time
    • Conditions
      • Conditions
    • Actions
      • Set Spawn_Area = (Where you want the units to spawn)
      • Set Attack_Move_Loc = (Where you want the units to attack move)
      • Unit - Create units... at Spawn_Area
      • Custom script - call RemoveLocation(udg_Spawn_Area)
      • -------- If you created 1 unit of that type --------
      • Unit - Order (Last Created Unit) to Attack-Move to Attack_Move_Loc
      • Custom script - call RemoveLocation(udg_Attack_Move_Loc)
      • -------- If you created more than 1 unit of that type --------
      • Custom script - set bj_wantDestroyGroup = true
      • Unit Group - Order (Last Created Unit Group) to do Unit - Attack-Move to Attack_Move_Loc
      • Custom script - call RemoveLocation(udg_Attack_Move_Loc)
My first attempt at making a leakless trigger; tell me if I did it right, please.
I'm pretty sure you can't use "...Order (Last Created Unit Group)..." action ?
Don't know about that
Have you tried it in WE, and does it work ?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
No, I mean for Unit Group, the Pick Every Unit... action is LEAK, therefore you should clean it by using the custom script I typed
But, I don't know if same principle applies for Pick Every Item... action
  • Custom script: set bj_wantDestroyGroup = true
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
HAHA I was brainwashed by my OWN statement, LOL

I mean like, does it work for that Last Created Unit Group action ?
I think you have to check it first by using Pick Every Item... and in the Loop, you can use If/Then/Else condition to check on the type of unit of wave
(I was mistaken for this thread, and item thread, LOL)
 
Level 8
Joined
Oct 31, 2010
Messages
238
I don't think it's leakless; though.

Review !

[trigger="Region 1"]
Region 1
Events
Unit - A unit enters Region 000 <gen>
Conditions
Actions
Unit - Order (Entering unit) to Attack-Move To (Center of Region 001 <gen>)
[/trigger]

The leak:
  • Unit - Order (Entering unit) to Attack-Move To (Center of Region 001 <gen>)
Attack-Move to [^Leak]

You should do this:
  • Actions
    • Set TempPoint = (Center of Region 001 <gen>)
    • Unit - Order (Entering unit) to Attack-Move To TempPoint
    • Custom script: call RemoveLocation(udg_TempPoint)
Next, there are no conditions! That means any unit who enters this region will receive the command.
So, you should add the condition (If owner of Units supposed to be Player 2):
  • Conditions
    • (Owner of (Triggering unit)) Equal to (==) Player 2 (Blue)
The same for the other similar triggers.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Regions DOES leaks BUT, we can use Point-type variable to clean up the leaks
IF you clean up a Region, how would you suppose to send out more order through the trigger using that Region again, if it has been cleaned.. ?
The trigger will return a null function, bug game !
Btw, to clean Region, do this:
  • Custom script: call RemoveRect(udg_"VariableName")
Just for information =D
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Depening on who owns the units, they may try to return to point of creation. Many people thus use patrol instead of attack move.

Also for people compaining, both regions and rects leak
A rect is not a region although it is incorrectly labled so in GUI.

A region is a collection of rects and mapcells.
A rect is an area of the playfield.

Both are 2 different types. Although you can convert a rect into a region you can not convert a region into a rect.

For static/constant points on the map (places that never chage), it is advisable to use a location to represent it and to reuse that location. For example if you want units to folow a path for a TD, the corner destiations should be the same locations which are reused for every unit.

Additionally you can use X/Y cordinate pairs but if you use the same point a lot then locations should save time (due to 1 less passed argument and other time savers).
 
Level 8
Joined
Oct 31, 2010
Messages
238
Status
Not open for further replies.
Top