- Joined
- Jul 20, 2009
- Messages
- 835
Hi all! I have a problem with the weird BJ - GetInventoryIndexOfItemTypeBJ(). It declares a local item, but don't null it. That is quite leaky. How can I kill it in that code?
JASS:
function WhiteRing_Conditions takes nothing returns boolean
return (GetItemTypeId(GetManipulatedItem())=='I030' or GetItemTypeId(GetManipulatedItem())=='I02F') and (UnitHasItemOfTypeBJ(GetManipulatingUnit(),'I02F') and UnitHasItemOfTypeBJ(GetManipulatingUnit(),'I030'))
endfunction
function WhiteRing_Actions takes nothing returns nothing
call RemoveItem(GetItemOfTypeFromUnitBJ(GetManipulatingUnit(),'I02F'))
call RemoveItem(GetItemOfTypeFromUnitBJ(GetManipulatingUnit(),'I030'))
call UnitAddItemById(GetManipulatingUnit(),'I02V')
if IsUnitAlly(GetTriggerUnit(),Player(10)) then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl",GetManipulatingUnit(),"origin"))
else
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl";,GetManipulatingUnit(),"origin"))
endif
endfunction
//===========================================================================
function InitTrig_WhiteRing takes nothing returns nothing
local trigger WhiteRing = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(WhiteRing,EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddCondition(WhiteRing,Condition(function WhiteRing_Conditions))
call TriggerAddAction(WhiteRing,function WhiteRing_Actions)
set WhiteRing = null
endfunction