How To Make Item Recipes
In this tutorial I'm gonna go over the various possible recipe styles and how they are accomplished. If you've ever played DotA you'll note that there are 2 kinds of recipes: Manual Combine and Auto Combine. I'll cover both, and even a little extra.
A note on terminology: I will refer to Items that are a part of a recipe as "factors".
Another note: I have never looked at the DotA triggers, so I do not know if my methods are their methods.
Since DotA is such a well-known map, I figured that it would be a good idea to use their recipes as examples, since it is a stable platform that many can relate to.
Manual Combine Theory
The concept of a Manual Combine involves a Recipe Factor and any number of Ingredient Factors. For example, in making the Magic Sword
you might have to have the Ingredients Sword
and Magic Dust
, as well as the Recipe Magic Sword
Manual Combine is only used when the Recipe actually costs anything. You buy the Sword
for 500g, the Magic Dust
for 250g and the Magic Sword
recipe for 250g, and they all fuse together to create the Magic Sword
end result. In a case where the Recipe costs nothing, use Auto-Combine.
An example from DotA of a Manual Recipe, with the Factors. 2 Ingredients and the Recipe make the whole: Belt + Axe + Recipe = Sword.
Auto Combine Theory
The idea of Auto Combine uses any number of Ingredient Factors, but no Recipe Factor. As in DotA, it is best to have all Recipe Factors visible in a shop with a description of the ingredients so players can compile them, and this holds true for Auto-Combine recipes, except they should not be purchase-able since they are useless (in DotA they cost wood, which players never get).
Using the same example of the Magic Sword
, if it were auto-combine, you need only collect the Factors (Sword
and Magic Dust
) and they would automatically fuse without a recipe. This means that there is no extra charge beyond the cost of the ingredients. An Auto-Combine item typically forms instantly whenever the Hero is carrying all of the ingredients. If you need to get a Recipe, even if it's free, it's technically not an auto-combiner.
An example from DotA of an Automatic Recipe, with the Factors. 2 Ingredients combine without an actual Recipe Factor to make the whole. Ring + Pendant = Sphere.
Manual vs. Auto Combine
Combining items can be a serious issue of balance, but luckily there are so very many ways to tweak it. When you combine two or more items together into a single item that holds the same stats, you are essentially freeing up inventory space. This is quite an asset in any type of Hero-based map, such as AoS or RPG. It's up to you to put a price tag on how much the extra inventory space is worth, and make the Recipe Factor cost that much.
There are a number of cases where you don't want to add any extra cost on, such as if the Product Item actually has (somewhat) less stats than the Ingredient Factors put together, or has a different effect. Also, if the number of Ingredients is large (say, 3+) the toll-taking effect of carrying around that many partially-useful items in your inventory might balance it out. Lastly, if some of the Ingredients do nothing on their own (maybe like Magic Dust
in our example) you would not add price for the extra inventory slots gained by freeing up the spots where the useless items were. You would only add cost for the bonus given by that item.
(In the example, let's say Sword
gives +10 damage and Magic Dust
gives nothing. But put together, Magic Sword
gives +10 damage and a Poison attack. You don't add anything for the inventory slots "freed" by combo-ing in Magic Dust
, simply set the price of the stuff to however much a Poison attack is worth.)
(Just to demo the other end of the spectrum, if Sword
gives +10 damage and Magic Dust
gives Poison attack, and Magic Sword
gives +10 damage and Poison attack...then you make Magic Dust
cost the price of Poison attack, and the Magic Sword
Recipe cost X gold, where X is the price you determine it's worth to free up an inventory slot by combining the two items.)
Manual Combine Setup
To create a Manual Combine recipe, the items you need are the Ingredient Factors, (once again, Sword
and Magic Dust
) a Mask Recipe
, a Scroll Recipe
, (made up terms, use whatever you like) and finally the actual item.
You may have noticed in DotA that in the shops, all of the recipes look like their component items. Yet when they are purchased without the sufficient Factors, they look like Scrolls in your inventory. I call the shop recipe the "Mask" and the inventory recipe the "Scroll". They are actually identical in every respect, including cost, except that one has the icon of the end product item and the other one has a scroll icon.
An example from DotA of the "mask recipe", while in the shop. Looks like the Finished Item so that different recipes in the shop can be distinguished easily, and has a particular gold cost.
An example from DotA of the "scroll recipe", while in an inventory. Has a Scroll Icon to prevent the carrier for mistaking it for the actual item, and has the same gold cost as the "mask recipe" so that it can be sold back properly, if the owner doesn't end up using it.
The simple way this is triggered is that when you buy the Mask Recipe from the shop, it is instantly replaced with the Scroll Recipe version. The Scroll Recipe version is what is handled and checked for and whatnot in all of your Recipe Triggers. Since the prices of the two are the same, you can sell back the Scroll Recipe just as you would have the Mask Recipe. This method adds more baggage, but is simply more aesthetically pleasing and not confusing, either.
(If you make the recipe look just like a Scroll, it will be hard to instantly see what you want in the shop. If you make the recipe look like the item in your inventory, it can confuse you into thinking you have the item.)
Then, when all the ingredients are put together and the Recipe is activated, remove it all and put in the end product item. I did consider simply having the Recipe be the end product and removing it if you did not have all the ingredients, but I realized that the sell-back price of the item would be half of the cost of the Recipe Factor, without taking into account the cost of the Ingredient Factors. So this is the best method.
An example from DotA of the End Product of the recipe. Note that the gold cost totals the cost of the entire recipe (give or take a tad) so that it can be sold back properly, and you are returned money for all of the ingredients.
Auto Combine Setup
Auto Combine setup is easier, you simply need the Mask Recipe since there's no Scroll Recipe to be had. When they get all the Ingredient Factors in their inventory, remove and add the End Product item, voila.
To make the Mask Recipe un-buyable, your best bet is to make it cost something the player doesn't have. The "cleanest" method is to make it cost (one) wood, but depending on your map that might not be feasible. Alternately, you could make it cost an impractical amount of gold, and if you wanted to be safe, set up a trigger so that whenever someone bought one of the Auto-Combine Mask Recipes, give 'em their money back and remove it.
An example from DotA of the mask recipe of an Auto-Combine item, while in the shop. Looks like the Finished Item so that different recipes in the shop can be distinguished easily, and has no cost (they have special methods in DotA to do this, it actually costs lumber but the lumber icon has been toyed with).
An example from DotA of the End Product of an Auto-Combine recipe.
Manual Combine Triggers
Now we're getting to the meat of the matter. How do you actually do it? There are many specific methods and techniques and variations, all depending on what you really want. I'm not going to explore them all-that would take forever. Instead, I'm going to give you an example
. This is one way a Manual Combine recipe could be done (and probably the way I would do it).
Mask2Scroll: Replacing the Mask Recipe with the Scroll Recipe.
Combine: Combining the items.
Here we have the Gloves of Power
with the Ingredient Factors
of Gauntlets of Ogre Strength +3
& Gloves of Haste
and a Recipe Factor
You may note how I did a check for each type of item at the beginning of the trigger. It might be a good idea if you are going to do a lot of these to somehow assign them to array variables instead of checking each one specifically. There are several ways to do this, but that's a variation that's up to you.
Auto Combine Triggers
Auto-Combine in terms of triggers is almost identical to Manual Combine; Auto-Combine just doesn't need the Mask2Scroll trigger. Here is my example of an Auto-Combine trigger:
I reiterate that this is almost identical to the above Manual Combine trigger, it simply has one less ingredient though.
Now that we have a second trigger you can note some contrasts. I use the Ingredients integer variable and the RecipeFactor Item-Type Array variable to go along with For Loops and simply streamline the process and make it more efficient. You can take this to the next level as I mentioned earlier by saving all the data to variables in an Initialization trigger, and simply reading off those for everything, including the Trigger's Conditions.
In closing, I'd like to refer you to Diablo-dk's Recipe System
that is here at Hive itself, in case you don't feel like triggering your own unique system.
Even if you use a premade system and don't design your own I hope you at least take away from this tutorial a good concept of the balance issues surrounding Item Recipes.
And for any of those that want to see the Demo Map I created for this tutorial, here it is: Item Recipes.w3x
Originally Posted by GST_Nemisis
toolbox describes the theory of item recipies very well but the triggers he shows are bugged and not effective in all situations. i would suggest using these two triggers:
this one by razorbrain can be used to automatically create an item when a unit picks up two items of a different type
. with this trigger you must also have a recipie item, but if you remove the lines "((Triggering unit) has an item of type Recipe) equal to True" and "Item - Remove (Item carried by (Triggering unit) of type Recipe)" it will do it when the unit automatically when the unit aquires the items.
this can be used to turn two items of the same type
into another item (for example Claws of Attack +15 + Claws of Attack +15 = Crown of Kings +5). this happens automatically but by adding the condition and action mentioned above you can make it require a recipie item. for this you need the integer variable ItemAmount.