| 10-04-2006, 11:24 PM | #1 |
Code:
function takes_food_bool takes nothing returns boolean
if ( (GetWidgetLife(GetFilterUnit()) > 0) and (GetUnitFoodUsed(GetFilterUnit()) > 0 )) then
return true
else
return false
endif
endfunction
function Trig_Untitled_Trigger_001_Func001002 takes nothing returns nothing
call DisplayTextToForce( GetPlayersAll(), GetUnitName(GetEnumUnit()) )
endfunction
function Trig_vex_Actions takes nothing returns nothing
local boolexpr b = Condition(function takes_food_bool)
local group redArmy = GetUnitsOfPlayerMatching(udg_playerC[1], b)
local group blueArmy = GetUnitsOfPlayerMatching(udg_playerC[2], b)
call ForGroupBJ( redArmy, function Trig_Untitled_Trigger_001_Func001002 )
call ForGroupBJ( blueArmy, function Trig_Untitled_Trigger_001_Func001002 )
endfunctionI give both players perfectly identical armies. I know this. However, when running the game, it shows that: The variable redArmy only contains alive, food using, units. The variable blueArmy contains every unit owned by udg_playerC[2]! Note: Trig_vex_Actions has been pruned to only show the relevent bit. If you want to see all, I will post that. |
| 10-04-2006, 11:55 PM | #2 |
I don't see what the trouble would be in that code "other than some cleanup". Probably need to look elsewhere. |
| 10-05-2006, 03:05 AM | #3 |
use [jass] tags next time anyways from blizzard.j: JASS://=========================================================================== function GetUnitsOfPlayerMatching takes player whichPlayer, boolexpr filter returns group local group g = CreateGroup() call GroupEnumUnitsOfPlayer(g, whichPlayer, filter) call DestroyBoolExpr(filter) return g endfunction The boolexpr gets destroyed You could: JASS:function Trig_vex_Actions takes nothing returns nothing local group redArmy = GetUnitsOfPlayerMatching(udg_playerC[1], Condition(function takes_food_bool)) local group blueArmy = GetUnitsOfPlayerMatching(udg_playerC[2], Condition(function takes_food_bool)) call ForGroupBJ( redArmy, function Trig_Untitled_Trigger_001_Func001002 ) call ForGroupBJ( blueArmy, function Trig_Untitled_Trigger_001_Func001002 ) endfunction or use the GroupEnum native directly (much better). |
| 10-05-2006, 03:15 AM | #4 |
Ah yes, good call. I forgot that blizzard.j destroys the filter. |
| 10-05-2006, 04:44 PM | #5 |
thanks :D |
