• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Item Stacking

Status
Not open for further replies.
Level 5
Joined
Jun 21, 2004
Messages
129
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.
 
Level 4
Joined
Jun 8, 2004
Messages
83
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 =]
 
Level 7
Joined
Jul 30, 2004
Messages
451
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,

JASS:
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
 
Level 8
Joined
Apr 3, 2004
Messages
507
Heh.

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.
 
Level 5
Joined
Jun 21, 2004
Messages
129
Thanks alot for comming up with that Raptor--(actualy wasn't to far off from mine)

Thanks one more time because my map would not work with out it.
 
Status
Not open for further replies.
Top