Yep! Asking about my game again haha. Anyways. There's a part in the game when you're in the battle system, that you can use an item if you'd like (Potions), I have the battle function calling another function, where it does all the work to use an item. The whole code works, but I'm having a slight problem with one thing. It's nothing big, because I can work around it, but if anyone can help me fix it, it'd be even better. So!
What I have the function doing is, it checks to see if the user has any items. If they do, it displays them all, and how many of each item they have.
Ex.
"1. Weak Potion 1"
"1." Is the item number, "Weak Potion" is obviously the name, and "1" is the amount the user currently has.
The function then asks which item the user would like to use, and if they have more than one, how many would they like to use. It runs through that, heals the character, subtracts the amount used and (heres where I'm running into the problem) I have the function checking if the user used all of the item, and if they did, it clears that part of the array.
1 2 3 4 5 6
|
/*if(inventory[itmuse-1].invamt == 0)
{
inventory[itmuse-1].miscitems = "";
inventory[itmuse-1].invno = "";
inventory[itmuse-1].invamt = NULL;
}*/
|
That's what I have written, and it's commented out because it breaks my program at this moment. Anyway, after it clears that part, it asks the user if they'd like to use another item. If they say yes, and they used all of the item they had, somehow it's getting rid of all of the users items, because the program displays the message that should only appear when they don't have any items.
Sorry if I'm being unclear, I can post more code if you need it, but let me know what you need to see. The whole programs almost 5000 lines of code so far, so I can't post that on here haha.
Thanks!