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
 

Trollvottel

never aging title
Reaction score
262
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.
 

Kenny

Back for now.
Reaction score
202
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
 

Matrix

New Member
Reaction score
5
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..
 

Romek

Super Moderator
Reaction score
964
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.
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
Geez, another one? :/
Lines mean nothing, it's the performance that counts.

Isn't there one already in the Systems section?
 

SerraAvenger

Cuz I can
Reaction score
234
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...
 

cr4xzZz

Also known as azwraith_ftL.
Reaction score
51
> 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)
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
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.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top