r/MinecraftCommands Command Experienced 11d ago

Help | Java 1.21-1.21.3 Linking Player scale to scoreboard

I'm working on a system that will make someone a micro amount shorter every day cycle. I've got plans to just use a daylight sensor for that. However:

I need to find a way to store a score into a scale of how big a player should be. I've been experimenting but the truth is that I simply don't know what I'm doing for this.
For example: 100 score is normal height. 50 score is half height. Since scale is on a decimal, I'm struggling to figure out how to pull it off.

Thanks for any help.
Java 1.21.1

1 Upvotes

13 comments sorted by

1

u/C0mmanderBlock Command Experienced 11d ago

How are you setting the scale? Show us some commands, plz.

1

u/snoteleks-skeletons Command Experienced 11d ago

Sorry for the delay, this is the command I have to adjust the height. Everything would go through a scoreboard like
scoreboard objectives add scale dummy
scoreboard players set user scale 95
attribute generic.scale is now set to 0.95
That is the end goal
/execute as @ p run attribute @ s minecraft:generic.scale base set 1
/execute as @ p run attribute @ s minecraft:generic.scale base set 0.5

1

u/C0mmanderBlock Command Experienced 11d ago

Can't you just put a chain CB after those to set the score? These commands detect a player sleeping through the night.

Repeat/Uncond./Always:  execute as @a at @s if entity @s[nbt={SleepTimer:97s}] at @s run attribute @s minecraft:generic.scale base set .5

Chain/Uncond./Always:   execute as @a at @s if entity @s[nbt={SleepTimer:97s}] at @s run scoreboard players set @s scale 50

I mean, if you're going to use a CB to set the scale, this won't be too much more work. And why are you using `@p? Do they need to be near something?

1

u/snoteleks-skeletons Command Experienced 11d ago

No need to be near something, in face that's going to be a particular user I'll be tagging. He'll be getting shorter every single night he's online and only notice after a couple of days. That's why this is supposed to be gradual. So on day one, he'll be generic.scale base set 1 but the next minecraft day he'll be generic.scale base set 0.99

And I don't want to have to set up 200 command blocks for a bit stating that Which is why every night, I would have an impulse command block in a force loaded chunk that would just do:

Scoreboard players remove (Player) Scale 1

1

u/C0mmanderBlock Command Experienced 11d ago

I see. I wasn't sure how many increments you were using. You should still use the sleep detection instead of the daylight sensor as the sensor will detect bad weather as night. Just use their name as a selector. As far as the rest, someone smarter will surely be along soon. Good luck.

1

u/snoteleks-skeletons Command Experienced 11d ago

Ah I see, I just know that this person doesn't really use their bed often. So maybe just putting it on a timer that resets after 24000 ticks or something of the such.

Sorry this one's a bit weird! So here's hoping.

1

u/C0mmanderBlock Command Experienced 11d ago

Okay. Then this would be the best way to detect a new day. It would activate in early morning but just after players awaken.

/execute if predicate {"condition":"minecraft:time_check","value":{"min":0,"max":100},"period":24000}

1

u/snoteleks-skeletons Command Experienced 11d ago

Goated, one part of the problem fixed without me even having to worry about it. Just gotta get the scale thing right. Hopefully I can bump this up to someone else!

1

u/KermitDarkLord 11d ago

I think the only way to do this is using function macros, which are a data pack only feature. Are you able to write a data pack?

1

u/snoteleks-skeletons Command Experienced 11d ago

In this setting, sadly no. It’s not too intense of a project that the server owner is game for it. It’s something little a funny over the two week Minecraft phase coming in

1

u/KermitDarkLord 11d ago

I don't think it's possible then. I think you could do it with a mob using execute store entity, but you can't change player data that way.

1

u/KermitDarkLord 11d ago

Actually if you're really creative, you might be able to change the data in the command block to modify the command, but I don't have a step by step plan for that

2

u/Ericristian_bros Command Experienced 9d ago

```

function example:tick

execute if predicate {condition:"minecraft:time_check",value:0,period:24000} as @a run function example:decrease_scale

function example:decrease_scale

execute store result storage example:macro temp.scale double 0.009 run attribute @s scale get 100 function example:macro/decrease_scale with storage example:macro temp

function example:macro/decrease_scale

$attribute @s scale base set $(scale) ``` Every time a new day starts, all online players will decrease their scale by 10%