How to Create Custom NPC Shops – Tutorial Series #004

Commands:
Step 1: Add Scoreboard!
1) /scoreboard objectives add Coins dummy Coins
2) /scoreboard objectives setdisplay sidebar Coins

Step 2: NPC Buy Shop!
1) /execute @p[x=52,y=4,z=1,r=8,c=1,scores={Coins=0..99}] ~ ~ ~ tellraw @s {"rawtext":[{"text":"§cInsufficient Coins!"}]}
2) /execute @p[x=52,y=4,z=1,r=8,c=1,scores={Coins=0..99}] ~ ~ ~ playsound mob.creeper.say @s

1) /execute @p[x=52,y=4,z=1,r=8,c=1,scores={Coins=100..}] ~ ~ ~ tag @s add Buy
2) /execute @a[tag=Buy] ~ ~ ~ scoreboard players remove @s Coins 100
3) /execute @a[tag=Buy] ~ ~ ~ give @s diamond 1
4) /execute @a[tag=Buy] ~ ~ ~ tellraw @s {"rawtext":[{"text":"§ax1 §lDiamond§r§a Received!"}]}
5) /execute @a[tag=Buy] ~ ~ ~ playsound random.levelup @s
6) /execute @a[tag=Buy] ~ ~ ~ tag @s remove Buy NPC Sell Shop!

Step 3: NPC Sell Shop!
1) /execute @a[tag=Sell] ~ ~ ~ tag @s remove Sell
2) /execute @p[x=52,y=4,z=1,r=8,c=1] ~ ~ ~ tellraw @s {"rawtext":[{"text":"§cYou have no Obsidian to Sell OR you sold too little!"}]}
3) /execute @p[x=52,y=4,z=1,r=8,c=1] ~ ~ ~ playsound mob.creeper.say @s

1) /execute @p[x=56,y=4,z=1,r=8,c=1] ~ ~ ~ tag @s add Sell
2) /execute @a[tag=Sell] ~ ~ ~ clear @s obsidian 0 1 (do x4 times)
3) /execute @a[tag=Sell] ~ ~ ~ scoreboard players add @s Coins 8
4) /execute @a[tag=Sell] ~ ~ ~ tellraw @s {"rawtext":[{"text":"§g+4 Coins Received!"}]}
5) /execute @a[tag=Sell] ~ ~ ~ playsound random.levelup @a

Please Note: You’ll need to alter the commands so that the coordinates (e.g. x=,y=,z=) match the area that your NPCs are located in your own worlds.

✅MCPE Secret Emojis [Guide]

3 Comments

  1. Brian

    February 22, 2021 7:10

    Are these all in order? BTW Loving your content! Keep it up!

    • jesser101

      February 25, 2021 12:51

      The commands are in order, yes. 🙂

  2. 69CultLeader

    February 22, 2021 9:53

    Instructions unclear, accidentally sacrificed 12 people.

Write your comment Here