So basically I made two scoreboards (For example, scoreboard "A" and "B"). And "A" is a dummy with a score of 10. I want to know how to make it so that "B" is 50% of "A" ("B would have to be 5) Is there a command that divides "A" with 2 and applies that answer to "B"? Thanks in advance
Create an account or sign in to comment.
4
1
Well there is a way and it isn't to complicated at all, but you need to set up a few other scoreboard objectives.
We know : p% = W/(G*100)
Beacuse we are able to perfom all basic calculatios with scoreboard objectives, we can fairly easylie recreate this formula.
First we need to create a few scores.
You already have A as basic value and B should be your percentage value.
You will also need ad 'value', with your value e.g.
A = 100, B = 50 => value = 50.
You still need a score for '100' and two more scores to maipulate their values in order to make the calculation, since you dont want to change 'A', 'B', 'value' or '100'
Now for the interesting part:
Save your value in 'holdValue':
This is the important part, because it's minecraft you need to multiply your value by 100:
This is now the actual calcuation p=(W*100)/G for W*100 = holdValue
and set B to 'holdValue' this will now show the percentage
B will now be the percentage of 'value' from A.
Edit:Title is irritating. Answered title through.
Maybe it can help someone else.
We know : p% = W/(G*100)
Beacuse we are able to perfom all basic calculatios with scoreboard objectives, we can fairly easylie recreate this formula.
First we need to create a few scores.
You already have A as basic value and B should be your percentage value.
You will also need ad 'value', with your value e.g.
A = 100, B = 50 => value = 50.
You still need a score for '100' and two more scores to maipulate their values in order to make the calculation, since you dont want to change 'A', 'B', 'value' or '100'
/scoreboard objectives add 100 dummy
/scoreboard players set @a 100 100
/scoreboard objectives add holdValue dummy
/scoreboard objectives add value dummy
Now for the interesting part:
Save your value in 'holdValue':
/scoreboard players operation @a holdValue = @a Value
This is the important part, because it's minecraft you need to multiply your value by 100:
/scoreboard players operation @a holdValue *= @a 100
This is now the actual calcuation p=(W*100)/G for W*100 = holdValue
/scoreboard players operation @a holdValue /= @a A
and set B to 'holdValue' this will now show the percentage
/scoreboard players operation @a B = @a holdValue
B will now be the percentage of 'value' from A.
Edit:Title is irritating. Answered title through.
Maybe it can help someone else.
1
Thank you so much for this!
1
You can do scoreboard math.
First you will have to make a new dummy objective. I will be calling it Two. You must set the score of this objective to 2 (simply set the score of Dummy to 2).
Now you will need to run 2 commands in sequence to get your desired result.
Since Minecraft's scoreboard system doesn't support decimals, the system will either round up or round down (forgot which one it was) when dividing an odd number.
First you will have to make a new dummy objective. I will be calling it Two. You must set the score of this objective to 2 (simply set the score of Dummy to 2).
Now you will need to run 2 commands in sequence to get your desired result.
/scoreboard players operation PLAYER ObjectiveB = SELECTOR Objective A
/scoreboard players operation PLAYER ObjectiveB /= Dummy Two
Since Minecraft's scoreboard system doesn't support decimals, the system will either round up or round down (forgot which one it was) when dividing an odd number.
1
If you have a wall and you put the amount of entities that scoreboard that scoreboard A
has and test for the amount of entities of one side that will be scoreboard B. Crazy but might work.
has and test for the amount of entities of one side that will be scoreboard B. Crazy but might work.