need item Recipie help

Status
Not open for further replies.
Level 15
Joined
Jul 9, 2008
Messages
1,552
i know how to create item recipies but how can i make or find a recipie system in GUI that can make the recipies evan if you heros inventory is full.

e.g item bla bla needs claws of attack / boots of speed / the recipie scroll item

the hero has claws of attack/boots of speed/mana potion/heath potion/shield/monkey's tail

so the hero is full but has the items to create the recipie all he needs to do is buy the recipie item. This system will let him buy the recipie scroll item and create item bla bla evan tho he is full

also need it for auto recipies(recipies that are made when u get the right items and you do not need to by the recipie scroll)
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
so that alows heros to buy items evan if they are full

so what do i do if the hero buys it and is full but doesent have all the needed items?
does it end up on the floor and i have to remove it then give the cash back?

EDIT:still in need of help
 
Last edited:
Level 7
Joined
Dec 24, 2009
Messages
257
Well... I know what exactly you need...
These are what you need at start:
Claw of Attack [real]
Boots of Speed [real]
Recipe Scroll [real]
The final item (call it Clawed Boots) [real]
----------
Claws of Attack [fake]
Boots of Speed [fake]
Recipe Scroll [fake] [with the icon of the Clawed Boots]

*note* I will explain about the [fake] things. The "Claws of Attack, Boots of Speed [fake], and also the recipe scroll, are based on a power up item. Power up items are items that have "Automatically used when acquired" == true, "Perishable" == true, has 1 charge, and has no permanent effect (I advise no effect those fake items)

And now work with the shops.
In shops, set them to sell fake items (yeah fake items). my system work like this: when a fake item is bought (or acquired), they will be used immediately. The trigger will check if you have all the items needed for the Clawed Boots. If you have everything (beside the acquired item), it will remove items in your inventory that are involved and create the Clawed Boots in your inventory. If you don't have all of them then it will create the matching [real] item. If your inventory is full already, you can choose to drop the bought item on the floor [fake one], or return the money, depending on your own trigger.

For example: You buy Claws of Attack [fake] from shop, which is actually a power up item. It will be used; and if you have the recipe scroll and the Boots of Speed [all real] in your inventory, they will disappear and a Clawed Boots will appear right after that. If you don't have all, triggers will create a Claws of Attack [real] in your inventory; if your inventory is real, the claws [fake] will be dropped on floor

Trigger:
  • Trigger 1
  • Events
    • Unit - A unit acquires an item
  • Conditions
  • Actions
    • If all conditions are true the do (Then actions) else do (Else actions)
      • If - Condition
        • (Item type of (Item being manipulated)) equal to Claws of Attack[fake]
      • Then - Actions
        • If all conditions are true the do (Then actions) else do (Else actions)
          • ((Hero manipulating items) has has an item of type Boots of Speed[real]) equal to True
          • ((Hero manipulating items) has has an item of type Recipe Scroll[real]) equal to True
        • Then - Actions
          • Item - Remove (item carried by (Hero manipulating item) of type Boots of Speed[real])
          • Item - Remove (item carried by (Hero manipulating item) of type Recipe Scroll[real])
          • Hero - Create Clawed Boots and give it to (Hero manipulating item)
        • Else - Actions
          • If all conditions are true the do (Then actions) else do (Else actions)
            • If - Condition
              • (Number of item carried by (Hero manipulating item)) equal to 6
            • Then - Action
              • Set Temp_Point = Position of (Hero Manipulating Item)
              • Item - Create Claws of Attack[fake] at Temp_Point
              • Custom script call RemoveLocation(udg_Temp_Point)
            • Else - Action
              • Hero - Create Claws of Attack[real] and give it to (Hero manipulating item)
Repeat this trigger 2 more times for the left 2 pieces
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Creating a trigger per recepy is a very bad way.
Here's a system I created a while back, you only need 2 triggers for as much recipes as you need (well, there IS a max though, about 4000 with 2 items/recipe).

Why tomes?
Because you don't need a free inventory slot to combine items with this system, exactly what you wanted.
Note that this system is meant for shops, not item drops (as the gold will refund, thus if it is an item drop you will gain gold instead of the recipe just failing).

(Also, sorry about the icons: I was in a bit of a hurry and couldn't be bothered to change those to actually fitting icons - I extracted this system from one of my maps which uses custom icons, but didn't export them for the file size).

I hope you understand the layout of the shop, basically: the first row == base items, rows after that need the previous item from the same collumn.
If that's too much jibberish for you, test the map and try to find the system behind it xD

Enjoy...
Recipe System(ap0)
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
thanks it works fine but its for recipies that only need 2 items so
e.g ring agi and ring intell will make power ring

so im going to need somthing like this system to do
recipies that require 2(this one)/3/4 items to create the compled recipie

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
 
Level 7
Joined
Dec 24, 2009
Messages
257
No I meant that the problem Ap0c mentioned is not serious. He meant when a [real] item is dropped then taken back, not bought from shop, my trigger wont work (Because it only works with [fake] items right?). But if you remove [real] item and make [fake] item when you drop the [real] one everything will go well
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
No I meant that the problem Ap0c mentioned is not serious. He meant when a [real] item is dropped then taken back, not bought from shop, my trigger wont work (Because it only works with [fake] items right?). But if you remove [real] item and make [fake] item when you drop the [real] one everything will go well

im pritty sure what he is saying is having so many triggers is not good not the trigger itself

Creating a trigger per recepy is a very bad way.
Here's a system I created a while back, you only need 2 triggers for as much recipes as you need (well, there IS a max though, about 4000 with 2 items/recipe).[\QUOTE]
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
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 :p
[/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 NameExplanation
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).
 
Last edited:
Level 15
Joined
Jul 9, 2008
Messages
1,552
Sure here only thing is i dunno if its the first or second one
is it possible to also add if people by the recipie with out the needed items they get a scroll item i no its dum to buy the recipie first its a waste of money but believe it or not iv seen alot of people do it
 

Attachments

  • RecipeSystem(ap0).w3x
    34.9 KB · Views: 86
Level 28
Joined
Jan 26, 2007
Messages
4,789
I'm sorry, I have been able to do what you said, but the system would become rather inefficient (it would require another variable for another dummy item, so you'd have to need 2 dummy items per recipe and with 40-60 recipes, that's not what you want I assume).

A system that returns the correct amount of gold should be sufficient, as the player will not lose anything this way.
And honestly: I still don't see the point. Even if you say a lot of people do it, it doesn't mean it's good/smart.
With my system, the player will just get his gold back and thus he can spend it on what he actually needs, or save it for later.

A system I would like to work on is where you have some kind of bag and if your hero carries a +6 attack sword and your bag carries a +6 attack sword, that it could combine to a +12 attack sword (even though your hero doesn't have all the required items, your bag has the other half).
If this last idea is better in your opinion, then I shall do my best to change it to that.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
whats the problem with adding if hero doesent have the items needed and isent full it will give the hero a scroll
Like I said: because the items required are tomes, you cannot give them to the hero (it will instantly use them -> still no required items -> gives tome again -> infinite loop).
Thus you need to create another variable and another item (meaning that a recipe that requires 2 items would need a total of 5 items: the 2 required items, the combined item and the 2 dummy items).
Let's say you have 40 items which each require 2 items, you will need to create 200 items (instead of 160 items).

In addition to that, you need another trigger that reacts in another way (the main trigger now reacts to when a tome is used, but with a scroll as an item you need to make it react to any purchase).
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
Like I said: because the items required are tomes, you cannot give them to the hero (it will instantly use them -> still no required items -> gives tome again -> infinite loop).
Thus you need to create another variable and another item (meaning that a recipe that requires 2 items would need a total of 5 items: the 2 required items, the combined item and the 2 dummy items).
Let's say you have 40 items which each require 2 items, you will need to create 200 items (instead of 160 items).

In addition to that, you need another trigger that reacts in another way (the main trigger now reacts to when a tome is used, but with a scroll as an item you need to make it react to any purchase).

why does it keep on giving tomes...and loop?
the scroll is a normal item

then what do you suggest.... how does dota do it

iv done it in dota buying the scroll first because it will save me time running back and buying the scroll later and i dont have enough money for the full recipie and i can buy the other needed items for the recipie at another shop tha ti s closer
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
why does it keep on giving tomes...and loop?
the scroll is a normal item

then what do you suggest.... how does dota do it

iv done it in dota buying the scroll first because it will save me time running back and buying the scroll later and i dont have enough money for the full recipie and i can buy the other needed items for the recipie at another shop tha ti s closer
In my system, the scroll is a tome.
And as I've said before: I DID do the system, but it's just too inefficient.
If I would code it in JASS it'd be better though, but still not as good as it is now.

It won't save you time running back and forth, or at least: you won't get any better with it.
If you save for the items which actually do something first, you increase your stats and thus you have a higher gold income and can get the rest of the required items faster.

And the little loss of time is quickly made up for, and that time is exactly why I proposed the bag: you don't need to run back and forth if you have a bag (you could transfer items from bag to hero and you can combine items which are in both the hero's as the bag's inventory).
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
why is the scroll a tome??? your hero should be able to hold the scroll..........
Because then you need a free inventory slot, you don't need free inventory slots with tomes!
And if I had to choose between using a tome (no inventory slot) or a held item (free inventory slot), then I'd choose the first one, even if it doesn't directly allow me to buy the scroll first.
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
Because then you need a free inventory slot, you don't need free inventory slots with tomes!
And if I had to choose between using a tome (no inventory slot) or a held item (free inventory slot), then I'd choose the first one, even if it doesn't directly allow me to buy the scroll first.

it should be an item not a tome

ok you got your recipie it needs 2 items and the recipie

your hero buys the recipie(tome) it doesent have the needed items so it is given a scroll that can create the recipie if its full the money is given back...ect

so instead of givng a warning saying the hero doesent have the items give it a scroll if its full give the hero a warning saying its full

i dunno why you made the scroll a tome when its suppose to be in the heros inventory?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
it should be an item not a tome

ok you got your recipie it needs 2 items and the recipie

your hero buys the recipie(tome) it doesent have the needed items so it is given a scroll that can create the recipie if its full the money is given back...ect

so instead of givng a warning saying the hero doesent have the items give it a scroll if its full give the hero a warning saying its full

i dunno why you made the scroll a tome when its suppose to be in the heros inventory?
Would you kindly read what I said?

1) The item SOLD in the SHOP is a tome.
2) Not enough gold? -> creates a HELD ITEM SCROLL.

That is what I said at first!
The PROBLEM here is that you need to create TWO dummy items, instead of ONE and you need to create an additional variable and a completely new trigger on top of the other one.
That means: TWO (huge) triggers, TWO dummy items, ONE MORE variable, just because you want to buy the recipe first.

Okay?
 
Status
Not open for further replies.
Top