- Joined
- Aug 4, 2012
- Messages
- 193
I try to make the item undroppable when the item is on cooldown, when the item is used, Avatar is activated, if a unit drops the item when Avatar is activated, the unit size will not returns to normal when the item effect ends. Please help me to fix this.
JASS:
function Avatar_Conditions takes nothing returns boolean
return(GetItemTypeId(GetManipulatedItem())=='I001')
endfunction
function Avatar_Finish takes item Avatar returns nothing
call SetItemDroppable(Avatar,true)
endfunction
function Avatar_Actions takes nothing returns nothing
local item Avatar=GetManipulatedItem()
local timer AvatarCD=CreateTimer()
call SetItemDroppable(Avatar,false)
call TimerStart(AvatarCD,10,false,function Avatar_Finish)
endfunction
function InitTrig_Avatar takes nothing returns nothing
set gg_trg_Avatar=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Avatar,EVENT_PLAYER_UNIT_USE_ITEM)
call TriggerAddCondition(gg_trg_Avatar,Condition(function Avatar_Conditions))
call TriggerAddAction(gg_trg_Avatar,function Avatar_Actions)
endfunction