HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

My "Grab" System

06-24-2007, 05:16 AM#1
Tide-Arc Ephemera
Yeah, I posted this in another topic...
http://www.wc3campaigns.net/showthre...194#post943194

#1
I think I might make a map using this system, but I was just curious how to fix the leaks... They all have the same leak, so I'll just post one up.

Trigger:
Move
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Unit-type of (Casting unit)) Equal to Melee Command Tower
(Ability being cast) Equal to Move (Neutral Hostile)
Collapse Actions
Game - Display to (Player group((Owner of (Casting unit)))) the text: Ordering melee unit...
Collapse Unit Group - Pick every unit in Melee[(Player number of (Owner of (Casting unit)))] and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Move To (Target point of ability being cast)

Would the solution to this be...
Trigger:
Move DeLeaked
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Unit-type of (Casting unit)) Equal to Melee Command Tower
(Ability being cast) Equal to Move (Neutral Hostile)
Collapse Actions
Game - Display to (Player group((Owner of (Casting unit)))) the text: Ordering melee unit...
Set RemoveLeak = Melee[(Player number of (Owner of (Casting unit)))]
Collapse Unit Group - Pick every unit in RemoveLeak and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Move To (Target point of ability being cast)
Custom script: call DestroyGroup(udg_RemoveLeak)

#2
Now here's one that REALLY bothers me, because I can't find any real way of de-leaking it without having to completely alter the foundations of it (which I don't want to do.

I want to make it so that units can be continuously added into the group.

Trigger:
Select
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Unit-type of (Casting unit)) Equal to Melee Command Tower
(Ability being cast) Equal to Select
Collapse Actions
Collapse Unit Group - Pick every unit in (Units within 300.00 of (Target point of ability being cast)) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Owner of (Casting unit)) Equal to (Owner of (Picked unit))
((Picked unit) is in Melee[(Player number of (Owner of (Casting unit)))]) Equal to False
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Unit-type of (Picked unit)) Equal to Footman
(Unit-type of (Picked unit)) Equal to Knight
Collapse Then - Actions
Game - Display to (Player group((Owner of (Casting unit)))) the text: ((Name of (Picked unit)) + has been grabbed.)
Unit Group - Add (Picked unit) to Melee[(Player number of (Owner of (Picked unit)))]
Collapse Else - Actions
Do nothing
___

So... my questions are...

- #1 Have I solved the leak?
- #2 How the hell do I solve the leak?
06-24-2007, 07:11 AM#2
Pyrogasm
In the first trigger, you've still got a point leak. You'll want to do this:
Trigger:
Set TempPoint = (Target point of ability being cast)
Collapse Unit Group - Pick every unit in Melee[(Player number of (Owner of (Casting unit)))] and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Move To TempPoint
Custom script: call RemoveLocation(udg_TempPoint)
Additionally, replace all instances of "Casting Unit" with "Triggering Unit"

As to your second trigger, you're leaking a group and a point; to fix it, simply add these lines before the "Pick every unit..." line:
Trigger:
Set TempPoint = (Target point of ability being cast)
Custom script: set bj_wantDestroyGroup = true
And this line after it:
Trigger:
Custom script: call RemoveLocation(udg_TempPoint)
06-24-2007, 07:46 AM#3
Tide-Arc Ephemera
Quote:
Originally Posted by Pyrogasm
In the first trigger, you've still got a point leak. You'll want to do this:
Trigger:
Set TempPoint = (Target point of ability being cast)
Collapse Unit Group - Pick every unit in Melee[(Player number of (Owner of (Casting unit)))] and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Move To TempPoint
Custom script: call RemoveLocation(udg_TempPoint)
Additionally, replace all instances of "Casting Unit" with "Triggering Unit"

I was aware of the point leak, just was too lazy to repair it at the time.

Quote:
Originally Posted by Pyrogasm
As to your second trigger, you're leaking a group and a point; to fix it, simply add these lines before the "Pick every unit..." line:
Trigger:
Set TempPoint = (Target point of ability being cast)
Custom script: set bj_wantDestroyGroup = true
And this line after it:
Trigger:
Custom script: call RemoveLocation(udg_TempPoint)

So... I didn't have an actual leak? It was just a point leak? Or is my Pick All Units and Add To Group thing bleeding all over the place?
06-24-2007, 07:50 AM#4
Pyrogasm
There was a group leak in the second one, that's all besides the point leaks. In the second trigger, you should again change all instances of "casting unit" to "Triggering Unit".
06-24-2007, 08:12 AM#5
Tide-Arc Ephemera
Why am I using Triggering Unit?

And... how do I fix said Group Leak in #2?
06-24-2007, 08:29 AM#6
Pyrogasm
You fix the group leak by adding the line (Custom script: set bj_wantDestroyGroup = true) right before the Group loop.

As for why you should use "Triggering Unit", it's because "Casting Unit" really is just an extension of "Triggering Unit", and eventually just returns the same thing. Additionally, Triggering Unit carries through waits and stuff while Casting Unit does not.
06-24-2007, 08:34 AM#7
Tide-Arc Ephemera
Um... I don't mean to be retarded/obscure... but could you show me an example of the CS usage?
06-24-2007, 09:10 AM#8
Pyrogasm
Trigger:
Actions
Custom script: set bj_wantDestroyGroup = true
Collapse Unit Group - Pick all units in (Playable Map Area) and do (Actions)
Collapse Loop - Actions
Unit - Explode (Picked Unit)
By using that custom script, you're telling the game that the next group to be created will be destroyed when it's finished looping for all of its units.
06-24-2007, 09:45 AM#9
Tide-Arc Ephemera
Now I might REALLY sound dumb, but is that a boolean-variable comparison?
06-24-2007, 10:39 AM#10
blu_da_noob
Custom script action. You have to type it in yourself.
06-24-2007, 10:59 AM#11
Doomhammer
Are you looking for a kind of mass move system? I.e. one unit sets a destination location, and a defined group of other units - group size 1 to several hundred - moves to that location.
If that's what you're looking for, I could help you out with a pretty good "mass move system". Pm me, or dunno, shout-aloud...
06-25-2007, 05:46 AM#12
Tide-Arc Ephemera
I'm very happy with my mass-move system, thank you very much, I don't need somebody else dashing my hopes.

Anyway, I don't think that will completely satisfy what I want. That destroys the group after it's use, right? In that case, it means that the groups must be reselected over and over again.
06-25-2007, 06:16 AM#13
Pyrogasm
No. It only destroys the created group. This part: "Unit Group - Pick every unit in (Units within 300.00 of (Target point of ability being cast)) and do (Actions)"
06-25-2007, 06:22 AM#14
Tide-Arc Ephemera
I see... thanks for un-leaking my system!

+Rep
06-25-2007, 03:11 PM#15
Pinzu
I got a mass move system that makes them move in formation of 9 units, but I dont need them any more you want it?