Just as the question says, I need to know how to do this.
Example:
Frank has 10 apples
The rotten apple variable is set at 5 and because of this, it minuses 5 apples from frank's inventory.
That won't work since this variable can change based on the player's earlier choices in my game.
I guess I should of said that to begin with. >.<
what do you mean, the variable could change?
I don't see the problem. When you use Change Items and use a variable rather than a number, it will reduce that item by whatever is in that variable at the time. So if the player's decisions have put the number to 3, it will reduce it by 3. If the player's decisions put the number to 5, it will reduce it by 5.
If you are saying that sometimes it will be injured ponies, sometimes it will be injured pegasi and sometimes it will be injured unicorns, do a Change Items for all 3, and set the variable back to 0 afterwards. That means if the player makes a decision that affects the number of injured ponies, that number will be deducted, but the other two variables will still be 0, so even though you do a Change Items, because the variables are set to 0, it won't change the inventory.
You do a += and then a -= on the variable. That means the value of the variable BEFORE this event influences it, as well as the two variables you're using in the calculation there. If you end up with a -ve number as a result of those three values, when you do a Change Items to reduce your inventory, it'll actually add to it because you're reducing it by a negative amount (which is the same as adding to it). What you need to do is F9 (I think - debug) to see what's in each of those three variables before running the event above, and then again after the event to see what variable 107 contains. Maybe things are happening that you're not aware of (like the + and - being done on the previous value, instead of setting it to 0 first). Or maybe you need to do a test afterwards to say if it's < 0, set it to 0.
If you are talking about something else, I'm sorry, but I'm just not getting it, and it means you have something in your head that you understand perfectly, but you're not quite getting the whole story across.
More accurately, I was a blind idiot... :headshake:
I got my solution from the first post but didn't even realize they had the variable selected in the first image and disregarded it without taking a second glance.
It wasn't until I read this post that I went, "What a second..." double checked the first post image and slammed my head so hard on my keyboard for being an idiot that I popped a few keys out.
So sorry for over-complicating things.>.<
lol - I did wonder what you could be looking for, if not the ability to use a variable to dictate how many to remove.
In the end, you got what you needed, which is the important thing. Doesn't matter that we got there in a round-about way 🙂