2

How do I make a command that basically sets var1 = var2 * var3?

Is there a way to do this in minecraft 1.8.8?

1

1 Answer 1

4

What you are looking for can be done via the aptly named scoreboard players operation set of commands.

scoreboard players operation <targetName> <targetObjective> <operation> <selector> <objective>

This sets <targetName>'s score in <targetObjective> based on <selector>'s score in <objective>, according to the <operation>.

The latter can be any of += (add), -= (subtract), *= (multiply), /= (divide), %= (modulo), = (set), < (min), > (max) or >< (swap).

In order to set var1 = var2 * var3 for "target", you can run two commands:

scoreboard players operation <target> var1 = <target> var2
scoreboard players operation <target> var1 *= <target> var3
3
  • I'm on mobile atm, might expand this a little later on.
    – MrLemon
    Commented Sep 30, 2015 at 12:54
  • I'm using this for two fake players so do I just replace the names?
    – Wii Craft
    Commented Sep 30, 2015 at 14:03
  • @WiiCraft I think var1 requires an actual entity, but selector should work fine with fake players.
    – MrLemon
    Commented Sep 30, 2015 at 14:17

You must log in to answer this question.

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