barter #1631
euclidaeun
started this conversation in
Libraries and Code Samples
barter
#1631
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
barter is two person trading via items instead of currency.
Currency, buying and selling totally works, it is only when you want to make your game more exciting and random, then you add in bartering.
So our old code is buy verb
Notice how I call it verb now.
All of my games are non-parser games where players just click verb buttons and wins the game.
But after testing out many different code samples, when dealing with multiple objects, it is easier to code with parser command instead of verb buttons because you can inject multiple objects into the system directly.
If we do barter via the verb button way, not only do we have to code twice, the player have to click twice, making it awkward.
To create a command, right click "Commands" on your left side bar, and click "+ Command"
In pattern, enter:
buy #object1# with #object2#In Scope, we put world, because I hid the items inside the npcs' folders, if your game have items clearly visible in the room, you can just leave the Scope blank.
See how my coding is all left-aligned unlike the dragon's nest-like in our old buy verb?
This makes it easier to understand what is happening and also to diagnose issues as well.
Barter comes in 3 parts.
Question: But what about selling?
Answer: Selling is good and common in games, but it can let player skip past the 'guess the item's value' game.
Also in thematics, it is weird for every single NPCs to just have that much money and that much interest to buy whatever you are selling.
Hence, if you reach the last room, you can actually find a pawnshop, specifically built for players to sell items.
And to incentivize the players that barter instead of trading with currency, we make the pawnshop only buys at 50% items worth.
Question: So we can purchase as well?
Answer: We isolate the selling button to specific npcs, and it makes sense to do the same to buying buttons to merchant npcs.
Question: My player is getting infinite currency.
Answer: You need to set your quest npcs to give quest items for the first time only, otherwise they can barter back and glitch free gifts forever.
Question: I am making parser games, if the player sells the item, the game is permanently locked.
Answer 1: It is possible to barter back from the pawnshop.
Answer 2: You can delete the gold_value from the parser puzzle item's attribute tab, it makes it impossible to trade anymore with our further refined coding.
K05f barter.zip
Beta Was this translation helpful? Give feedback.
All reactions