HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Threat System (Unit Group Question)

03-26-2009, 04:56 AM#1
Blacktastic
Problems fixed so far. Waiting for more questions to arise.

Expand JASS:
03-27-2009, 06:51 AM#2
Jazradel
This is a rough example, I didn't look that closely at your code so I haven't put in references to all your variables, or how you pass data.
Collapse JASS:
globals //don't need these globals, can pass using Tables or w/e
   integer Count
   integer HealedValue
endglobals

local group g = CreateGroup()
set Count = 0
call GroupEnumUnits(g, 800, x, y, Condition(function Count)) //forgotten the exact syntax, but easy to check
set HealedValue = //whatever it was, can't be bothered checking
call ForGroup(g, function Enum)
call DestroyGroup()

function Count takes nothing returns boolean //this is called by GroupEnumUnits, once for each unit that is within the 800
    set Count = Count + 1
    return true //if it returns false, then the GetFilterUnit() is excluded from the group
endfunction

function Enum takes nothing returns nothing //and this is called by ForGroup(), for each unit that has passed whatever check you have in count, and is now in the group g.
    local unit u = GetEnumUnit()
    set u.struct.threat =  u.struct.threat 0.5 * Healed Value / Count //not sure how you need 
endfunction
03-27-2009, 08:22 AM#3
Blacktastic
Thanks for the help, got my question answered though. Keeping this thread open for future questions I am sure I will have though. (Edit ftw)