HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

JASS GroupEnumUnitsInRange useage...

03-01-2006, 11:32 PM#1
Dalten
I'm trying to convert a trigger made with UMSWE so it's possible to open in WE.

Trigger:
Unit Group - To SSA_LocatorUG add units near POINT_Calcs[23] in a range of 1233.00 matching ((Unit-type of (Matching unit)) Equal to (==) SSA_NodeType)

Can anyone help me convert this to a custom script please?
03-02-2006, 12:45 AM#2
emjlr3
hows this?

Collapse JASS:
function Unit_Group takes nothing returns boolean
    return IsUnitIdType('unit rawcode',GetFilterUnit())==true   
endfunction

function Actions takes nothing returns nothing
    local group g = CreateGroup()
    call GroupEnumUnitsInRange(g,GetLocationX(your location),GetLocationY(your location),1233.,Condition(function Unit_Group))
    call GroupAddGroup(g,udg_Your_Group)
    call DestroyGroup(g)
    set g = null
endfunction
03-02-2006, 12:57 AM#3
Dalten
Thank you but the trigger is in GUI. Any way to do with a custom script or a multitude of them?
03-02-2006, 01:20 AM#4
Vexorian
hmnn UMSWE/U have an error, cause Enum functions didn't just add units to group they seemed to also clear the group.

But well:

Trigger:
Set tempgroup = (Units within 1233.00 of POINT_Calcs[23] matching ((Unit-type of (Matching unit)) == SSA_NodeType))
Custom script: set bj_wantDestroyGroup=true
Unit Group - Add all units of tempgroup to SSA_LocatorUG
03-02-2006, 01:36 AM#5
Dalten
Quote:
Originally Posted by Vexorian
hmnn UMSWE/U have an error, cause Enum functions didn't just add units to group they seemed to also clear the group.

But well:

Trigger:
Set tempgroup = (Units within 1233.00 of POINT_Calcs[23] matching ((Unit-type of (Matching unit)) == SSA_NodeType))
Custom script: set bj_wantDestroyGroup=true
Unit Group - Add all units of tempgroup to SSA_LocatorUG

Thanks man, quick question:

Trigger:
Custom script: set bj_wantDestroyGroup=true

At what point does set bj_wantDestroyGroup=true destroy the group? I'm assuming it implies what would be a GUI flag of (last created unit group).

My normal practice is to destroy a group right before I add a value to it so that data remains until the very moment it's no longer needed.
03-02-2006, 02:18 AM#6
Dalten
Consider the case closed, rep given.
03-02-2006, 02:27 AM#7
Vexorian
some bj functions consider that flag and destroy the group they got as argument - then turn the flag off.

So you have to set it just before using those functions.

Most common functions that use it
- The add units from unit group to unit group GUI action
- The functions that return random unit(s) from a unit group
- The functions that pick every unit in a unit group