• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Detect free worker (worker not harvesting or worker not working)

Status
Not open for further replies.
Level 3
Joined
Feb 14, 2013
Messages
26
Please help my trigger:
I have a gold mine and a gold miner inside. After gold miner collected all gold in gold mine, the gold mine is dead and removed but gold miner still there, i try to remove gold miner after gold mine dead.
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to (==) GoldMine
  • Actions
    • Unit Group - Pick every unit in (Units owned by (Triggering Player ) of type Gold_Miner) and do (Actions)
      • Loop - Actions
        • if ((Picked Unit are free or not harvesting or unit not working)) then do (Unit - Kill (Picked Unit)) else do (Do Nothing)
Gui or Jass will help me a lot thank
 
Level 3
Joined
Feb 14, 2013
Messages
26
yes it auto increase gold until it dead.
I found it, hope this will help some one, this jass code detect unit unload from building:
JASS:
function Trig_GoldMineDead_Func001A takes nothing returns nothing
    if ( (IsUnitLoadedBJ(GetEnumUnit()) == false) ) then
        call RemoveUnit( GetEnumUnit() )
    endif
endfunction
function Trig_GoldMineDead_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), 'e001'), function Trig_GoldMineDead_Func001A )
endfunction
function InitTrig_GoldMineDead takes nothing returns nothing
	set gg_trg_GoldMineDead = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_GoldMineDead, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_GoldMineDead, Condition( function Trig_goldmine_Conditions ) )
    call TriggerAddAction( gg_trg_GoldMineDead, function Trig_GoldMineDead_Actions )
endfunction
current order "stop" and "<Empty string>" not work in my case.
 
Status
Not open for further replies.
Top