- Joined
- Aug 4, 2012
- Messages
- 193
I was trying to make a dummy to add buff to damaged unit, but i failed. Any suggestion?
JASS:
function AntiMagicShell_Conditions takes nothing returns boolean
return(GetUnitTypeId(udg_GDD_DamagedUnit)=='U001')or(GetUnitTypeId(udg_GDD_DamagedUnit)=='U002')or(GetUnitTypeId(udg_GDD_DamagedUnit)=='U003')
endfunction
function AntiMagicShell_Actions takes nothing returns nothing
local location udg_GDD_DamagedUnit_Loc=GetUnitLoc(udg_GDD_DamagedUnit)
local unit AntiMagicShellDummy=CreateUnitAtLoc(Player(10),'h00P',udg_GDD_DamagedUnit_Loc,270.)
local timer AntiMagicShell_CD=CreateTimer()
call DisableTrigger(GetTriggeringTrigger())
call UnitAddAbility(AntiMagicShellDummy,'A000')
call IssueTargetOrder(AntiMagicShellDummy,"antimagicshell",udg_GDD_DamagedUnit)
call TimerStart(AntiMagicShell_CD,GetRandomInt(10,20),false,null)
if TimerGetRemaining(AntiMagicShell_CD)<=0 then
call EnableTrigger(GetTriggeringTrigger())
endif
call RemoveUnit(AntiMagicShellDummy)
set AntiMagicShellDummy=null
call DestroyTimer(AntiMagicShell_CD)
call RemoveLocation(udg_GDD_DamagedUnit_Loc)
endfunction
function InitTrig_AntiMagicShell takes nothing returns nothing
set gg_trg_AntiMagicShell=CreateTrigger()
call TriggerRegisterVariableEvent(gg_trg_AntiMagicShell,"udg_GDD_Event",EQUAL,0)
call TriggerAddCondition(gg_trg_AntiMagicShell,Condition(function AntiMagicShell_Conditions))
call TriggerAddAction(gg_trg_AntiMagicShell,function AntiMagicShell_Actions)
endfunction
Last edited: