Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(3 edits) (+1)

You can deal with that in another way since you don't allow selling items. Have an autorun event (you'll want a blank autorun event for this)

[local variable 1] = current gold

erase event.

Once you've done that, it will save the current gold and won't run until the next time the player enters.

Then, for the shopkeeper, do

[local variable 2] = current gold.

if [local variable 1] > 0, then if [local variable 2] <= [local variable 1],  then +1 cookie and [local variable 1] = 0

What this does is it checks if local variable 1 is 0. If it is 0, then either you came in with no gold (so shopping is impossible) or you already received a cookie. If your gold when talking to the shopkeeper is less than your gold when you entered, then add 1 cookie and set local variable to 0.

If you don't want the bargain bin to give gold, you can then for the bargain bins, you can do:

[local variable 2] = current gold.

Shop

[local variable 3] = current gold

[local 2] -= [local 3]

[local 1] -= [local 2]

What this will do is that it will make it so that it first stores your gold when you are in the bargain bin. Then it will check your gold after shopping, remove the current gold from the previous gold check (so you are left with the difference), then remove that value from local 1, which is the gold you entered with since you don't want that different counting for the cookies.

This would encourage players to just keep leaving and returning to the shop though, which is why it would make more sense to just give them cookies as according to their purchase count or purchase value (say every X gold gives a cookie). So with purchase value if, for example, you want them to get 1 cookie per 20 gold spent, then for the shopkeeper, you would do 

[local variable 2] = current gold

[local variable 2] -= [local variable 1] 

(optional) [local 1] = [local 2] %=20

[local 2] /= 20

add item [cookies] += [local 2]

[local variable 1] = current gold or (if optional above is set, [local 1] += current gold

So you get the difference in gold, then divide it by 20, then add that to cookies. The optional path would allow them to save any extra spent value if they continue purchasing in that same trip.

There are other ways to do things. 

Also, if you have issues in the future, you could try rpgmakerweb or one of the development discords. For RPGMaker related, I'm in the GAB JAM (formerly the IGMC) discord server (it is somewhat inactive, but I do check when someone says something in a game talk channel). There are other discords for developers as well. There are plenty of people that are willing to give some quick advice.

Thanks a lot for the advice!