• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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 40
Joined
Jun 9, 2011
Messages
13,184
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 40
Joined
Jun 9, 2011
Messages
13,184
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