Note: I updated the system (slightly), only some behind-the-scene fixes, you can find it
here.
That is indeed what I meant: creating 40 or more triggers is highly inefficient and will result in a loss of speed (meaning that the game is more prone to lag, although this isn't very noticable).
also were to edit so that if you hero doesent have the right items but has enough inventory for a recipie scroll a recipie scroll is given but if full gives cash back
It already does that? Check the system, seriously... and by the way: you do NOT need any inventory slot at all! Even if your inventory is full, you can still buy recipes (and if you don't have the correct items, you WILL get your gold back - if you set that up correctly at least).
Edit 3: I didn't understand you correctly at first, but I think I do now. Basically, you don't need such a thing... why would you buy the scroll before the required items? It's a waste of money, because the required items add stats.
So let's say you've got a "Scroll of heavy sword" (200g), which requires two "Light Sword"s (200g).
If you buy the scroll first, you will spend the 200g on an item which doesn't increase your stat, however: if you buy the sword first, you will have an increase in damage so you can gather the rest of the money more quickly (damage increase -> faster kills).
I hope you got all of this
[/edit]
Furthermore: the system can be used for recepies which require 1/2/3/4/5/6/... items (of course, there is a maximum of 6 due to the inventory slots, but in truth the real maximum would be 8192 items for 1 recepy).
I think it's quite easy to change, all you need to do is copy/paste the correct variables, in fact: one of the items requires 3 items (not 2, nor 1) - it's at the end of the "Init"-trigger.
Check it out and see the differences betweem 2 items and 3 items, then you should be able to create recepies for X amount of items (X = number between 1 and 6).
If you didn't understand me, I'll try explaining it a bit better.
Edit:
I'll explain the system a bit further.
Important Note: the arrays must always remain the same! (an array is the number behind the variable - Var[X], X is the array here).
Variable Name | Explanation |
RecipeCount: | May not be edited! Must always be copy/pasted! (It counts how many recipes there are to set them up correctly). |
StartFrom: | May not be edited! Must always be copy/pasted! (It counts from which item integer the recipe has to start counting). |
ItemCount: | May not be edited! Must always be copy/pasted! (It's the counter for the item integers, must be added before every item required in the recepy). |
ItemType: | This is the item type required for the system (how to add multiple items will be seen later on). |
RecipeType: | The real item for the recipe, this must NOT be added to shops. |
RecipeCombiner: | The dummy item required for combining the items (a tome), this must be added to the shop. |
GoldCost: | The gold you will get refunded once the combining fails (thus the gold cost for the recipe scroll). |
Adding multiple items to the recipe:
Basically, this is all you need:
-
Set ItemCount[RecipeCount] = (ItemCount[RecipeCount] + 1)
-
Set ItemType[((ItemCount[RecipeCount] + RecipeCount) - 1)] = [Item Type]
You need to copy/paste this for every item type you wish to add to the recipe.
An item which requires 5 items looks like this:
-
Set RecipeCount = (RecipeCount + 1)
-
Set StartFrom[RecipeCount] = (ItemCount[(RecipeCount - 1)] + StartFrom[(RecipeCount - 1)])
-
Set ItemCount[RecipeCount] = (ItemCount[RecipeCount] + 1)
-
Set ItemType[((ItemCount[RecipeCount] + RecipeCount) - 1)] = [Item 1]
-
Set ItemCount[RecipeCount] = (ItemCount[RecipeCount] + 1)
-
Set ItemType[((ItemCount[RecipeCount] + RecipeCount) - 1)] = [Item 2]
-
Set ItemCount[RecipeCount] = (ItemCount[RecipeCount] + 1)
-
Set ItemType[((ItemCount[RecipeCount] + RecipeCount) - 1)] = [Item 3]
-
Set ItemCount[RecipeCount] = (ItemCount[RecipeCount] + 1)
-
Set ItemType[((ItemCount[RecipeCount] + RecipeCount) - 1)] = [Item 4]
-
Set ItemCount[RecipeCount] = (ItemCount[RecipeCount] + 1)
-
Set ItemType[((ItemCount[RecipeCount] + RecipeCount) - 1)] = [Item 5]
-
Set RecipeType[RecipeCount] = [Recipe Item]
-
Set RecipeCombiner[RecipeCount] = [Dummy Item]
-
Set GoldCost[RecipeCount] = [Gold]
I cannot express how ALL arrays should stay as they are!
Otherwise the system will mix up different items, gold cost and dummy recipes with eachother and will thus fail completely.
Basically, you only need to change the item types (required items, dummy item, combined item) and the gold cost, that's all.
It's extremely easy once you get it ^^
Edit 2: if you want to refund lumber, it is also very easy to add to the system: first you should duplicate the variable "GoldCost" and rename it to "LumberCost".
Then you should set it up the
exact same way as GoldCost (so it'll just be LumberCost[RecipeCount] for every recipe) and then you need to go into the core of the system.
In the trigger "Item Recipe", scroll all the way down, at the very bottom you will see the action "Player - Add GoldCost[LoopInt3] to (Owner of (Triggering unit)) Current gold".
Copy/paste this, but change the variable to LumberCost[LoopInt3] and, of course, make it add lumber instead of gold.
(changing the text message is optional).
You can add
anything to this system this way (different special effects for every combination, a special message to show to players, anything you can think of).