System Matrix Recipe System

Matrix

New Member
Reaction score
5
My first sytem I've created.
**************************************************************************************
*************************Simple Recipe System v1.01***********************************
**********************************************************************************
******************************By: Matrix****************************************
Pros:
1) Allow same item-types [like Stygian Desolator]
2) Consists of 74 lines
3) Can be used not only for Jassers/vJassers but also for GUI users
4) It is the simpliest system I've ever seen:)
Cons:
The only thing it's bad is if's. Due to them it's not very fast
*******************
**Changelog v1.02**
*******************
1) Added RecipeEx function
2) Now function returns a boolean depending on wether the recipe succeeded or not
3) More Cleaner&Leakless code
*******************
**How to implant:**
*******************
The system is very easy. The only things you'll have to do to implement the system is to
copy the custom script code
*******************
**How to use:******
*******************
To use this system u have to have a trigger with the event unit pick up item and in the actions
just write:
call Recipe(GetTriggerUnit(),'rde3','rde1','rde1',0,0,0,0)
Arguments:
GetTriggerUnit() - Unit that picked up item //I think it is clear
'rde3' - The New Item rawcode (the rawcode of the item that must be created)
'rde1' - The Rawcode of the first ingredient
'rde1' - The Rawcode of the second ingredient
0 - The Recipe hasn't more ingredients so the 3,4,5,6 ingredient are 0

************************
*****Trouble Shooter****
************************
Q: I have some troubles with this system. It doesn't work!!!
A: The reason maybe globals. If u have global integer i, i1,i2,i3,i4,i5,i6,count,j,ni... and all the arguments the system works with.
If u havent JassNewGenPack all must be Ok.

Q: Why did u do this shit?
A: I'm cr8ing an AoS map and I was searching for a simple recipe sytem but I didn't find=(
That's why I decided to cr8 my own =)


Hopefully you like the system!
~Matrix 3.08.08

P.S. I think I found my new home...
It's thehelper.net - really helper
Thx a lot to Earth-Fury for his suggestion
JASS:
function Recipe takes unit hero, integer ni, integer i1, integer i2, integer i3, integer i4, integer i5, integer i6, string Effect, string where returns boolean
local integer id
local integer i = 0
local integer j = 1
local integer count = 0
local item array Items
local item it = null
if i1!=0 then
   set count = count+1
endif
if i2!=0 then
   set count = count+1
endif
if i3!=0 then
   set count = count+1
endif
if i4!=0 then
   set count = count+1
endif
if i5!=0 then
   set count = count+1
endif
if i6!=0 then
   set count = count+1
endif
loop
    exitwhen i>5
    set it = UnitItemInSlot(hero, i)
    set id = GetItemTypeId(it) 
    if id == i1 and i1!=0 then
           set Items[j] = it
           set j = j+1
           set i1=0
    elseif id == i2 and i2!=0 then
           set Items[j] = it
           set j = j+1
           set i2=0
    elseif id == i3 and i3!=0 then
           set Items[j] = it
           set j = j+1
           set i3=0
    elseif id == i4 and i4!=0 then
           set Items[j]= it
           set j=j+1
           set i4=0
    elseif id == i5 and i5!=0 then
           set Items[j] = UnitItemInSlot(hero, i)
           set j=j+1
           set i5=0
    elseif id == i6 and i6!=0 then
           set Items[j] = it
           set j=j+1
           set i6=0
    endif
    set i = i+1
endloop
set i = 1
if j-1!=count then
   return false
endif
loop
    exitwhen i>count
    call RemoveItem(Items<i>)
    set Items<i>=null
    set i = i+1
endloop 
set it = null
set bj_lastCreatedItem = UnitAddItemById(hero, ni)
call DestroyEffect(AddSpecialEffectTarget(Effect,hero,where))
return true
endfunction
function RecipeEx takes unit hero, integer ni, integer i1, integer i2, integer i3, integer i4, integer i5, integer i6 returns boolean
    return Recipe(hero,ni,i1,i2,i3,i4,i5,i6,null,null)
endfunction</i></i>

Download Simple Recipe System v1.02
 
maybe you want to add implementation instructions and a little argumentation why to use this system and not the other systems which are out here? I for myself would prefer a system for which i only set the ingredients of a recipe and which automatically combines them.
 
Maybe put the script in JASS tags, and also i think i found something wrong with the script.

JASS:
if i6!=0 then
   set count = count+1
   set ItemIde[count]=i6 // ItemIde ??? 
endif
 
2 Trollvotell
I just search a simple system withouy cache but i Did'nt find it.
So that's why I've cr8ed this one..
 
Don't Double Post.
Use JASS tags.
Stop saying "cr8ed". I keep thinking its "Cried" and it's easier to read "created"

Saying what it does (Although its obvious) and actually saying what the arguments are would help.
 
Geez, another one? :/
Lines mean nothing, it's the performance that counts.

Isn't there one already in the Systems section?
 
2 Trollvotell
I just search a simple system withouy cache but i Did'nt find it.
So that's why I've cr8ed this one..

what about mine?
It is currently outdated and will be changed to constant speed in a few weeks though ( using hashtables ). This will also allow for more than just 2 items per recipe : D

Mine just takes the recipes and then combines automatically.
I do however not remember wether 2 of the same items were allowed...
 
> 2) Allow double item types [as Stygian Desolator in Dota]
You should give a better example. Some people may not know what Stygian Desolator because they haven't played DotA. Maybe you could edit it like:
2) Allow double item types (like combining 2 Gloves of Haste into something new)
 
JASS:
function RecipeEx takes unit hero, integer ni, integer i1, integer i2, integer i3, integer i4, integer i5, integer i6 returns boolean
    return Recipe(hero,ni,i1,i2,i3,i4,i5,i6,null,null)
endfunction

Erm... RecipeEx should have more arguments then Recipe... Ex = Extended, usually. That's how the other JASS functions work, the Ex version has more arguments(Most of them, it's a Z coordinate added - Some of the lightning ones have this).

Really, Recipe should call RecipeEx and give "" as the argument for the strings, not the other way around.

To use this system u have to have a trigger with the event unit pick up item and in the actions
just write:
call Recipe(GetTriggerUnit(),'rde3','rde1','rde1',0,0,0,0)
How about you give a working example? That will give a "not enough arguments" error, as Recipe also takes two strings.
 
I don't see a difference between this and the multiple other "recipe" systems.

As long as this doesn't offer something unique it's graveyarded.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is weird seeing a way more realistic users online number
  • The Helper The Helper:
    Happy Tuesday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top