1

Vanilla system economy using command blocks (need help)

romowodajo's Avatar romowodajo5/1/18 10:46 am
1 emeralds 1.5k 2
5/7/2018 9:18 pm
spychicken123's Avatar spychicken123
Hey everyone,

I am working on a system whereby there are actual coins in the game.

I am using commandblock shops where you pay with coins or paper currency. This is done by giving out custom named and coloured firework stars

i use the command

/give @p minecraft:firework_charge 1 0 {display:{name:"£1"}}

to give 'coins' when selling something to the shops and

/clear @p minecraft:firework_charge 0 1 {display:{name:"£1"}}

to remove coins from the inventory when buying.


The thing i need help with is giving these firework stars a specific colour. For instance, i want the 1 pound coin to be green, and the 50 pence coin to be blue. how do i add these arguments to the commands?



Also, i would like to use a sort of 'if' 'then' argument. so that a single commandblock does the following things:
- Checks if there are enough items or coins in the players inventory to buy or sell what the command block takes or sells
- Removes the items or coins from the players inventory to pay for the item,
- gives the player the item he /she is buying. whether they are 'buying coins' or using the coins to buy something.

Is this at all possible?
Posted by romowodajo's Avatar
romowodajo
Level 36 : Artisan Architect
58

Create an account or sign in to comment.

2

spychicken123
05/07/2018 9:18 pm
Level 42 : Master Taco
spychicken123's Avatar
you can have a command block that has /clear @p minecraft:firework_charge 1(or how many it cost) and then another one that has the first one pointing at it with /give whatever you want. the second one has to be an always active and condition and chain
hope this helps!
1
A5rocks
05/01/2018 7:00 pm
Level 1 : New Miner
A5rocks's Avatar
For your question about if/then statements, I'm pretty sure that is possible with functions.

Also, about money, you could use a scoreboard to store the values. In case you want to take out some coins, you could easily make a function that removes a certain amount of coins, and puts it in the form of firework charges in somebody's inventory.

If you really want to stick with your idea of economy being purely in inventories, you could name the coins. I'm pretty sure that items with different names don't stack. Also, you should be able change the color.

Also, on buying items, you could make specialized functions. Also, I think you should use signs instead of command blocks to do all this if it is based on functions.

If you're wondering what functions are, that are a new feature in 1.12. At least, I'm pretty sure that's right. Take everything I said with a grain of salt. :D
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome