Quote from: geork on Sat 28/07/2012 21:53:05
As in: in some of your functions you are checking what the players active inventory is, but in some of them you are not. It's probably best to check this in all combining objects functions.
Thanks, now I understand, I made them all into player.ActiveInventory == #
Quote from: geork on Sat 28/07/2012 21:53:05
Yes, absolutely, and this is where structs can come in handy. Instead of having 30 inventory items for a single chemical, have one, and attach the amount of the chemical onto a variable. So for example, instead of:Code: AGS player.InventoryQuantity[iItem] += 60; UpdateInventory();
have:Code: AGS player.AddInventory(iItem); chems[iItem.ID].quantity += 60; // Have the chems ID match the item ID, it makes everything super simple
You can always check whether the quantity becomes 0, in which case the player should lose that inventory item.
This helps in a way but doesn't really help how I needed because you are still using "player.AddInventory(iItem);" and the game can only have a total of 300 iItems. I'm talking about a way one could avoid several items for each different stage of a reaction such as iRobo (cough syrup), iSyr_Amm (syrup and ammonia), iSyr_Amm_Nap (syrup, ammonia, and naphtha), etc...
And for that code, how would that help? Wouldn't I have to call that for every step of the extraction since it discusses mixing 2 specific chems with each other to make a 3rd? And would I still have to use it twice so that you can use both items to start the reaction as in:
//USES iNH3 ON iRobo IF POSSIBLE
function iNH3_UseInv(){
if (player.ActiveInventory == iRobo){
AND
//USES iRobo ON iNH3 IF POSSIBLE
function iRobo_UseInv(){
if (player.ActiveInventory == iNH3) {