• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ HD Level Design Contest #1 POLL is now OPEN! Check out the stunning visuals of the final entries. 🔗Click here to cast your vote!

[JASS] Item Combination

Not open for further replies.
Level 4
Dec 31, 2007
Hey, I just have a quick JASS question...for experienced JASS'ers plz?

Ok...I need help to write the JASS for combining two or three items. I've tried it but it doesn't work.

For Ex. Cheese - Slot 1 + Orb Of Frost - Slot 2 = Frosty Cheese or


Thank you!
Last edited:
I have just what you need. Just give me some time to search for my codes.

Ahhh, i found it, this is just what you need. This code was made by PurplePoot, one of the best Jassers in THW.

function Comb_conds takes nothing returns boolean  
    return GetItemTypeId(GetManipulatedItem()) == 'I01F'//The Item that simulats the recipe 
function CountItemsInInventory takes unit who, integer itemType returns integer  
    local integer i = 0 //Item slots available  
    local integer num = 0 //Item Amount  
        exitwhen i > 5 
        if GetItemTypeId(UnitItemInSlot(who,i)) == itemType then //don't replace this! It's a parameter  
            set num = num + 1                                   //for this function so that it can  
        endif                                                  //be used in any situation!  
        set i = i + 1 
    return num 
function I_dunno_what_i_am_doing takes nothing returns nothing  
    local unit who = GetTriggerUnit()  
    local integer i = 0 
    local effect ef
    local integer IR= 'I01F' //Item that simulates the recipe  
    local integer IB= 'I012' // rawcode of the item i buyed 3 times  
    local integer IG= 'I00D' //rawcode of the item that will replace the recipe and the 3 items (the comboniation)  
    local integer cnt = 0 
    if CountItemsInInventory(who,IB) > 2 then  
        call RemoveItem(GetManipulatedItem())  
            exitwhen i > 5 or cnt > 2 
            if GetItemTypeId(UnitItemInSlot(who,i)) == IB then  
                call RemoveItem(UnitItemInSlot(who,i))  
                set cnt = cnt + 1 
            set i = i + 1 
        set ef = AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIsm\\AIsmTarget.mdl", who, "origin")  
        call UnitAddItemById(who,IG)  
    set who = null 
    call DestroyEffect(ef)
    set ef = null
function InitTrig_Combination1 takes nothing returns nothing  
    local integer index = 0 
    set gg_trg_Combination1 = CreateTrigger()  
        exitwhen index == 16 
        call TriggerRegisterPlayerUnitEvent(gg_trg_Combination1, Player(index), EVENT_PLAYER_UNIT_PICKUP_ITEM, null)  
        set index = index + 1 
    call TriggerAddCondition( gg_trg_Combination1, Condition( function Comb_conds) )  
    call TriggerAddAction( gg_trg_Combination1, function I_dunno_what_i_am_doing) 

To make this work you need 3 items:
1 - One item to SIMULATE the recipe. This will not be the combination. It is the item you buy in the shop.
2 - The item you want to collect. In this case I collect an item 3 times and I activate this trigger
3 - The real combination item. It will replace your items by only one.

If you have any questions about the code you can ask.

Oh, Btw, Give reputation points+ to those you help you =)

Also, don't just copy paste the code, try to understand it how it works, as its concepts will really help you in the future =)
Last edited:
Not open for further replies.