0

[1.10.2]

So I am making an adventure map and I made a money system that is a little bit glitchy. Basically, it works like this:

So first I would like to point out my scoreboard objectives:

  • money > Dummy

  • killedBasic > stat.killEntity.Zombie

And I have one repeating command block (Always Active) with the following command:

/testfor @a[score_killedBasic_min=1]

And I have two comparators wired out of the repeating command block as so:

Full command block setup

The "Resets killedBasic" command block has this command:

/scoreboard players set @a killedBasic 0 

And the "Adds 10 to money" command block has the following command:

/scoreboard players add @a money 10

The system itself works fine but I noticed that if say there were two players on the adventure map then if one killed a Zombie they would both get 10 "money" which looked messy.

So my question is (yeah tl;dr I know) is it possible to maybe a scoreboard operate on its own without a player name beside the score? And also is it possible to use renamed entity's such as rabbits to add the score (money) to the scoreboard?

3
  • Just to be clear: the "money" objective is used by all players as a shared pool of money? Each player is not meant to have their own amount of money?
    – Skylinerw
    Feb 20, 2017 at 1:40
  • Well at first it was the latter but now I think sharing a pool gives a more adventurous spirit to it. @Skylinerw < if that's unclear THE POOL THE POOL!!!
    – Reflexive
    Feb 20, 2017 at 1:42
  • If THE POOL is not possible then I will go with each having their own amount as long as it stays under 60 command blocks ;)
    – Reflexive
    Feb 20, 2017 at 1:44

1 Answer 1

4

You don't have to use a selector for a playerscore. You can use any name you want, even if it's not a valid player's name. For instance, the following sets the score of a fake player named "pool":

/scoreboard players add pool money 10

Do keep in mind that if a player named "pool" joins, they will essentially "own" that score. You'd want to be careful when manipulating the scores in case their existence causes a conflict (such as running /scoreboard players add @a money 10). If you prepend the name with "#" (such as "#pool"), the name will not appear on the sidebar and also prevents naming conflicts because real players cannot have the "#" character in their name.


As for your mechanism, you'll want to use Chain command blocks, which directly specifies activation order, instead of comparators, which does not have a guaranteed activation order and causes delay. The delay can cause the mechanism to lock up if a player kills a zombie before the comparator turns off.

/testfor is not particularly useful, especially in multiplayer situations. You can replace it with a scoreboard operation that would account for multiple kills in the same tick, rather than assuming there is only 1 kill amongst all players.

Image example of the mechanism:

Repeating Block (1) > Chain Block (2)

Commands:

  1. Increment the fake "#pool" player's score equal to all playerscores for the "killedBasic" objective (or change "#pool" to a name you would prefer, removing "#" so that it appears on the sidebar).

    /scoreboard players operation #pool money += @a[score_killedBasic_min=1] killedBasic
    
  2. Set playerscores for "killedBasic" to 0 like usual.

    /scoreboard players set @a[score_killedBasic_min=1] killedBasic 0
    

This is a multiplayer-friendly and multi-kill friendly solution that will not lock up if multiple kills are made in subsequent ticks.

4
  • O_O........ Wow
    – Reflexive
    Feb 20, 2017 at 2:02
  • What does operation do? I obviously haven't learnt enough about scoreboard objectives. They seem to have quite a big influence over stuff nowadays ;)
    – Reflexive
    Feb 20, 2017 at 2:05
  • @ExperimentalRocket The wiki has a lengthy description of scoreboard operations here: minecraft.gamepedia.com/Scoreboard#Players_commands
    – Skylinerw
    Feb 20, 2017 at 2:11
  • Thanks. Been rooting around on YouTube for something along these lines . ;)
    – Reflexive
    Feb 20, 2017 at 2:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .