Unit Group leak problem

mapguy

New Member
Reaction score
46
Im having a problem, some people just told me that in GUI:
Code:
set g = units in playable map area
pick every units in g and do actions
clear all units from group g
Custom script: call DestroyGroup (udg_g)
causes leak when I destroy the group...

well
how can I solve my problem using only "GUI custom scripts" to create groups, destroy them, pick my units and so on?
 

Ayanami

칼리
Reaction score
288
You've really asked this many times. This uses FirstOfGroup, but whatever, at least it solves your leak issues. You need Recycle. Here's an example of how you use FirstOfGroup. You need NewGen.

Trigger:
  • Untitled Trigger
    • Events
    • Conditions
    • Actions
      • Custom script: local group g = Group.get()
      • Custom script: local real x = GetUnitX(GetTriggerUnit())
      • Custom script: local real y = GetUnitY(GetTriggerUnit())
      • Custom script: local unit u
      • Custom script: call GroupEnumUnitsInRange(g, x, y, 500.00, null)
      • Custom script: loop
      • Custom script: set u = FirstOfGroup(g)
      • Custom script: exitwhen u == null
      • -------- Do actions --------
      • Custom script: call GroupRemoveUnit(g, u)
      • Custom script: endloop
      • Custom script: call Group.release(g)
      • Custom script: set g = null
      • Custom script: set u = null


Basically, you set the condition in the "Do actions" part. x and y is basically the coordinates of the point that you want to take the circle's origin to be, in other words, the "location". But by using x, y we don't need to worry about leaks, unlike locations. GetUnitX(GetTriggerUnit()) and GetUnitY(GetTriggerUnit()) simply means to get the current x and y coordinates of the Triggering unit's position. So let's say I want to get only units that are alive. Then it'll be:

Trigger:
  • Untitled Trigger
    • Events
    • Conditions
    • Actions
      • Custom script: local group g = Group.get()
      • Custom script: local real x = GetUnitX(GetTriggerUnit())
      • Custom script: local real y = GetUnitY(GetTriggerUnit())
      • Custom script: local unit u
      • Custom script: call GroupEnumUnitsInRange(g, x, y, 500.00, null)
      • Custom script: loop
      • Custom script: set u = FirstOfGroup(g)
      • Custom script: exitwhen u == null
      • Custom script: if not IsUnitType(u, UNIT_TYPE_DEAD) then
      • -------- Do actions --------
      • Custom script: endif
      • Custom script: call GroupRemoveUnit(g, u)
      • Custom script: endloop
      • Custom script: call Group.release(g)
      • Custom script: set g = null
      • Custom script: set u = null


You don't use set g = CreateGroup() or DestroyGroup(g) anymore. You replace CreateGroup() with Group.get() and DestroyGroup() with Group.release(). Thus, you need Recycle, as I stated above.

But this really does look ridiculous. No sense of organization. Compare the above chunk of nonsense with this.

JASS:

local group g = Group.get()
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local unit u
call GroupEnumUnitsInRange(g, x, y, 500.00, null)
loop
    set u = FirstOfGroup(g)
    exitwhen u == null
    if not IsUnitType(u, UNIT_TYPE_DEAD) then
        //Do actions
    endif
    call GroupRemoveUnit(g, u)
endloop
call Group.release(g)
set g = null
set u = null


Which one seems more comprehend-able, obviously the one in JASS tags. Thus, using v/JASS would be the best method...
 

hgkjfhfdsj

Active Member
Reaction score
55
not sure if this is the best method..
- make the group local
- set the local as a global
- use GroupEnumUnit....accordingly
- recycle the group
 

hgkjfhfdsj

Active Member
Reaction score
55
but using enum filter function is difficult to squeeze in in gui, which may end up having the filter function in a map header, which isnt that practical considering how many times he will use that.
 

mapguy

New Member
Reaction score
46
now the truth to me, please, which is easier and faster:

1 - Glenphyr solution

or

2 - cause dummy units to damage an area, then I block that damage and detect the source, then, I do my actions, example:
Code:
----lots of other actions are above this one----
If unit type of damage source equal to (fear) then do actions
If damage taken greater than 0.00 then do actions
if damaged_unit is facing Vampire then do actions
add damage_unit to Units_with_fear
//a timer runs when the spell is cast, and when the timer ends the trigger below runs
----lots of more actions are below this one----
Code:
fear timer ends

clear all units from Units_With_fear
My method for me is simple, Im not saying Glenphyr method is wrong, no, Im just saing that for me, Its easier to do my way.
MY WAS IS LEAK FREE?
 

Immolation

Member
Reaction score
20
I think it may be, not sure. However that solution crashes Mac users.

Also, in my opinion Glenph's solution is much better: Recycle is great if you do alot of work with groups, and JASS is much faster than GUI anyway.
 

mapguy

New Member
Reaction score
46
faster?
what do you mean by faster???
you mean less lag?
is it really faster or just like 25% ?
well.
the problem for MAC users is when I deal 0.00 damage in area or when I deal any damage in area?
 

Ayanami

칼리
Reaction score
288
faster?
what do you mean by faster???
you mean less lag?
is it really faster or just like 25% ?
well.
the problem for MAC users is when I deal 0.00 damage in area or when I deal any damage in area?

It's the function "Unit - Damage Area" that causes the problem for Mac users.
 

Immolation

Member
Reaction score
20
[ljass]call UnitDamagePointLoc[/ljass] crashes Mac users, their WC3 just shuts down, regardless of damage, radius, etc...

Also, I dunno how much faster, just faster. That's enough for me.
 

mapguy

New Member
Reaction score
46
lol.
Mac users can't do nothing to prevent this?
well.

lets make a guess.
do you think like 25% of the persons who plays my map uses mac?
or mac users are more like 10%?
Im asking for mac users that playes WC3, not general mac users.
Ill make a poll at game talk forums and ask for what people uses.
 

mapguy

New Member
Reaction score
46
You've really asked this many times. This uses FirstOfGroup, but whatever, at least it solves your leak issues. You need Recycle. Here's an example of how you use FirstOfGroup. You need NewGen.

Trigger:
  • Untitled Trigger
    • Events
    • Conditions
    • Actions
      • Custom script: local group g = Group.get()
      • Custom script: local real x = GetUnitX(GetTriggerUnit())
      • Custom script: local real y = GetUnitY(GetTriggerUnit())
      • Custom script: local unit u
      • Custom script: call GroupEnumUnitsInRange(g, x, y, 500.00, null)
      • Custom script: loop
      • Custom script: set u = FirstOfGroup(g)
      • Custom script: exitwhen u == null
      • -------- Do actions --------
      • Custom script: call GroupRemoveUnit(g, u)
      • Custom script: endloop
      • Custom script: call Group.release(g)
      • Custom script: set g = null
      • Custom script: set u = null


Basically, you set the condition in the "Do actions" part. x and y is basically the coordinates of the point that you want to take the circle's origin to be, in other words, the "location". But by using x, y we don't need to worry about leaks, unlike locations. GetUnitX(GetTriggerUnit()) and GetUnitY(GetTriggerUnit()) simply means to get the current x and y coordinates of the Triggering unit's position. So let's say I want to get only units that are alive. Then it'll be:

Trigger:
  • Untitled Trigger
    • Events
    • Conditions
    • Actions
      • Custom script: local group g = Group.get()
      • Custom script: local real x = GetUnitX(GetTriggerUnit())
      • Custom script: local real y = GetUnitY(GetTriggerUnit())
      • Custom script: local unit u
      • Custom script: call GroupEnumUnitsInRange(g, x, y, 500.00, null)
      • Custom script: loop
      • Custom script: set u = FirstOfGroup(g)
      • Custom script: exitwhen u == null
      • Custom script: if not IsUnitType(u, UNIT_TYPE_DEAD) then
      • -------- Do actions --------
      • Custom script: endif
      • Custom script: call GroupRemoveUnit(g, u)
      • Custom script: endloop
      • Custom script: call Group.release(g)
      • Custom script: set g = null
      • Custom script: set u = null


You don't use set g = CreateGroup() or DestroyGroup(g) anymore. You replace CreateGroup() with Group.get() and DestroyGroup() with Group.release(). Thus, you need Recycle, as I stated above.

But this really does look ridiculous. No sense of organization. Compare the above chunk of nonsense with this.

JASS:
local group g = Group.get()
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local unit u
call GroupEnumUnitsInRange(g, x, y, 500.00, null)
loop
    set u = FirstOfGroup(g)
    exitwhen u == null
    if not IsUnitType(u, UNIT_TYPE_DEAD) then
        //Do actions
    endif
    call GroupRemoveUnit(g, u)
endloop
call Group.release(g)
set g = null
set u = null


Which one seems more comprehend-able, obviously the one in JASS tags. Thus, using v/JASS would be the best method...

sorry, I didnt understand very well, can U explain better how to use your way?

I just put my actions in the comment of actions?
like I was picking all unit in group and doing actions?
what is the "Custom script: local group g = Group.get()" ?

DANG! I just realized it was a double post!
 

hgkjfhfdsj

Active Member
Reaction score
55
Im asking for mac users that playes WC3, not general mac users.
you have my vote :)

[ljass]local group g = Group.get()[/ljass]
declares a local group. group.get() retrieves a group from a recycled stack
JASS:
     set u = FirstOfGroup(g)
    exitwhen u == null

change 'u' to a global so that you can use the unit in gui triggers/ outside of the custom script
changing u to global also allows you to declare the filters in gui(using the global)
 

mapguy

New Member
Reaction score
46
you are mac user?

hey, can you give me a practical use for glinphyrs trigger?
I still don't understant this shi... for me, looking to JASS is the same as looking to a text written in Latin (I know the letters, I know some works, but I dont understand the meaning).

is it like:

Code:
    * Custom script: local group g = Group.get()
    * Custom script: local real x = GetUnitX(GetTriggerUnit())
    * Custom script: local real y = GetUnitY(GetTriggerUnit())
    * Custom script: local unit u
    * Custom script: call GroupEnumUnitsInRange(g, x, y, 500.00, null)
    * Custom script: loop
    * Custom script: set u = FirstOfGroup(g)
    * Custom script: exitwhen u == null
    * Custom script: if not IsUnitType(u, UNIT_TYPE_DEAD) then

    * If unit type of u equal to footman then do actions:
                       *my actions

    * Custom script: endif
    * Custom script: call GroupRemoveUnit(g, u)
    * Custom script: endloop
    * Custom script: call Group.release(g)
    * Custom script: set g = null
    * Custom script: set u = null
this trigger she made is totally leak free?
I still have to recycle it or it recycles itself?

If I damage area with thunder clap(and not with triggers) dealing 0.00 damage it stills crash for mac users? no right? Is there a way to make units instantly cast some ability? like. cast in 0.00 second?
 

hgkjfhfdsj

Active Member
Reaction score
55
make units instantly cast some ability? like. cast in 0.00 second?
global dummy with 0 cast/animation time etc. use dummycaster, or otherwise just c&p the dummy in the system if you dont have newgen. ('recycle' also requires newgen, if you dont have, im pretty sure someone in this forum would kindly convert it to vanilla jass :))

Trigger:
  • Actions
    • Custom script: local group g = Group.get()
    • Custom script: call GroupEnumUnitsInRange(g, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), 500., null )
    • Custom script: loop
    • Custom script: set udg_Filter_Unit = FirstOfGroup(g)
    • Custom script: exitwhen udg_Filter_Unit == null
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Filter_Unit is A structure) Equal to False
      • Then - Actions
        • Animation - Play Filter_Unit's stand animation
      • Else - Actions
        • Animation - Play Filter_Unit's attack animation
    • Custom script: call GroupRemoveUnit(g, udg_Filter_Unit)
    • Custom script: set udg_Filter_Unit = null // to be safe for the next loop
    • Custom script: endloop
    • Custom script: call Group.release(g)
    • Custom script: set g = null


as for the leaking issues, i know no more than what the previous posters said.
 

mapguy

New Member
Reaction score
46
ok, you are saying that this trigger has no leaks, but I have to recycle?

well, another thing.

PLEASE! ARE U SURE THIS CREEPY MAC BUG REALLY EXISTS!?
CAN U PLEASE CREATE A MAP AND TEST ON YOUR MAC TO SEE IF IT REALLY CRASHES? AND WHY MAC DEVELOPERS DIDNT FIX THIS BUG!?
WHY EVERYTHING CONSPIRES AGAINST ME!?
 

hgkjfhfdsj

Active Member
Reaction score
55
the group recycles, provided that you have the system imported.
the desync thing ive never experienced it, but i wouldnt say it doesnt exist.. i sometimes use parallels desktop to play wc3 instead :p) so i wouldnt really say im a mac user..
 

mapguy

New Member
Reaction score
46
could you try to see if the bug happend in your mac?

right now Im using Immollation to create unit groups based on damage detection.
but If the bug dont exist I can use "unit damages area"
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top