Legacy GM Crafting system

M

MakSM

Guest
god, i have no idea what im doing here, its kinda my first time doing this kind of thing so i need a little help.

The system i'm trying to make looks at an array which has all info about the set potion

the 1st screen: http://imgur.com/a/eaYoA

In the 1st screen it takes into account the potions you have and creates boxes for each one, when each one is highlighted it shows info about the potion in a box to the left. It creates all of them in a draw function over the top of the screen.

Im having trouble with the second screen though

the 2nd screen: http://imgur.com/a/Nxpbj

In this second screen im trying to make it so that it displays the items needed (usually 1, max 2) in order to create the potion. now, how would you guys recommend i do this?

my current code goes like this

Code:
//checks if its on the second screen
if global.nextscreen = true
{

//creates an arrow
arrow = instance_create(view_wview[0]/2 ,view_hview[0]/2 - 100,obj_downarrow)
//changes the depth so that it stays in front of the ui
arrow.depth = depth-2

/*b is the product of a for loop, that loops through all of the different potions in my 2d potion array. [b,123...]
the 1st value is the potion and the 2nd value is something to do with said potion eg name, ammo etc
in this case 6 is supposed to be the number of crafting materials needed*/
 if global.weaponArray[b,6] = 1
  {
  //the 1st box to create
   ingredientbox[0] = instance_create(view_wview[0]/2 ,view_hview[0]/2 - 200,obj_normalbox)
 //the ingredient to put in it, ,7 being that ingredient
   ingredient[0] = instance_create(view_wview[0]/2 ,view_hview[0]/2 - 200,global.weaponArray[b,7])
//set the box's depth to be above everything else
   ingredientbox[0].depth = depth-2
/*set the ingredients depth to be one above the box its being drawn in */
ingredient[0].depth = ingredientbox[0].depth - 1
  }
 
//if 2 ingredients are needed
 if global.weaponArray[b,6] = 2
 {
//create the 1st box
 ingredientbox[0] = instance_create(view_wview[0]/2 - 15,view_hview[0]/2 - 200,obj_spritebox)
// create the second box
ingredientbox[1] = instance_create(view_wview[0]/2 + 15,view_hview[0]/2 - 200,obj_spritebox)
//the 1st ingredient
ingredient[0] =  instance_create(view_wview[0]/2 - 15,view_hview[0]/2 - 200,global.weaponArray[b,7])
//the 2nd ingredient
 ingredient[1] =  instance_create(view_wview[0]/2 + 15,view_hview[0]/2 - 200,global.weaponArray[b,8])
 
// a for loop going through all boxes
 for(i = 0; i < array_length_1d(ingredientbox) ; i++)
 {
 sets their depth
  ingredientbox[i].depth = depth-2
 }
 }
 //from here on its just a mess of code i really havent got a good system for 2 ingredients
 product = instance_create(view_wview[0]/2 ,view_hview[0]/2,obj_productbox)
 with(product)
  {
   ingredientno = instance_number(global.weaponArray[other.b,7])
  }
 product.spritedraw =
object_get_sprite(global.weaponArray[b,2])
 product.depth = depth-2
}
so all in all what im asking is, how would you guys do it, are there any tutorials teaching something similar to my problem or at least how could i refine my code from what it is at the moment. Its a mess and i just need a better start or basis, sorry if it's all a bit confusing i would be glad to answer any questions you have about the code or what im trying to do.
Thanks
 
Top