#Score compared to score help
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1733683729:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Store the score you're checking against to two fake players, increase one of them by 5 and reduce the other by 5, then do two separate if score checks against those fake players in one command, to see if the target player's score is less than the first, and also greater than the second
I dont think that will work for my situation as I need it to work on a per player basis
this method works on a per player basis too.
how so?
Here is some more info if it helps. I'm trying to have it so a score set per player via nbt data is within a +5 and -5 range of another score set per player via another nbt data value
what im trying to do is have it so when a player gets within 5 blocks of their lastdeathlocation it will remove a recovery compass from their inventory
Would this still work for such a thing?
this makes it even easier and in this case I think using predicates makes it even more easier.
what is a predicate and how do I use it?
I havent looked into them at all yet
Here is how I have it working for the coord saving atm
execute as @a store result score @s liveY run data get entity @s Pos[1]
execute as @a store result score @s liveZ run data get entity @s Pos[2]
execute as @a[nbt={Dimension:"minecraft:overworld"}] run scoreboard players set @s dimlive 0
execute as @a[nbt={Dimension:"minecraft:the_nether"}] run scoreboard players set @s dimlive 1
execute as @a[nbt={Dimension:"minecraft:the_end"}] run scoreboard players set @s dimlive 2
execute as @a[nbt={DeathTime:1s}] store result score @s deathX run data get entity @s Pos[0]
execute as @a[nbt={DeathTime:1s}] store result score @s deathY run data get entity @s Pos[1]
execute as @a[nbt={DeathTime:1s}] store result score @s deathZ run data get entity @s Pos[2]
execute as @a[nbt={DeathTime:1s,Dimension:"minecraft:overworld"}] run scoreboard players set @s dim 0
execute as @a[nbt={DeathTime:1s,Dimension:"minecraft:the_nether"}] run scoreboard players set @s dim 1
execute as @a[nbt={DeathTime:1s,Dimension:"minecraft:the_end"}] run scoreboard players set @s dim 2```
The top is storing the players active location to scoreboards while the bottom is storing their location on death to scoreboards
What are those and how do I use them?
A predicate is a JSON file that you can check in commands to return either true or false. They have a variety of conditions. You can make one here:
https://misode.github.io/predicate/
I'm not certain the exact predicate type @vale sapphire has in mind, but there are a number of ways to detect a player's position as well as a score
Alright, thankyou.
My bad. I had in mind that you could use number provider for the position fields in the location_check predicate but you can only use constant values.
ah ok
You could still use a value check predicate to check both scores (the -5 and +5) against the position score of the player in one go. It has the benefit of looking a bit cleaner imo
how woud I go about doing that? The predicate stuff is quite confusing to me ngl
This is how the predicate for the X coordinate could look like:
{
"condition": "minecraft:value_check",
"value": {
"type": "minecraft:score",
"target": "this",
"score": "liveX"
},
"range": {
"min": {
"type": "minecraft:score",
"target": "this",
"score": "deathX.plus.five"
},
"max": {
"type": "minecraft:score",
"target": "this",
"score": "deathX.minus.five"
}
}
}
ok, so I essentially just do a predicate for each coord
This part specifies the value that should be checked.
the type tells it that we want to check a score value,
the target is the entity that we want the score from,
and score is the name of the objective
yes.
and the dimension one is simply just a compare scores
yes
if you want you can even put all 4 score checks in the same file
it might decrease readability though
would that be doing a list instead of an object?
a list or everything in an all_of condition
ok
hmm
so i am testing it with a repeat command block and its just constantly going off even if im out of range
@vale sapphire any ideas?
I fixed it from constantly going off. Not sure why but the world just needed to be reloaded
but now it just doesnt trigger when im within 5 blocks of the x coord
@opaque ocean Do you have any ideas?
Show your work
well I have the predicate file like he stated earlier in the predicates folder of the datapack and I tried to run the following command in a command block repeating.
execute as @a if predicate coords:coord_x run say hi
I feel like its the deathX.plus.5 & deathX.minus.five that are causing no return
Possibly, have you tried checking those scores manually in-game?
how would I go about doing that?
I say that might be the issue as I couldnt find anything on score based math
/scoreboard players get <fake player name> <score>
or do I need dedicated scoreboards for those values?
You do not
I guess a way I could do it for sure but it would be ridiculous would be to have deathX, deathX+ and deathX- scoreboards that each save the corresponding values then have it where I have a sphere of detection locations. But thats super messy
so using the predicate do I still need the fake players?
Yes
ok thats probabaly why then
so how would I go about setting that up as im not familiar with using fake players
You don't need to set anything up, if you try to set a score of or to a name that doesn't exist, it'll just create that fake player
Honestly same, you're kinda confusing me
Sorry
Probabaly need to start from the beginning ngl
Should I yeet this post and just make a new one for the entire project instead?
No, but you may need to provide a refresh here if what the problem is and what you're working with
Im trying to find a way to use the players location of death to remove a recovery compass out of the players inventory when they walk within a 5 block radius of their death
What is instead of doing coords I summon an armorstand at the players death location with the dead player's UUID then compared the two and if they match remove the recovery compass when within 5 blocks of while also killing the armor stand?
Your question, #1315382089851605002 (Score compared to score help), was resolved!
#1315382089851605002 message
6h27m
Re-opened the channel. Make sure to close it again once you're done.