Fairy needs to trade gems for sword

Ok so i have been following the tutorials on the main RPGmaker website, and honestly i get most of it, but in the final tutorial it wants you to make a fairy, that will trade 2 elemental gems for a weapon item, and then once you've done that the price goes up for the next item. 


Honestly i just want to know how to get the fairy to check for the 2 stones in your inventory, take them, and then give you the sword (ok i know how to get her to give you the sword) 
I've moved this thread to MV Support. Please be sure to post your threads in the correct forum next time. Thank you.


Tech-Support is for getting the editors to run, not for development support


Please give a link to the tutorial you're talking about, because I never heard of that one.


That said, what you need is variables - I suggest you follow the link to the starting point in my signature and work through the variables guide linked there.
This is the tutorial, https://d289qh4hsbjjw7.cloudfront.net/rpgmaker-20130522223546811/files/RPGMakerVXAceTutorial9.pdf also i'm sorry about posting in the wrong place
Have you problems reading the flowcharts, or what exactly is your problem?


Simply showing you one of the solutions would not be the best way to proceed here imho, sorry - the best way is to determine where exactly your problem in understanding the tutorial was and solve that part, because otherwise you'll probably have more trouble later.
Have you problems reading the flowcharts, or what exactly is your problem?


Simply showing you one of the solutions would not be the best way to proceed here imho, sorry - the best way is to determine where exactly your problem in understanding the tutorial was and solve that part, because otherwise you'll probably have more trouble later.

i get the flowchart, they way i understand what i have to do is:


Fairy asks if you want to trade > yes or no, if no, end interaction, if yes, which items trade, select gems, then the game needs to check if the user has an gem in there inventory. I know how to get the event/game to check if an action as been done (looting a chest of talking to someone a number of times) but is it the same for it to check the inventory? It's just the checking for the item in the inventory part that i don't get. 
There is a "Conditional Branch" option which checks if you have a certain item in your inventory.  You can nest two of these together (one inside the other) if there are two different gems you are looking for.


There is also a "Control Variables" option which can set a variable to the number of a certain item that you currently possess.  So if Gems are a collectible and you need to check whether the player has 2 or more of them, you would want to set a variable equal to the number of gems, then use a Conditional Branch to see whether that variable is 2 or more.
There is a "Conditional Branch" option which checks if you have a certain item in your inventory.  You can nest two of these together (one inside the other) if there are two different gems you are looking for.


There is also a "Control Variables" option which can set a variable to the number of a certain item that you currently possess.  So if Gems are a collectible and you need to check whether the player has 2 or more of them, you would want to set a variable equal to the number of gems, then use a Conditional Branch to see whether that variable is 2 or more.

Ok so i am trying this, i'm putting 3 stones in my inventory to see both the positive and negative result. I can get it to take 2 stones and give me the sword, but when i try again it will give me another sword, i have 1 stone in my inventory at this point which it will take after giving me the 2nd sword. But the cost of the sword is 2 stones so i shouldn't be able to get it and arg! Here this is what i have (what it looks like in the event page) 

2016-09-13.png
@EvieEvangelion...


Just after you check for having enough Stones, you replenish with the line that follows (the Red one...). The next time the Event is triggered, the Stones have been reset to '2', so another Sword is given.


That Red line should be outside of the loop, in a separate Event, used only at the start to enable the first exchange. It should not be triggered again.


Does this help..?
@EvieEvangelion...


Just after you check for having enough Stones, you replenish with the line that follows (the Red one...). The next time the Event is triggered, the Stones have been reset to '2', so another Sword is given.


That Red line should be outside of the loop, in a separate Event, used only at the start to enable the first exchange. It should not be triggered again.


Does this help..?

Sadly no, it seems that it's not checking my inventory. As i tired it out with no stones in my inventory and it still gave me the sword.
Sadly no, it seems that it's not checking my inventory. As i tired it out with no stones in my inventory and it still gave me the sword.



There's some misunderstanding here, I believe. The Variable '0001 Check Lightning Stones does not check inventory, nor anything else. It simply stores a value, and your Red line stores a value of 2 in that Variable. When next the Condition tests, it finds a value of 2, each and every time. Nowhere in the contents of the Event is Inventory checked.


I'll do a 'quick and dirty' simulation and post here the results, to show how Inventory could be checked. Back in a moment or two...


Just for the test, I put 10 Potions in the Inventory at Map opening...

Spoiler
fma4yqP.png
(/spoiler]



This is how I check the Inventory for Potions...

Spoiler
Zrz1Yru.png



Here's the Event code where the Sword will be exchanged for Potions...

Spoiler
uv4NSuQ.png



Here is the first passage to the Exchange Chest

Spoiler
ZQyI9GF.png



... and here is the 6th passage, now that the 10 Potions (5 x 2...) have been taken...

Spoiler
5LxzpUt.png



Does that make sense to you..?.
Your event is completely wrong.  The Variable control must come before the Check of that variable (otherwise you will get whatever result you set last time - such as when you set it to 2 inside the branch); additionally, you should be setting the variable to the number of stones the player actually has, not to an arbitrary number that they chose.


Here's a better way to event it:


Message: What elemental stones have you brought me?


Show Choices: 2 Lightning Stones, 3 Fire Stones, 4 Ice Stones, Never Mind


When "2 Lightning Stones"


  Control Variables: Var #1 "Stone Check" = Number of Lightning Stones in Inventory (note: this is done through the "Game Data" option in Control Variables)


  Conditional Branch: IF Var #1 "Stone Check" is GREATER THAN OR EQUAL TO 2


    Change Items: Lightning Stone -2


    Change Weapons: Lightning Weapon +1


    Message: Thanks for the Stones!  Here is your weapon.


  Else


    Message: Don't try to fool me!  You don't have enough Stones!


  End Branch


When "3 Fire Stones"


Control Variables: Var #1 "Stone Check" = Number of Fire Stones in Inventory


  Conditional Branch: IF Var #1 "Stone Check" is GREATER THAN OR EQUAL TO 3


    Change Items: Fire Stone -3


    Change Weapons: Fire Weapon +1


    Message: Thanks for the Stones!  Here is your weapon.


  Else


    Message: Don't try to fool me!  You don't have enough Stones!


  End Branch


When "4 Ice Stones"


  (use the same pattern shown above)


When "Never Mind"


  Message: Okay, come back when you have more Stones


End Choices

THANK YOU!! You are an angel, looking at this i found my hiccup, it was that little bit about 'game data' that you put in bold. LIke i get how the other stuff was out of order, but it was that game data bit that i couldn't find before or didn't see. THANK YOU! 
You're welcome. 🙂
Yes, and not only was the change variable after the check, and the number being set to 2 instead of the number of the items in the inventory, the check was set to <= 2 instead of >=...

Original thread: https://forums.rpgmakerweb.com/threads/fairy-needs-to-trade-gems-for-sword.68268/