-1

I'm creating a map that has some sort of RPG statistics, and I want them to be shown in a book for the player to see his personal stats.
Is it possible to do that?
And, if so, do the stats update automatically?

0

The syntax for objectives in raw JSON is:

{"score":{"name":"<name>","objective":"<objective>","value":"[value]"}

From the wiki:

score: A player's score in an objective. […]
   name: The name of the player whose score should be displayed. […]
   objective: The internal name of the objective to display the player's score in.
   value: Optional. If present, this value is used regardless of what the score would have been.

The following command will give a book titled "SomeTitle" by "SomeAuthor" to the nearest player with a single page containing the nearest player's score for someObjective:

give @p written_book{pages:["[\"\",{\"score\":{\"name\":\"@p\",\"objective\":\"someObjective\"}}]"],title:SomeTitle,author:SomeAuthor}

However, this will not automatically update if the score changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.