HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Jass - Picking units in a group

02-06-2007, 03:28 AM#1
Mythic Fr0st
Got it working, but how do I add things to its Actions to loop? like in GUI
Collapse JASS:
function mfs takes nothing returns nothing
 local group g
 local location loc
 local integer l
    set l = GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit())
    set loc = GetUnitLoc(GetTriggerUnit())
    set g = GetUnitsInRangeOfLocAll(200.00 * l, loc)
    call ForGroupBJ(g,function mfs)
endfunction
02-06-2007, 03:57 AM#2
Guest
Collapse JASS:
function Trig_Trigger_Func004A takes nothing returns nothing
    (your actions here)
endfunction

function Trig_Trigger_Actions takes nothing returns nothing
 local group g
 local location loc
 local integer l
    set l = GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit())
    set loc = GetUnitLoc(GetTriggerUnit())
    set g = GetUnitsInRangeOfLocAll(( 200.00 * I2R(l) ), loc)
    call ForGroupBJ( g, function Trig_Trigger_Func004A )
endfunction
02-06-2007, 04:05 AM#3
Alevice
Collapse JASS:
function randomfunction takes nothing returns nothing
//[all stuff to do in the forgroup]
endfunction


function mfs takes nothing returns nothing
 local group g
 local location loc
 local integer l
    set l = GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetTriggerUnit())
    set loc = GetUnitLoc(GetTriggerUnit())
    set g = GetUnitsInRangeOfLocAll(200.00 * l, loc)
    call ForGroupBJ(g,function randomfunction)
endfunction
02-07-2007, 12:11 AM#4
Pyrogasm
Is that better than using FirstOfGroup() and looping through all the units in the group?
02-07-2007, 12:17 AM#5
wyrmlord
ForGroup is faster, but the FirstOfGroup is helpful if everything needs to be kept in 1 function.
02-07-2007, 12:24 AM#6
Pyrogasm
Oh. Rep'd!