All right like the topic sez i need help on making items with charges to stack ( like healing potions- 2 charge + healing potion 4 charge= healing potion 6 charge) i got to the point where the items stack, but with all of the pervious items and current charged items giving you a much higher number than needed. Dose any one have a solution to stacking items? Oh an multiple hero will be stacking.
dunno, cant help yah.. but i think you should make more spells!!! ASAP!!!! cause mmm 1: ur spells are coo. 2: stewie rubbing his self is sexy. 3: erm read 1-2 =]
well i dunno if this is what ur asking for, i whipped it up in 5 minutes so thers probably a better way too, but here, basically stacks charged items as u pick them up,
function Trig_ITEMS_Acquisition_Actions takes nothing returns nothing
local boolean check = false
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
if ( (check == false) and ( GetItemCharges(GetManipulatedItem()) > 0 ) and ( GetItemCharges(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) > 0 ) and ( GetItemTypeId(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) == GetItemTypeId(GetManipulatedItem()) ) and ( UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA()) != GetManipulatedItem() ) ) then
call SetItemCharges( UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA()), ( GetItemCharges(UnitItemInSlotBJ(GetManipulatingUnit(), GetForLoopIndexA())) + GetItemCharges(GetManipulatedItem()) ) )
call RemoveItem( GetManipulatedItem() )
set check = true
else
call DoNothing( )
endif
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_ITEMS_Acquisition takes nothing returns nothing
set gg_trg_ITEMS_Acquisition = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ITEMS_Acquisition, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_ITEMS_Acquisition, function Trig_ITEMS_Acquisition_Actions )
endfunction
i'm assuming u can figure out the trigger from that, i am too lazy to copy the actual trigger
The general idea is to make the item capable of having 99 charges, but when they pick it up, change the charges to how many the single item has. When they pick up a second one, destroy it and increase the charges on the one you already have.