-
Notifications
You must be signed in to change notification settings - Fork 0
2 Set
The Set mood changes it's targets stats by setting them to a specific value, regardless of the stat's previous value. If it was executed through the chat, it will provide the executor with feedback showing the stat's old and new values.
statistics set [@p] [stat type] [stat] [? int | scoreboard objective] [? unit]
Add takes takes the standard three arguments: player target(s), stat type, stat.
Optionally, it can take an int or scoreboard objective, after which it can also take a unit.
A positive whole number.
A scoreboard objective.
Unit is a string word argument which is associated with a conversion factor (eg, an inch is 2.54 cm).
For each of its targets, Set will set the requested stat's value to zero. When it finished it will return the number of targets times the new value of the stat. If it cannot find a player, a stat, or otherwise incurs an error, it returns -1.
The modified stat will be set tothe int instead of zero. Notable this means that the following two commands are functionally identical:
statistics set @p custom minecraft:jumped
statistics set @p custom minecraft:jumped 0
The command will read the scoreboard objective's value for each target and use that to variably set the requested stat to the target's score.
When given a string, it will check if that string can be parsed as a unit, if that unit make sense for the stat being modified. If no, it will return provide feedback about the error and return -1 early. If the unit can be parsed and is sensical, it will multiple the value of the preceding argument by the unit's conversion factor while modifying the stat and give unique feedback.
When finished, the return value will still be the product of the number of targets and the value the stats were set to.