• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Ideas for recipe system

Status
Not open for further replies.
Level 11
Joined
Jan 2, 2016
Messages
472
Ok so i'm kind of stuck with this and need your help guys!

How does one go about and make a recipe system where each item requires two or more different items in order to be made ? I would know how to make a system where only one type of item is required but more items ?
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
I made a recipe kind of system for a contest. Zephyr Contest #14 - Unique Summoning

Basically I'd imagine you have an array of items that contains all required items. You look through the list and once you find an item, remove it from the list. Once the list is empty you know you have all the items.
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
No need to hack around with arrays, you can do it really easily in wurst in an OOP manner, and if you're a programmer, you could as well learn it. Also you can do it in vjass but I can't recommend it.

Agreed. I would not expect someone who asks this kind of question to be familiar with wither jass or wurst.
 
Level 14
Joined
Jan 16, 2009
Messages
716
You can easily use multi dimensional array in jass if the total size (MAX_COLUMN*MAX_LINE) is under the array limit.
set array[line][column] = array[line*MAX_COLUMN+column]

For instance :
array :
{10, 11, 12, 13},
{14, 15, 16, 17}

array[0][3] : array[3] = 13
array[1][0] : array[4] = 14
array[1][3] : array[7] = 17
 
Status
Not open for further replies.
Top