System Recipe System

Gotham

New Member
Reaction score
7
A very simple recipe system. Doesn't require any other system or global variable.
Based on this, by emjlr3.

What it does:
It replaces certain items in the inventory of a hero, with another item (think of DotA Allstars recipes).
It can handle double item requirements (like Desolator from DotA, who uses two Hammers and the Recipe).
It can create a custom special effect when the recipe is created (like using dull effects on weak recipes, and flashy effects on powerful recipes).

Step-by-step installation:
1. Create a trigger named whatever you like
2. Add the Generic Unit Event "A unit acquires an item"
3. Convert to custom text (Edit / Convert to Custom Text)
4. Add the following code BEFORE anything in the trigger.
JASS:
function CreateRecipe takes unit u, integer result, integer it1, integer it2, integer it3, integer it4, integer it5, integer it6, string fxpath, string fxattpoint returns nothing
//=== Made by Gotham (based on emjlr3's work) for TheHelper.net ===
    local integer i = 1
    local integer j = 0
    local integer array it
    local integer total = 0
    local item current
    local boolean array used
    local boolean recipe = true
    
    set it[1] = it1
    set it[2] = it2
    set it[3] = it3
    set it[4] = it4
    set it[5] = it5
    set it[6] = it6
    set it[7] = 0
    
    loop
        set total = total + 1
        exitwhen it[total]==0
    endloop
    
    set i = 1
    loop
        exitwhen i==total
        loop
            exitwhen j>5
            set current = UnitItemInSlot(u,j)
            if GetItemTypeId(current)==it<i> and used[j]==false then
                set used[j] = true
                set j = 5
            elseif j==5 then
                set recipe = false
            endif
            set j = j + 1
        endloop
        set j = 0
        set i = i + 1
    endloop

   if recipe==true then
     loop
       exitwhen j&gt;5
       if used[j]==true then
         set current = UnitItemInSlot(u,j)
         call RemoveItem(current)
       endif
       set j=j+1
     endloop
     call UnitAddItemById(u,result)
     call DestroyEffect(AddSpecialEffectTarget(fxpath,u,fxattpoint))
   endif

set current = null
//=== Made by Gotham (based on emjlr3&#039;s work) for TheHelper.net ===
endfunction</i>

5. In the actions function (below the line that should look like "function Trig_Name_Of_Your_Trigger_Actions takes nothing returns nothing" and above the line "endfunction") put the following code for each recipe you want (each on a different line):
JASS:
call CreateRecipe(GetTriggerUnit(),result,item1,item2,item3,item4,item5,item6,fxpath,fxpoint)

What you should replace:
GetTriggerUnit(): leave it unchanged.
result: replace it for the rawcode of the item you want to create, between two 's.
item1-6: replace them for the rawcode of the required items (remember the 's). If you want less than 6 items, START FOR ITEM 1, and go increasing order! Replace the unused slots with 0 (zeros), with no 's.
Note: in order to get the rawcode of an item, open the object editor, go to the Items tab, press Control+D, the first four letters are the rawcode. Remember that they are CaSe SeNsItIvE.
fxpath: replace it for the path of the desired special effect, between two "s. Don't forget to replace any backslash ( \ ), for double backslashes ( \\ ).
Note: In order to get the path for an special effect, open the Object Editor, go to the Abilities tab, select any ability, double-click on "Art - Effect", click on "Add Model", select the effect you want (remember that you can see it while browsing in the gray square at the left of the WE's main window), click Ok, double-click on the model you just added, select all the text in the "Custom" box, and then you have your Special Effect's path. Then just click Cancel and Cancel and you're done.
fxpoint: replace it for the place where the Special Effect should be created (like head, overhead, origin, etc.), between two "s.
Note: if you don't want any Special Effect, replace fxpath and fxpoint with "".
6. Done!




Gotham, based on emjlr3's work.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Didn't AceHart post something very similar? I'll have to investigate...
 

Gotham

New Member
Reaction score
7
I looked into the System Index, and founded 2 Recipe Systems. The Rheias' one uses local handle variables, the BlueSin's one is poorly explained and messy.
Yesterday I created this for a map, because I don't wanted to use handle vars, and, honestly, didn't found BlueSin's one (and it can only support 3 items).
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Basically my system, but you create a trigger per recipe instead of line per recipe. I understand why, you, like many others don't like handle vars, so yeah, it can do if you hate handle vars.
 

Gotham

New Member
Reaction score
7
Basically my system, but you create a trigger per recipe instead of line per recipe. I understand why, you, like many others don't like handle vars, so yeah, it can do if you hate handle vars.
I use handle vars myself. This system uses a line per recipe, not a trigger per recipe :)

http://www.thehelper.net/forums/showthread.php?t=54113

I knew AceHart posted something like this. Although, the one you posted is actually made by emjlr3...Well, it's slightly modified.

Post #2 and #3.



Oh, the sorrow...
Yeah, I based this on emjlr3 post, I forgot to put credit (I didn't sleep for 30 hours in a row or so). The main thing I did was merging it with the creation of the item itself, not just a check, because I feeled that way was better. I tought that his post would be forgotten in the forums, and it was very helpful, at least for me (no handle vars required, and it's very simple). So I modified it a bit and posted it, not because I wanted to borrow someone's work, I did that because I tought it could help someone. And then just maked a tutorial for unexperienced mapmakers, for easier implementation.

You don't need to attack me, as I said there was no evil intention, I just wanted to help.
Anyway, I will update the post giving credits to emjlr3, for the base idea.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
I did not attack You. Just credit the original author and it's fine (as long there isn't a problem with emjlr3 not allowing you to use it). :)


I just hate lying. Can't tolerate that one bit.
 

Sim

Forum Administrator
Staff member
Reaction score
534
I like this system actually. It does work, without any other system or anything needed. It is based on other people's work, but it's good nonetheless.
 

waaaks!

Zinctified
Reaction score
255
got 1 question

does this work when there are 2 of the same item used as a component?
like

2 gauntlets of strength = 1 belt of ogre strength?
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Can I have multiple
call CreateRecipe(GetTriggerUnit(),result, ...
in one trigger or do I have to create separate one for each recipe?
 

Sim

Forum Administrator
Staff member
Reaction score
534
You can have multiple of them. Although I don't recommend calling the function more than 500 times simultenaously...
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
> Although I don't recommend calling the function more than 500 times simultenaously...
Yeah, I suppose it will lag like hell...
One last question. Can I put it in a library? If yes then how would I call the function? call <library name>_<function name> or just call <function name> ?
 

gref

New Member
Reaction score
33
If its public, you call "call <library name>_<function name>"
If its private you don't :p
It it's just function call "<function name>"

Your choice
 

Sim

Forum Administrator
Staff member
Reaction score
534
Why put it inside a library?

Anyways, what do you guys think of this system?
 

gref

New Member
Reaction score
33
Potentially useful.
It is a recipe system, and there are about 800 of these...

I vote include it as a snippet, because its a function, not a system... but it's still potentially very useful.
 

Sim

Forum Administrator
Staff member
Reaction score
534
No, according to my system definition inside the submission rules it is a system.

> but it's still potentially very useful.

The point is that its fairly simple compared to other systems and it also doesn't require any kind of other system.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top