HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I need help cleaning up idle units in mob spawn style map please.

03-05-2004, 02:12 AM#1
ipaav
I'm trying to get units that have been stopped for one reason or another, to resume their march towards their goal. Any ideas why this isn't working?

See following code:

Code:
function Trig_Unit_Order_Equals_Stop_Func001001002001 takes nothing returns boolean
    return ( GetUnitCurrentOrder(GetFilterUnit()) == String2OrderIdBJ("stop") )
endfunction

function Trig_Unit_Order_Equals_Stop_Func001001002002001 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction

function Trig_Unit_Order_Equals_Stop_Func001001002002002001 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == false )
endfunction

function Trig_Unit_Order_Equals_Stop_Func001001002002002002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_PEON) == false )
endfunction

function Trig_Unit_Order_Equals_Stop_Func001001002002002 takes nothing returns boolean
    return GetBooleanAnd( Trig_Unit_Order_Equals_Stop_Func001001002002002001(), Trig_Unit_Order_Equals_Stop_Func001001002002002002() )
endfunction

function Trig_Unit_Order_Equals_Stop_Func001001002002 takes nothing returns boolean
    return GetBooleanAnd( Trig_Unit_Order_Equals_Stop_Func001001002002001(), Trig_Unit_Order_Equals_Stop_Func001001002002002() )
endfunction

function Trig_Unit_Order_Equals_Stop_Func001001002 takes nothing returns boolean
    return GetBooleanAnd( Trig_Unit_Order_Equals_Stop_Func001001002001(), Trig_Unit_Order_Equals_Stop_Func001001002002() )
endfunction

function Trig_Unit_Order_Equals_Stop_Func001A takes nothing returns nothing
    call IssuePointOrderLocBJ( GetEnumUnit(), "attack", GetUnitLoc(gg_unit_unp2_0035) )
endfunction

function Trig_Unit_Order_Equals_Stop_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsOfPlayerMatching(Player(10), Condition(function Trig_Unit_Order_Equals_Stop_Func001001002)), function Trig_Unit_Order_Equals_Stop_Func001A )
endfunction

//===========================================================================
function InitTrig_Unit_Order_Equals_Stop takes nothing returns nothing
    set gg_trg_Unit_Order_Equals_Stop = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Unit_Order_Equals_Stop, 60.00 )
    call TriggerAddAction( gg_trg_Unit_Order_Equals_Stop, function Trig_Unit_Order_Equals_Stop_Actions )
endfunction

Edit: Or in other words:

Code:
Event
    Time - Every 60.00 seconds of game time

Conditions
    None

Actions
    Unit Group - Pick every unit in (Units owned by Player 11 (Dark Green) matching (((Current order of (Matching unit)) Equal to (Order (stop))) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A Hero) Equal to False) and (((Matching unit) is A peon-type unit) Equal to False))))

        Loop - Actions

            Unit - Order (Picked unit) to Attack-Move To (Position of Black Citadel 0035 <gen>)
03-05-2004, 02:39 AM#2
Grater
You'll have much more luck with "Current order IS NOT Attack". Units that are not moving are not issued the order stop, they just stop moving.
03-06-2004, 12:55 PM#3
ipaav
Quote:
Originally Posted by Grater
You'll have much more luck with "Current order IS NOT Attack". Units that are not moving are not issued the order stop, they just stop moving.

Thanks. I was hoping that there was something else wrong in what I was doing, because when I was running a periodic message listing the number of units not attacking, I was getting a much larger number than were actually idle. And I didn't really want to interrupt channeling units or whatever else they were doing. I only wanted to capture those truly stopped units.

I guess that I'll have to do as you suggest though. Thanks for replying.