Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

How To Create A Command Block Shop That Uses XP As Money

shop experience xp exp command block command block mechanism redstone red_jay

  • Please log in to reply
62 replies to this topic

#1

Red_Jay
    Red_Jay

    Zombie Killer

  • Members
  • 151 posts
  • Minecraft: xShadowStrike

Posted 19 January 2013 - 10:06 PM

How To Create A Shop That Uses Experience As The Money

In Vanilla Minecraft!



This post will show you how to make awesome player shops for servers or adventure maps! The shop system  requires NO MODS and uses command blocks. The currency for the shop is the player's LEVEL of EXPERIENCE. Enjoy Posted Image


Each shop uses 2 command blocks and 2 redstone repeaters. Here's some pictures of what it looks like:


Posted Image

Posted Image

As you can see, they are very compact. So, lets say you want a shop that allows a player to buy a diamond sword for 5 levels of xp. Here's what you would put in the first command block.

First Command Block:
The command block that gives the item.

Posted Image

give - This is the command that gives items to players.

@p - This means the command will interact with the player CLOSEST to the command block. (@a means ALL players and @r picks a random player)

[lm=5] - When you add [lm=5] next to @p it creates a conditioner. lm stands for 'level minimum' so the command block will only give the closest player a diamond sword IF he/she has a minimum level of 5.

276 - This is the item ID for diamond sword. Change this to whatever you want the item to be.

1 - This is the amount of items that will be distributed to the player.

Entering give @p[lm=5] 276 1  in a command block means that, when the command block is powered, if the CLOSEST player to the command block has AT LEAST 5 levels of xp they will receive 1 diamond sword.

Second Command Block:
The command block that removes xp from the player.

Posted Image

xp - the command that can remove or add experience or experience levels to a player or players.

-5l - Putting a - means that you are going to REMOVE experience from the player, 5 is the amount, and adding an l to the end changes it to the LEVEL of experience.

@p - This means the command will interact with the player CLOSEST to the command block. (@a means ALL players and @r picks a random player)

[lm=5] - When you add [lm=5] next to @p it creates a conditioner. lm stands for 'level minimum' so the command block will only remove 5 exp levels from the closest player IF he/she has a minimum level of 5.

Entering xp -5l @p[lm=5] in a command block means that, when the command block is powered, 5 levels of exp will be REMOVED from the CLOSEST player IF they have AT LEAST 5 levels.

This shop concept is GREAT for adventure maps and could also be used on servers. If you want to see some examples of this shop being used, download one of my maps and the shops are incorporated in the maps.

Zombie Arena:
An arena mini-game

Zombie Arena 2:
The sequel to the famous Zombie Arena mini-game

The Crypt:
A thrilling adventure in a monster-infested graveyard full of dangerous traps and rich treasures

I hope this helps! If you have questions, ask in the comments and I will help you out Posted Image

Red_Jay
Posted Image
Check out my server!

Register or log in to remove.

#2

thegeekykid47

Posted 19 January 2013 - 10:13 PM

I love this idea and will deffinatly be using it on my server :D
Posted Image Yeah im a brony. got a problem with it?

#3

Red_Jay
    Red_Jay

    Zombie Killer

  • Members
  • 151 posts
  • Minecraft: xShadowStrike

Posted 19 January 2013 - 10:40 PM

View Postthegeekykid47, on 19 January 2013 - 10:13 PM, said:

I love this idea and will deffinatly be using it on my server Posted Image
Sounds cool, if you need help implementing items with damage values (like potions for example) I can tell you how.
Posted Image
Check out my server!

#4

omen267901
  • Location: nonaya beeswax. :3
  • Minecraft: craigmisner

Posted 19 January 2013 - 11:04 PM

Nice. I've been looking for how to make this for a while.
Posted Image

#5

Red_Jay
    Red_Jay

    Zombie Killer

  • Members
  • 151 posts
  • Minecraft: xShadowStrike

Posted 19 January 2013 - 11:10 PM

View Postomen267901, on 19 January 2013 - 11:04 PM, said:

Nice. I've been looking for how to make this for a while.
Glad I could help
Posted Image
Check out my server!

#6

PixelPineapple
  • Minecraft: Mar2001

Posted 20 January 2013 - 12:11 AM

Thanks! Now I can have a cool vanilla server with my friend!
One more block...
Damn. Where's my generator?

#7

Micky2506

Posted 20 January 2013 - 05:36 PM

Just a note, in some cases this will fail - the reason some shops teleport - if another player comes closer, i.e., it will take the XP from them, while giving the diamond sword to the other player.. To fix this you could just have a iron door with pressure plate style room for it.

#8

Red_Jay
    Red_Jay

    Zombie Killer

  • Members
  • 151 posts
  • Minecraft: xShadowStrike

Posted 20 January 2013 - 05:39 PM

View PostMicky2506, on 20 January 2013 - 05:36 PM, said:

Just a note, in some cases this will fail - the reason some shops teleport - if another player comes closer, i.e., it will take the XP from them, while giving the diamond sword to the other player.. To fix this you could just have a iron door with pressure plate style room for it.
Easy fix.
(The design on the right)
Posted Image

This fixes the issue because both command blocks are activated at the same time.

The only drawback of this is that it is not as compact as the original design.

Hope this helps.
Posted Image
Check out my server!

#9

endercreeper444
  • Location: Uruguay
  • Minecraft: martinesgenial4

Posted 27 March 2013 - 03:58 PM

it works on singleplayer client?

:)

and... so... Full SUpport!

#10

xXpunkbusterXx
  • Location: Calfornia
  • Minecraft: xXpunkbusterXx

Posted 27 March 2013 - 05:35 PM

Dude, thank you so much. I'm working on a minigame right now, Ghast Sniper, and this is exactly what i was looking for. I'll give you credit for help in the credits of the map. Cheers.

#11

Red_Jay
    Red_Jay

    Zombie Killer

  • Members
  • 151 posts
  • Minecraft: xShadowStrike

Posted 27 March 2013 - 07:54 PM

View PostxXpunkbusterXx, on 27 March 2013 - 05:35 PM, said:

Dude, thank you so much. I'm working on a minigame right now, Ghast Sniper, and this is exactly what i was looking for. I'll give you credit for help in the credits of the map. Cheers.
Hey no problem man, I also know how to make objectives shops. If you need help with that let me know!
Posted Image
Check out my server!

#12

CheezBrick
  • Location: Eating cheese
  • Minecraft: BrickCheez

Posted 27 March 2013 - 08:49 PM

There's a serious issue with this. On a multiplayer server, if the player doesn't have the necessary XP, the nearest player who does will get the item and lose their XP. You can fix this by adding a short radius to the @p.

View PostSledger721, on 25 September 2011 - 06:54 PM, said:

Alright, but if you fail to plan for the epic, then you plan to epic fail :P

#13

kmmmurphy911
  • Minecraft: kmmmurphy911

Posted 27 March 2013 - 10:00 PM

Cool.  But could someone show me how to make them spend items?  Something like 1 diamond sword for 40 emeralds.
P.S. This was awesome so im book marking it! :)

#14

Red_Jay
    Red_Jay

    Zombie Killer

  • Members
  • 151 posts
  • Minecraft: xShadowStrike

Posted 27 March 2013 - 10:21 PM

View Postkmmmurphy911, on 27 March 2013 - 10:00 PM, said:

Cool.  But could someone show me how to make them spend items?  Something like 1 diamond sword for 40 emeralds.
P.S. This was awesome so im book marking it! Posted Image
To do this you would have to make a hopper shop which is very complex. Or, if you have mcedit, just make a custom villager and customize that trade. You can even make the villager invincible so players can't kill him.
Posted Image
Check out my server!

#15

kmmmurphy911
  • Minecraft: kmmmurphy911

Posted 27 March 2013 - 10:49 PM

View PostCheezBrick, on 27 March 2013 - 08:49 PM, said:

There's a serious issue with this. On a multiplayer server, if the player doesn't have the necessary XP, the nearest player who does will get the item and lose their XP. You can fix this by adding a short radius to the @p.
How do you do this and what does it mean.  Could you post a screen shot?

#16

Alden589
  • Minecraft: londonn

Posted 27 March 2013 - 11:21 PM

I have some of these and I have a few screenshots to show you. (lets hope I can get the pictures working)
Posted Image
A more compact version of your design.
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Same design, but I changed some text. First, I used a radius (r=15) so that it will not look for any players that meet the qualification. Next I used a different money. I made a Points objective using the new scoreboard system (you must type "/scoreboard objectives add Points totalKillCount (replace totalKillCount with list to see the other kinds of objectives) Points" and then it will count every kill you get) and used that as my score, then removed points from it.
Posted Image
Posted Image
Posted Image
Posted Image
This is a way to sell items using command blocks. The comparator will only send a signal if the first command run. The repeaters on the side resets the comparator to the off state. Change some things and play around with this to understand it better if you don't understand what I did.

Note: I didn't use any specifiers on the sell shop, but you can use them and you can make the diamond sword give you points on a scoreboard objective also (you just need to change the second command block to say "/scoreboard players add @p Points 5" (or however many points you want)). Also sorry if the pictures don't work.

Edit: doesn't look like they worked Posted Image could you tell me what I did wrong so I can fix them?
Edit: Thanks for your help, and I hope someone learns something from my screenshots.
Posted Image

#17

Red_Jay
    Red_Jay

    Zombie Killer

  • Members
  • 151 posts
  • Minecraft: xShadowStrike

Posted 27 March 2013 - 11:33 PM

View PostAlden589, on 27 March 2013 - 11:21 PM, said:

I have some of these and I have a few screenshots to show you. (lets hope I can get the pictures working)
2013-03-27_18.29.15.png
A more compact version of webkit-fake-url://0EA630E4-41DE-4CAD-8A2B-4EC8CD822A33/CyTR2X4.png
2013-03-27_18.38.05.png
2013-03-27_18.42.06.png

2013-03-27_18.42.10.png
2013-03-27_18.42.12.png
2013-03-27_18.42.20.png
Same design, but I changed some text. First, I used a radius (r=15) so that it will not look for any players that meet the qualification. Next I used a different money. I made a Points objective using the new scoreboard system (you must type "/scoreboard objectives add Points totalKillCount (replace totalKillCount with list to see the other kinds of objectives) Points" and then it will count every kill you get) and used that as my score, then removed points from it.
2013-03-27_18.50.39.png

2013-03-27_18.50.41.png
2013-03-27_18.50.44.png
2013-03-27_18.51.52.png
This is a way to sell items using command blocks. The comparator will only send a signal if the first command run. The repeaters on the side resets the comparator to the off state. Change some things and play around with this to understand it better if you don't understand what I did.

Note: I didn't use any specifiers on the sell shop, but you can use them and you can make the diamond sword give you points on a scoreboard objective also (you just need to change the second command block to say "/scoreboard players add @p Points 5" (or however many points you want)). Also sorry if the pictures don't work.

Edit: doesn't look like they worked Posted Image could you tell me what I did wrong so I can fix them?
Yes upload your images at imgur.com. Then copy the BBC code and they will work. And yes you can make a shop system uses scoreboard objectives. I used that in my Zombie Arena 3 mini game.
Posted Image
Check out my server!

#18

kmmmurphy911
  • Minecraft: kmmmurphy911

Posted 28 March 2013 - 12:08 AM

Very useful!
But what do these commands do: clear
                                                     scoreboard players remove
Just want to know :)

#19

kmmmurphy911
  • Minecraft: kmmmurphy911

Posted 28 March 2013 - 12:36 AM

Never mind, this really helped dude.

#20

kmmmurphy911
  • Minecraft: kmmmurphy911

Posted 28 March 2013 - 12:47 AM

file:///C:/Users/Murphy/Desktop/2013-03-27_20.45.37.png
It didn't work.
I fixed it though! Works great!