Welcome Forums Get help How do I make shops? Reply To: How do I make shops?

#21586
Comprehensible
Moderator

Hey, that’s chill! They can be a bit tricky.

So let’s say you have a shop for armor. The shopkeeper asks the player if they want to buy armor for five gold, and the player responds “yes” or “no.” If they say yes, it checks if the player has enough gold or not. If you want to ramp it up a notch, give the player a token at the end of the interaction so they can’t buy the same armor twice. Here’s how that screenplay would play out:

if hero lacks token “bought armor”
(four spaces) NPC gives choices for “So kid, you wanna buy some armor? Only five gold!”
(eight spaces) in case “Sure!
(twelve spaces) if hero number of “gold” >= 5
(sixteen spaces) NPC says “Alright! Here’s the armor, you can change in the back.”
(sixteen spaces) hero max health increases with 25
(sixteen spaces) hero receives token “bought armor”
(twelve spaces) else
(sixteen spaces) NPC says “Not enough gold, kid. Come back later.”
(eight spaces) in case “No thanks.”
(twelve spaces) NPC says “Alright, now go on yer way.”
else
(four spaces) NPC says “I’m all outta stock. Now scram!”

NOTE: See the indentations I’ve set up? As you probably know, each one is extremely important. It won’t work without them. Also, make sure to establish that gold counter earlier in the game to give your players some loot. Happy coding, and best of luck on your game!