• 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.

Recipe System v1.5.0.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: deepstrasz
My Opinions
This is the best recipe system I have ever seen/made. For a couple of reasons, such as it supports stacks. And 2 or more of the same item type can be in the same recipe. Which is very cool :D
Why?
Why did I make this? Well I keep seeing people making recipe systems that are no good and it annoys me. So I made this to show everyone where it's at.
Triggers
  • Int Recipes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Recipes_Hashtable = (Last created hashtable)
      • -------- Dont put recipes above this line --------
      • -------- This is the begining of recipe 1 --------
      • Set Recipe_Number = 1
      • Set Made_Item[Recipe_Number] = Mask of Death
      • -------- ^^^^^ is the item this recipe makes --------
      • Set TempItemType[Recipe_Number] = Rune of Death
      • -------- ^^^^^ is the recipe itself which triggers the creation --------
      • Set Required_Item_1[Recipe_Number] = Claws of Attack +6
      • -------- ^^^^^ is one of the required items for recipe 1 --------
      • Set Stacks_Or_Number_Req_1[Recipe_Number] = 1
      • -------- ^^^^^ is the amount of stacks or the amount of items it will cost to make the item --------
      • -------- So you could have it require 10 potions and or 2 claws of attack --------
      • Set Required_Item_2[Recipe_Number] = Potion of Healing
      • Set Stacks_Or_Number_Req_2[Recipe_Number] = 4
      • Set Required_Item_3[Recipe_Number] = Belt of Giant Strength +6
      • Set Stacks_Or_Number_Req_3[Recipe_Number] = 1
      • Set Total_Required_Items[Recipe_Number] = 3
      • -------- This is the end of recipe 1 --------
      • -------- Dont put recipes under this line --------
      • For each (Integer Integer[1]) from 1 to Recipe_Number, do (Actions)
        • Loop - Actions
          • Custom script: call SaveInteger(udg_Recipes_Hashtable,udg_TempItemType[udg_Integer[1]], 0, udg_Integer[1])
          • Custom script: call SaveInteger(udg_Recipes_Hashtable,udg_Made_Item[udg_Integer[1]], 1, udg_Integer[1])
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
Now this is the trigger that actually runs when you use the recipe. It basically does all the work.
  • Create Items
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • Set TempItemType[1] = (Item-type of (Item being manipulated))
      • Custom script: set udg_Integer[1] = LoadInteger(udg_Recipes_Hashtable,udg_TempItemType[1], 0)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer[1] Not equal to 0
        • Then - Actions
          • Set TempUnit = (Triggering unit)
          • Set TempItemType[1] = Required_Item_1[Integer[1]]
          • Set TempItemType[2] = Required_Item_2[Integer[1]]
          • Set TempItemType[3] = Required_Item_3[Integer[1]]
          • Set TempItemType[4] = Required_Item_4[Integer[1]]
          • Set TempItemType[5] = Required_Item_5[Integer[1]]
          • Set Integer[2] = Stacks_Or_Number_Req_1[Integer[1]]
          • Set Integer[3] = Stacks_Or_Number_Req_2[Integer[1]]
          • Set Integer[4] = Stacks_Or_Number_Req_3[Integer[1]]
          • Set Integer[5] = Stacks_Or_Number_Req_4[Integer[1]]
          • Set Integer[6] = Stacks_Or_Number_Req_5[Integer[1]]
          • For each (Integer Integer[7]) from 1 to 6, do (Actions)
            • Loop - Actions
              • For each (Integer Integer[8]) from 1 to 5, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempItemType[Integer[8]] Not equal to (Item-type of No item)
                      • (Item-type of (Item carried by TempUnit in slot Integer[7])) Not equal to (Item-type of No item)
                      • (Item-type of (Item carried by TempUnit in slot Integer[7])) Equal to TempItemType[Integer[8]]
                    • Then - Actions
                      • Set Integer[(8 + Integer[8])] = (Integer[(8 + Integer[8])] + 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Charges remaining in (Item carried by TempUnit in slot Integer[7])) Not equal to 0
                        • Then - Actions
                          • Set Integer[(8 + Integer[8])] = (Integer[(8 + Integer[8])] + ((Charges remaining in (Item carried by TempUnit in slot Integer[7])) - 1))
                        • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Integer[(Integer[8] + 8)] Greater than or equal to Integer[(Integer[8] + 1)]
                        • Then - Actions
                          • Set Integer[14] = (Integer[14] + 1)
                        • Else - Actions
                    • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Integer[14] Greater than or equal to Total_Required_Items[Integer[1]]
            • Then - Actions
              • Item - Remove (Item being manipulated)
              • For each (Integer Integer[7]) from 1 to 6, do (Actions)
                • Loop - Actions
                  • For each (Integer Integer[8]) from 1 to 5, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Item-type of (Item carried by TempUnit in slot Integer[7])) Not equal to (Item-type of No item)
                          • (Item-type of (Item carried by TempUnit in slot Integer[7])) Equal to TempItemType[Integer[8]]
                          • Integer[(Integer[8] + 1)] Greater than 0
                        • Then - Actions
                          • Set Integer[15] = (Charges remaining in (Item carried by TempUnit in slot Integer[7]))
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Integer[15] Equal to 0
                            • Then - Actions
                              • Set Integer[15] = 1
                            • Else - Actions
                          • Set Integer[14] = (Integer[15] - Integer[(Integer[8] + 1)])
                          • Item - Set charges remaining in (Item carried by TempUnit in slot Integer[7]) to Integer[14]
                          • Set Integer[(Integer[8] + 1)] = (Integer[(Integer[8] + 1)] - Integer[15])
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Charges remaining in (Item carried by TempUnit in slot Integer[7])) Less than 1
                            • Then - Actions
                              • Item - Remove (Item carried by TempUnit in slot Integer[7])
                            • Else - Actions
                        • Else - Actions
              • Hero - Create Made_Item[Integer[1]] and give it to TempUnit
              • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
              • Cinematic - Clear the screen of text messages for (All players)
              • Game - Display to (All players) the text: (|cffffcc00You have created + ((Name of (Last created item)) + .|r))
              • Sound - Play ItemReceived <gen>
              • Custom script: endif
              • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Items\ResourceItems\ResourceEffectTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Hero - Create Made_Item[Integer[1]] and give it to TempUnit
              • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
              • Cinematic - Clear the screen of text messages for (All players)
              • Game - Display to (All players) the text: (|cffffcc00You do not have the required items to complete + ((Name of (Last created item)) + .|r))
              • Sound - Play Error <gen>
              • Custom script: endif
              • Item - Remove (Last created item)
        • Else - Actions
      • Set TempItemType[1] = (Item-type of No item)
      • Set TempItemType[2] = (Item-type of No item)
      • Set TempItemType[3] = (Item-type of No item)
      • Set TempItemType[4] = (Item-type of No item)
      • Set TempItemType[5] = (Item-type of No item)
      • For each (Integer Integer_A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Set Integer[Integer_A] = 0
This is where you can right click an item 2 times to return the original recipe items.
  • Disablement
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Set TempItem1 = (Target item of issued order)
      • Set TempUnit = (Triggering unit)
      • Custom script: set udg_Integer[1] = GetIssuedOrderId()
      • Set Integer[2] = (Integer[1] - 852001)
      • Set TempItem2 = (Item carried by TempUnit in slot Integer[2])
      • Set TempItemType[1] = (Item-type of (Target item of issued order))
      • Custom script: set udg_Integer[3] = LoadInteger(udg_Recipes_Hashtable,udg_TempItemType[1], 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Made_Item[Integer[3]] Equal to TempItemType[1]
          • Integer[1] Greater than 852001
          • Integer[1] Less than 852008
          • TempItem1 Not equal to No item
          • (TempUnit has TempItem1) Equal to True
          • TempItem2 Equal to TempItem1
        • Then - Actions
          • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
          • Cinematic - Clear the screen of text messages for (All players)
          • Game - Display to (All players) the text: (|cffffcc00You have disassembled + ((Name of TempItem1) + .|r))
          • Sound - Play CreepAggroWhat1 <gen>
          • Custom script: endif
          • Special Effect - Create a special effect attached to the origin of TempUnit using Abilities\Spells\Undead\DarkRitual\DarkRitualCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Item - Remove TempItem1
          • Set TempItemType[1] = Required_Item_1[Integer[3]]
          • Set TempItemType[2] = Required_Item_2[Integer[3]]
          • Set TempItemType[3] = Required_Item_3[Integer[3]]
          • Set TempItemType[4] = Required_Item_4[Integer[3]]
          • Set TempItemType[5] = Required_Item_5[Integer[3]]
          • Set Integer[4] = Stacks_Or_Number_Req_1[Integer[3]]
          • Set Integer[5] = Stacks_Or_Number_Req_2[Integer[3]]
          • Set Integer[6] = Stacks_Or_Number_Req_3[Integer[3]]
          • Set Integer[7] = Stacks_Or_Number_Req_4[Integer[3]]
          • Set Integer[8] = Stacks_Or_Number_Req_5[Integer[3]]
          • For each (Integer Integer[10]) from 1 to 5, do (Actions)
            • Loop - Actions
              • For each (Integer Integer[9]) from 1 to 100, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Integer[(Integer[10] + 3)] Greater than 0
                    • Then - Actions
                      • Set Integer[(Integer[10] + 3)] = (Integer[(Integer[10] + 3)] - 1)
                      • Set TempPoint = (Position of TempUnit)
                      • Item - Create TempItemType[Integer[10]] at TempPoint
                      • Set TempItem1 = (Last created item)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Charges remaining in TempItem1) Equal to 0
                        • Then - Actions
                          • Hero - Give TempItem1 to TempUnit
                        • Else - Actions
                          • Item - Set charges remaining in TempItem1 to 1
                          • Hero - Give TempItem1 to TempUnit
                      • Custom script: call RemoveLocation(udg_TempPoint)
                    • Else - Actions
          • Set TempItemType[1] = (Item-type of No item)
          • Set TempItemType[2] = (Item-type of No item)
          • Set TempItemType[3] = (Item-type of No item)
          • Set TempItemType[4] = (Item-type of No item)
          • Set TempItemType[5] = (Item-type of No item)
          • For each (Integer Integer_A) from 1 to 10, do (Actions)
            • Loop - Actions
              • Set Integer[Integer_A] = 0
        • Else - Actions
Change Log

v1.0.0.0 - Uploaded to Hive
v1.1.0.0 - Reduced the code down by a ton, also fixed a bug.
v1.5.0.0 - Added disablement so a reciped item can be turned back into the original items
Keywords:
Recipe, System, Item, Combination, Disablement
Contents

RECIPE SYSTEM! (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 9th Nov 2011 Bribe: Be careful with using strings inside GetLocalPlayer blocks, yours for one doesn't need to be in one. If you want to display a message to a player without creating and...

Moderator

M

Moderator

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


9th Nov 2011
Bribe: Be careful with using strings inside GetLocalPlayer blocks, yours for one doesn't need to be in one. If you want to display a message to a player without creating and destroying a force you can do this:

  • Custom script: set udg_TempForce = bj_FORCE_PLAYER[GetPlayerId(GetTriggerPlayer())]
  • Game - Display to TempForce the text:
Currently unnacceptable in its current state as initializing a string locally causes desync.
 
Level 6
Joined
Jul 22, 2009
Messages
214
Just a suggestion like this, if the recipe cost something the system should return the gold value to the player.
 
Level 6
Joined
Jul 22, 2009
Messages
214
Oh, I've just understand something, you have to use the recipe for create the new item. I was thinking that you have to buy the recipe from a shop and it is auto use.
 
Last edited:
This is the best recipe system I have ever seen/made. For a couple of reasons, such as it supports stacks. And 2 or more of the same item type can be in the same recipe. Which is very cool :D

Isn't that the basic functionality required? ._.

Your system doesn't support player specific recipes D:

It should also support item charges :3 (My system doesn't, but it's going to =P)

One other thing: Don't use (Integer A) >.>
 
Isn't that the basic functionality required? ._.

Your system doesn't support player specific recipes D:

It should also support item charges :3 (My system doesn't, but it's going to =P)

One other thing: Don't use (Integer A) >.>

It supports charges AND item amounts. I didn't use Integer A, I made my own variable Integer_A. =p
And player specific recipes seems pointless, plus, that would only take me all of 2 mins to add, but as I said before, pretty pointless.

Oh, I've just understand something, you have to use the recipe for create the new item. I was thinking that you have to buy the recipe from a show and it is auto use.

Good point, very possible. Just set the item to use when pickup. Maybe I should add another required item slot n such? Dunno, I'll think about this.
 
It supports charges AND item amounts. I didn't use Integer A, I made my own variable Integer_A. =p

Haha
That was very misleading ;p (You're as evil as Vexorian >:D)

And player specific recipes seems pointless, plus, that would only take me all of 2 mins to add, but as I said before, pretty pointless.

What if you want a recipe to compile only for a certain player (Say, a player has to have some 'award'/'achievement' in order to compile a specific recipe.
I know it takes 2 minutes to add, so why don't you do it? ;p
 
and another thing aside from it requiring the unit to use the recipe, is the presence of a recipe itself... The system should support, recipe's which are auto-combined when you obtain the items without the need for a recipe item...

Like 2 Claws of attack = One new item...

I like my way much much more.
For one good reason, lets say someone didn't want to make said item and it did it without them controlling it. But with this, the player can be sure of what and when they will make the item.

Plus you could make the claws of attack recipes themselves, so when they are clicked it will equal 1 new item.
 
All the cool recipe systems allow you to disassemble the items.
All you have to do is store the index of the recipe array inside a hashtable using the handle id of the created recipe item.
When someone wants to disassemble an item, check his inventory size/space and if he has enough space (add 1 because you're going to remove the recipe item), turn off your system trigger and give him all the required items for the recipe system.

This has to be built in. You can't have a seperate system do the disassembling because only this system should have access to the recipe data.
 
Currently unnacceptable in its current state as initializing a string locally causes desync.

Please actually be sure of what you say before you say it. I have used this in multiplayer. It works without desyncs. And unless repeating something over and over with local player causes desyncs then this system is fine as it is. Please test in the future before you shoot down a system.
Also, I did this to spare people from having an extra variable. If you can, try the spell in multiplayer and see how it goes. Until then, I think you are obliged to take my word for it.
 
Of course, if the user don't want the item to be build with just the items, he will then add a recipe... So actually making this system run on obtaining an Item will make it more flexible because it supports both items with recipe and without recipe...

example:

Claws of IMBA - requires 2 claws of attack

then I could make another which is

Claws of more IMBA - requires 2 claws of attack + ClawsofMoreIMBA recipe

So in your current system which requires the user to use a recipe item, you can only support the second one, but not the first...

Also as you said they could make the item clickable, but what if they use item clicking for like The_Witcher's inventory system? then your system will collide...
 
Of course, if the user don't want the item to be build with just the items, he will then add a recipe... So actually making this system run on obtaining an Item will make it more flexible because it supports both items with recipe and without recipe...

example:

Claws of IMBA - requires 2 claws of attack

then I could make another which is

Claws of more IMBA - requires 2 claws of attack + ClawsofMoreIMBA recipe

So in your current system which requires the user to use a recipe item, you can only support the second one, but not the first...

Also as you said they could make the item clickable, but what if they use item clicking for like The_Witcher's inventory system? then your system will collide...

First of all, people wont be equipping recipes... Which is weird to suggest in the first place. And if they were, this system would run checking if the unit has the required items and it would equip it at the same time. The bad thing about his system is though, that he used the left click. He should have done double right click. (Which I can make this system do no problem)
And they wouldnt collide in the first place, this system doesn't activate unless a recipe is in the system. So clicking an item like gear to equip it would have no effect.
Maybe try a system before you judge it? Perhaps even just look at the code?
 
The collision was for your suggstion of making the claw a recipe itself... It will collide as the claw is both an equippable item and a recipe...

And since no one will bring a recipe in his inventory if it does nothing, th why not create the item automatically when you get all required items rther than needing to click the first?

Amyway its just a suggestion... Its still up to you...

Or rather just retain this, there's still maggy's system...
 
Top