so i have a shop scene were when the player buys something the shopkeep turns around and gets it. The item is exchanged for gold then the shopkeep walks over to a chest opens it, puts the gold in, then closes it
only the scene plays when the player doesnt buy something. How do i prevent this?
This is not default behavior so you're probably using a script or event, so we need to know which script or whatever other method you are using to do this behavior so that we can find the best way to tackle the problem
If you make it so that you can only BUY from the shop and not sell, then you could always store the amount of gold the player has in a variable before the shop scene, and then do a conditional branch after the shop scene to check if the amount of gold changed.
If you can buy AND sell from the shop...then...*shrug*
it is an event
and how do i store the gold into a variable?
I'm not sure if this could work, but why don't you make 2 variables one called amount of money player has before and one that's called amount of money player has after.
before you initiate the shop menu with the shop dude make the game change the 1st variable using the game data > other > Gold. Then have it so when your done buying stuff make the game change the 2nd variable using the game data > other > Gold. Then make a conditional branch check if the 1st variable is higher than the 2nd variable which means that you had bought something worth money and if it is true, put in the scene with the money box. If you do it this way, the scene shouldn't play out when the player has sold an item or did nothing at all, since in those outcomes there would be no reason for putting money in a box. Plus you can probably put all of this into a common event to make it less of a pain to put in every store. And if you want, you can make the game check if the 1st variable is LOWER than the 2nd variable, meaning the player has sold an item and make a different scene play out where the shop dude gets money OUT of the box, but it depends on your style.
thank you all for awnsering! yall were a big help now ya hear! lol
This would not work if you sell AND buy and you end up with the same amount of gold. Let's say a potion costs 10 gold and you have one in inventory, and you have 50 gold. Your variable will have 50. In the shop, you buy a potion for 10 gold (bringing your gold to 40), and then you sell both the potions you have for 5 gold each (I think the default selling price is half the buying price). You end up with no potions, but you still have 50 gold after the shop closes and you HAVE bought something.
It may not be quite as silly a scenario as that - a player is not likely to buy something and then sell it back again. But they might buy a potion for 10 gold and sell 5 flowers for 2 gold each. They still have the same amount of gold after the shop closes as they had beforehand.
The only way to determine for sure if they bought something, is to alter the shop script and make it turn on a switch when something is bought. Then you test the value of that switch in your event.
I had already set the shop to buy only because of a plot point. So i guess ill just have to do that for every shop in the future
or i could put a sell option in a choice in the event