1
How to make "Omni-Point" system?
I plan to implement a feature on my server where certain items are worth a certain number of points, and players can "trade to the server" for the points, which can be spent at a vending machine bank for different things. I'm talking, like, a bow with the Sharpness enchantment on it, an Unbreakable fishing rod, Notch apples, powerful potions, and various other things that aren't normally obtainable. What all would I have to do to make this happen? I know the scoreboard system will probably be involved.
Create an account or sign in to comment.
1
1
You would need to tag everyone with every sellable item... (create a clock with the commands:)
/scoreboard players tag @a add stone {Inventory:[{id:"minecraft:stone"}]}
--/scoreboard players tag @a add itemA {Inventory:[{id:"minecraft:itemA"}]}
or
/scoreboard players tag @a add stone {Inventory:[{id:"minecraft:stone",Count:#b}]}
--/scoreboard players tag @a add itemA {Inventory:[{id:"minecraft:itemA",Count:#b}]}
ALSO:
/scoreboard players tag @a remove stone
--/scoreboard players tag @a remove itemA
Use the first for trades with 1 item, you HAVE to use the second for trades with more items. The disadvantage is that the player must have exactly that amount in one slot. So the trade 2 cobble > 1 stone won't work for a player with a stack of cobble.
Then hook up buttons to command blocks with the commands:
/give @a[tag=stone,r=#] diamond_block 1
-- /give @a[tag=itemA,r=#] itemB amount data
/clear @a[tag=stone,r=#] stone 0 1
--/clear @a[tag=itemA,r=#] itemA data maxAmount
Keep in mind that everyone in the range "r" will trade their items once the button is pressed. This might be unwanted. You can change @a to @p for the nearest person, also this can lead to unwanted results.
Also, here I created the trade 1 stone > 1 diamond block.
If a currency is used, each item needs two trades. 1 stone > currency and currency > 1 diamond block.
It's wayyyyy easier to simply create a custom villager though, if you figure out how to do that. You won't have problems with timings and targetting players who don't want to trade.
/scoreboard players tag @a add stone {Inventory:[{id:"minecraft:stone"}]}
--/scoreboard players tag @a add itemA {Inventory:[{id:"minecraft:itemA"}]}
or
/scoreboard players tag @a add stone {Inventory:[{id:"minecraft:stone",Count:#b}]}
--/scoreboard players tag @a add itemA {Inventory:[{id:"minecraft:itemA",Count:#b}]}
ALSO:
/scoreboard players tag @a remove stone
--/scoreboard players tag @a remove itemA
Use the first for trades with 1 item, you HAVE to use the second for trades with more items. The disadvantage is that the player must have exactly that amount in one slot. So the trade 2 cobble > 1 stone won't work for a player with a stack of cobble.
Then hook up buttons to command blocks with the commands:
/give @a[tag=stone,r=#] diamond_block 1
-- /give @a[tag=itemA,r=#] itemB amount data
/clear @a[tag=stone,r=#] stone 0 1
--/clear @a[tag=itemA,r=#] itemA data maxAmount
Keep in mind that everyone in the range "r" will trade their items once the button is pressed. This might be unwanted. You can change @a to @p for the nearest person, also this can lead to unwanted results.
Also, here I created the trade 1 stone > 1 diamond block.
If a currency is used, each item needs two trades. 1 stone > currency and currency > 1 diamond block.
It's wayyyyy easier to simply create a custom villager though, if you figure out how to do that. You won't have problems with timings and targetting players who don't want to trade.