• 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 Recipe System 1.1.1

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
161106-albums3679-picture33652.jpg

Zeatherann Presents:

An Anthro-Vixen System


Item Recipe System


Reason for Making

What: This will allow you to add item recipes to your map with great ease.
Configurables
  • How you code your recipes (Jass/GUI/Both).
  • How the recipe system is invoked, basically you can add the effects and call the function.
Tehnical Side
  • Coded in JASS, but can be used in all GUI.
  • Uses 2 arrays and 1 integer.
  • Supports use for any item stacking system.
  • Uses the item's charge, allowing for staking items.
JASS:
function Make_Item takes unit u returns nothing
    //Add item types to udg_Items
    //Change udg_ItemCount to the number of item types in udg_Items.
    //This system works with item charges, if the charge is 0 then it adds 1.
    //Thus allowing you to 'stack' items.
    //Fake Recipie;
    //
    //if udg_ItemNum[0]>=2 and udg_ItemNum[1]>=1 then
    //    //remove checked items.
    //    set udg_ItemNum[0]=udg_ItemNum[0]-2
    //    set udg_ItemNum[1]=udg_ItemNum[1]-1
    //    //Add the items you want the recipie to give.
    //    set udg_ItemNum[3]=udg_ItemNum[3]+1
    //elseif udg_ItemNum[3]>=1 and udg_ItemNum[0]>=1 then
    //    //remove checked items.
    //    set udg_ItemNum[0]=udg_ItemNum[0]-1
    //    set udg_ItemNum[3]=udg_ItemNum[3]-1
    //    //Add the items you want the recipie to give.
    //    set udg_ItemNum[4]=udg_ItemNum[4]+1
    //endif
    //
    //Make sure all your item mats and items you get from the recipies to udg_Items.
    //Items in a unit's invintory not on the udg_Items list will be ignored.
    //This will not returned 'stacked' items, your stacking system should handle when a unit gains an item it already has to stack them.
    local integer i=0
    local integer I
    local integer II
    local item ii
    //Count items...
    loop
        exitwhen i>udg_ItemCount
        set udg_ItemNum[i]=0
        set I=0
        loop
            exitwhen I>5
            set ii=UnitItemInSlot(u,I)
            if ii!=null then
                if GetItemTypeId(ii)==udg_Items[i]then
                    set II=GetItemCharges(ii)
                    if II<=1then
                        set II=1
                    endif
                    set udg_ItemNum[i]=udg_ItemNum[i]+II
                    call RemoveItem(ii)
                    set II=0
                endif
            endif
            set ii=null
            set I=I+1
        endloop
        set i=i+1
    endloop
    //Recipes...
    if udg_ItemNum[0]>=1 and udg_ItemNum[1]>=1 and udg_ItemNum[5]>=1 then
        set udg_ItemNum[0]=udg_ItemNum[0]-1
        set udg_ItemNum[1]=udg_ItemNum[1]-1
        set udg_ItemNum[3]=udg_ItemNum[3]+1
    elseif udg_ItemNum[0]>=1 and udg_ItemNum[2]>=1 and udg_ItemNum[5]>=1 then
        set udg_ItemNum[0]=udg_ItemNum[0]-1
        set udg_ItemNum[2]=udg_ItemNum[2]-1
        set udg_ItemNum[4]=udg_ItemNum[4]+1
    endif
    //GUI Recipes...
    call TriggerExecute(gg_trg_GUI_Recipes)
    //Remake unused items...
    set i=0
    loop
        exitwhen i>udg_ItemCount
        loop
            exitwhen udg_ItemNum[i]<=0
            set udg_ItemNum[i]=udg_ItemNum[i]-1
            call UnitAddItemById(u,udg_Items[i])
        endloop
        set udg_ItemNum[i]=0
        set i=i+1
    endloop
    set ii=null
    set u=null
endfunction
  • GUI Recipes
    • Events
    • Conditions
    • Actions
      • -------- This is the GUI side of my system, it allows you to never touch JASS, however it's suggested to use elseif's, or nested if's --------
      • -------- rather than multiple if's --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemNum[0] Greater than or equal to 2
        • Then - Actions
          • Set ItemNum[0] = (ItemNum[0] - 2)
          • Set ItemNum[1] = (ItemNum[1] + 1)
        • Else - Actions
  • Add Recepes
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Add all the itemtypes you want the system to deal with here. --------
      • Set Items[0] = Assassin's Blade
      • Set Items[1] = Orb of Frost
      • Set Items[2] = Orb of Fire
      • Set Items[3] = Frostguard
      • Set Items[4] = Searing Blade
      • Set Items[5] = Enchanter's Stone
      • -------- Set the ItemCount to the number of items types you want the system deal with. --------
      • Set ItemCount = 5
      • -------- WARNING: Remember to count '0' as one of the items, if you only use '0' set the ItemCount to 0. --------
1.0
Spell Uploaded!
1.1
Added an if check against null items.
1.1.1
  • Fixed description errors.
  • Added full code.
Spell is made in JASS.

Keywords:
Item, Recipe, Zeatherann, System
Contents

Zeatherann's Item Recipe System! (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Pharaoh_: Although I appreciate the effort, this is too plain and there are item systems out there that do the job equally well, with more advanced features and stuff. Rejected at this state...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

Pharaoh_: Although I appreciate the effort, this is too plain and there are item systems out there that do the job equally well, with more advanced features and stuff. Rejected at this state.

14th Jun 2011
Bribe:

If you post all the triggers here (GUI Add is missing, for example) that would at least show users what they have to c&p to import your system.
 
Level 5
Joined
Jan 4, 2009
Messages
118
wow I'll thinking about this system and you show me how to create system has shorten ... I like it and I'll try to test it!!. Thanks a lot It's useful for learning.

Ahh I'll Try to Test. This Trigger mean I'll LOOP all Item Recipe? OHHH MY GOD

This Trigger is cannot use with event "EVENT_PLAYER_UNIT_PICKUP_ITEM" ???

I'll try it. and Game is error suddenly ....
 
Last edited by a moderator:
Top