| 05-23-2006, 08:10 PM | #1 |
JASS:function PF_Cca takes nothing returns boolean return ( GetOwningPlayer(GetEnumUnit()) == Player(10) ) endfunction function PF_Ccb takes nothing returns boolean return ( GetEnumUnit() != null ) endfunction function PF_C takes nothing returns boolean return GetBooleanAnd( PF_Cca(), PF_Ccb() ) endfunction function PF_A takes nothing returns nothing local integer who = GetStoredIntegerBJ( "Pick", "Player", udg_TempStuff ) call DisplayTextToPlayer( Player(0), 0, 0, "Unit " + GetUnitName(GetEnumUnit() ) ) set udg_CTarget[who] = GetEnumUnit() call StoreIntegerBJ( 10, "Pick", "Exit", udg_TempStuff ) endfunction function PF takes integer who, unit which, integer range returns nothing local integer i = 0 call StoreIntegerBJ(who, "Pick", "Player", udg_TempStuff) call DisplayTextToPlayer( Player(0), 0, 0, I2S(who) ) set range = range / 10 loop exitwhen i > range call ForGroupBJ( GetUnitsInRangeOfLocMatching(90.00, PolarProjectionBJ(GetUnitLoc(which), i * 10, GetUnitFacing(which)), Condition(function PF_C)), function PF_A ) if GetStoredIntegerBJ( "Pick", "Exit", udg_TempStuff) == 10 then call StoreIntegerBJ( 0, "Pick", "Exit", udg_TempStuff) return endif set i = i + 1 endloop endfunction Not working. What I want it to do is pick the closest unit within range of another unit. When it picks a unit, I want it to stop looping. I think the problem is somewhere in the conditions... The display text is not showing in the actions function, so I guess it's the conditions. But I can't find the error. BTW - Player(10) == enemy. |
| 05-23-2006, 08:32 PM | #2 |
You don't have all the code posted. No event, and I don't see where some of the variables are being set. You might also want to clean up all the memory leaks eventually. |
| 05-23-2006, 08:57 PM | #3 |
It's a function, not a trigger. So, there's no events. What variables do you see not being set? EDIT: Fixed my problem. The problem was I was using "GetEnumUnit()" in the conditions check. I had to use "GetFilterUnit()". |
