JASS:
function apple_Conditions takes nothing returns boolean
return UnitHasItemOfTypeBJ(GetManipulatingUnit(), GetItemTypeId(GetManipulatedItem())) == true
endfunction
function apple takes nothing returns nothing
if GetManipulatedItem() != GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), GetItemTypeId(GetManipulatingItem()) then
call SetItemCharges( GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), GetItemTypeId(GetManipulatedItem())), ( GetItemCharges(GetItemOfTypeFromUnitBJ(GetManipulatingUnit(), GetItemTypeId(GetManipulatedItem()))) + GetItemCharges(GetManipulatedItem()) ) )
call UnitRemoveItemSwapped( GetManipulatedItem(), GetManipulatingUnit() )
call RemoveItem( GetManipulatedItem() )
else
endif
endfunction
function InitTrig_apple takes nothing returns nothing
set gg_trg_apple = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_apple, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_apple, Conditions( function apple_Conditions ) )
call TriggerAddAction( gg_trg_apple, function apple )
endfunction
why syntax keeps on showing?