Hello. I have a small piece of code. Its function is that when holding this item, defeating an enemy will receive 1 stat. But it does not apply to clone or summoner skills. I need help.
JASS:
function GiayTest_Conditions takes nothing returns boolean
if(not(UnitHasItemOfTypeBJ(GetKillingUnitBJ(),'Ie01')==true))then
return false
endif
if(not(GetKillingUnitBJ()==GetKillingUnitBJ()))then
return false
endif
return true
endfunction
function GiayTest_Actions takes nothing returns nothing
call ModifyHeroStat(bj_HEROSTAT_STR,GetKillingUnitBJ(),bj_MODIFYMETHOD_ADD,1)
call ModifyHeroStat(bj_HEROSTAT_AGI,GetKillingUnitBJ(),bj_MODIFYMETHOD_ADD,1)
call ModifyHeroStat(bj_HEROSTAT_INT,GetKillingUnitBJ(),bj_MODIFYMETHOD_ADD,1)
endfunction
function trig_GiayTest takes nothing returns nothing
set gg_GiayTest=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_GiayTest,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(gg_GiayTest,Condition(function GiayTest_Conditions))
call TriggerAddAction(gg_GiayTest,function GiayTest_Actions)
endfunction