• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Recipe System

K GUI Recipe System, allows you to craft multiple items.


Many years ago i posted a rudimentary recipe system but it got rejected, i wanted to redeem myself, so here it is. I'm also working on Wendigo Horror, so i thought it wouldn't be a bad idea to share the recipe system i'm using.
Contents

Recipe System (Map)

Reviews
Wrda
Useful system for GUI users. You should make a brief description about it (you have the "why", but not the "what"). Approved
Level 18
Joined
Oct 17, 2012
Messages
820
After a short test, I found some bugs.
  • After picking up two iron branches, a shaman claw was created, and only one iron branch was removed. The recipe required an Iron Branch and a Rusty Mining Pick.
  • I created an item recipe that required two Rings of Protection and a Tiny Farm. The result was suppose to be Ring of Superiority. When picking up the required items, I did get the Ring of Superiority, but only one ring of protection was removed. This glitch occurred when I had another item recipe that resulted in the same item and had similar item requirements. This item recipe required two Tiny Farms instead and only one Ring of Protection.
    • This might explain the reason for the first issue. Then again, I did not have another recipe with the same result and item requirements.
To fix the above issues, you will need to account for the amount for each item type in the item recipe. The boolean is not adequate.

I do like that the trigger for the recipe combination is not hardcoded to be on item pickup. With this system, you can choose any event or scenario you like.
 
Last edited:
Level 6
Joined
Feb 5, 2017
Messages
32
After a short test, I found some bugs.
  • After picking up two iron branches, a shaman claw was created, and only one iron branch was removed. The recipe required an Iron Branch and a Rusty Mining Pick.
  • I created an item recipe that required two Rings of Protection and a Tiny Farm. The result was suppose to be Ring of Superiority. When picking up the required items, I did get the Ring of Superiority, but only one ring of protection was removed. This glitch occurred when I had another item recipe that resulted in the same item and had similar item requirements. This item recipe required two Tiny Farms instead and only one Ring of Protection.
    • This might explain the reason for the first issue. Then again, I did not have another recipe with the same result and item requirements.
To fix the above issues, you will need to account for the amount for each item type in the item recipe. The boolean is not adequate.

I do like that the trigger for the recipe combination is not hardcoded to be on item pickup. With this system, you can choose any event or scenario you like.
I tried doing the same but I couldn't replicate the bug :(
Have you put how many items were you using instead of how many item types were in the recipe?
Like:
Max= 4
Item(1)=Branch
Item(2)=Branch
Item(3)=Branch
Item(4)=Tiny Farm
 
Level 18
Joined
Oct 17, 2012
Messages
820
The following was my test code. The max was set to the number of items in the recipe.
  • Inventory System Template 2
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Tiny Farm
          • (Item-type of (Item being manipulated)) Equal to Ring of Protection +1
    • Actions
      • -------- Cantidad de objetos que se combinan --------
      • -------- How many items are we combining? --------
      • Set VariableSet InventorySystem_Max = 3
      • -------- Lista de objetos --------
      • -------- Item List --------
      • Set VariableSet InventorySystem_Objects[1] = Tiny Farm
      • Set VariableSet InventorySystem_Objects[2] = Ring of Protection +1
      • Set VariableSet InventorySystem_Objects[3] = Tiny Farm
      • -------- Objeto final --------
      • -------- Final item --------
      • Set VariableSet InventorySystem_FinalObject = Ring of Superiority
      • -------- Modelo que se genera al crear el objeto. --------
      • -------- Model we're using upon creation --------
      • Set VariableSet InventorySystem_Model = Abilities\Spells\Items\AIlm\AIlmTarget.mdl
      • -------- - --------
      • -------- Detonador para las recetas --------
      • -------- No borrar --------
      • Trigger - Run Inventory System Run <gen> (checking conditions)
  • Inventory System Template 3
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Tiny Farm
          • (Item-type of (Item being manipulated)) Equal to Ring of Protection +1
    • Actions
      • -------- Cantidad de objetos que se combinan --------
      • -------- How many items are we combining? --------
      • Set VariableSet InventorySystem_Max = 3
      • -------- Lista de objetos --------
      • -------- Item List --------
      • Set VariableSet InventorySystem_Objects[1] = Ring of Protection +1
      • Set VariableSet InventorySystem_Objects[2] = Ring of Protection +1
      • Set VariableSet InventorySystem_Objects[3] = Tiny Farm
      • -------- Objeto final --------
      • -------- Final item --------
      • Set VariableSet InventorySystem_FinalObject = Ring of Superiority
      • -------- Modelo que se genera al crear el objeto. --------
      • -------- Model we're using upon creation --------
      • Set VariableSet InventorySystem_Model = Abilities\Spells\Items\AIlm\AIlmTarget.mdl
      • -------- - --------
      • -------- Detonador para las recetas --------
      • -------- No borrar --------
      • Trigger - Run Inventory System Run <gen> (checking conditions)
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
Looking back, there's quite a few of these.
My question is what makes your system special? I looked at the triggers and I don't really see any advantages when comparing to others, aside from pure GUI.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
Getting 2 rusty mining picks, or 2 iron woodbranches will result in the final item being crafted. The first issue SmitingDevil described is still present.
Could also store "triggering unit" instead of referencing it over and over.
The versatility of the event is a good advantage over other systems.

Needs fix nonetheless.
 
Level 19
Joined
Feb 27, 2019
Messages
582
If a recipe has two of the same item-type it malfunctions. I have a solution that fixes it by adding a single line of code. Tell me if you want to hear it.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
I don't get why you are using local variables here at all (maybe to avoid a few recursive problems?) as everything can be done in a GUI method.
udg_InventorySystem_Recap can fully replace myRecap (without udg_ part in GUI of course).

You are setting the following line multiple times unnecessarily, the value of maxShit never changes.
  • Custom script: set udg_TempInteger = maxShit
maxItems is a better name than maxShit.
Once again, InventorySystem_Max can replace myShit and TempInteger at all times.

The first
  • Set VariableSet InventorySystem_GoodToGo = True
is redudant, you're setting it in the loop, which is where it matters.


"Custom script: set udg_TempItemClass = myItems[GetForLoopIndexA()]" is equal to
  • Set VariableSet TempItemClass = InventorySystem_Objects[(Integer A)]
Why not use InventorySystem_FinalObject in place of TempItemClass?
  • Custom script: set udg_TempItemClass = myFinale
  • Hero - Create TempItemClass and give it to (Triggering unit)
It is highly recommended, if not a must, to use your own Integer loop variables instead of A and B to avoid clashes with other user triggers if they import this.
You should write how to import the system, even if it's as simple as copying the folder or a trigger and pasting into one's desired map.

The system already works fine without bugs, but these further optimizations clear and improve it.
 
Top