HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Check to see if unit dies?

03-24-2006, 10:35 PM#1
Linera
In my system I need to detect the exact moment the unit dies while running a function.
After that i need it to exit Main_Weapon function

Collapse JASS:
function Remove takes nothing returns nothing
    call RemoveUnit( GetEnumUnit() )
endfunction

function Main_Weapon takes integer p, integer a, unit attacking, unit attacked returns nothing
local integer MobID

   if GetPlayerController(Player(p-1)) == MAP_CONTROL_USER then
      set udg_InCombat[p] = true
      call StartTimerBJ( udg_CombatCheckTimer[p], false, 10.00 )
      call ForGroupBJ( GetUnitsOfPlayerAndTypeId(Player(p-1), 'o001'), function Remove )
   endif
   if GetPlayerController(Player(a-1)) == MAP_CONTROL_USER then
      set udg_InCombat[a] = true
      call StartTimerBJ( udg_CombatCheckTimer[a], false, 10.00 )
      call ForGroupBJ( GetUnitsOfPlayerAndTypeId(Player(a-1), 'o001'), function Remove )
   endif
//Begin Combat
      call SetUnitAnimation(attacking, "Attack" )
      call UnitDamageTargetBJ( attacking, attacked, 5.00, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL )
      call SetUnitAnimation(attacking, "Stand" )
   if GetPlayerController(Player(p-1)) == MAP_CONTROL_USER then
      call PolledWait(udg_Main_Attack_Speed[p])
      call Main_Weapon(p, a, attacking, attacked)
   else
      call PolledWait(2.00)
      call Main_Weapon(p, a, attacking, attacked)
   endif
endfunction

function Combat takes integer p, integer a, unit attacking, unit attacked returns nothing
   if GetPlayerController(Player(a-1)) != MAP_CONTROL_USER then
   call IssueTargetOrderBJ( attacked, "banish", attacking )
   endif
call Main_Weapon(p, a, attacking, attacked)
endfunction

//===========================================================================
function InitTrig_Functions takes nothing returns nothing
endfunction