#How to assign an entity to a player
1 messages · Page 1 of 1 (latest)
quick question
what will happen if a player named .max join?
That would break it, but that's why it's just an example. You can make your fake player have a # or $ at the start of the name, which are illegal characters for usernames, to avoid that problem. Starting it with a # will also make it not appear in the sidebar, if that's desirable behavior
and if i reset the scoreboard without /advancement revoke @a it will break i too?
I'm not sure what you mean
all ids are stored in the scoreboard so if I reset this scoreboard this system will stop working
until i type this command
/advancement revoke @a
...right, so don't do that
oh ok
is this necessary?
{
"condition": "minecraft:entity_scores",
"entity": "this",
"scores": {
"playerid": {
"min": { "type": "minecraft:score", "target": { "type": "minecraft:fixed", "name": "#this" }, "score": "playerid" },
"max": { "type": "minecraft:score", "target": { "type": "minecraft:fixed", "name": "#this" }, "score": "playerid" }
}
}
}
Yes
cant i just copy player id score on bullet score and then find player on hit using macros?
or this thing does something else?
This simplifies that process to not require macros
i think i prefer to write a little more but understand what i am doing
It will be worse for performance
what folder should it be in?
predicates?
That's a predicate, yes
In 1.21+, the folder would just be predicate
it is next to advancement and function?
Yes
i rejoined world and didnt get any score
nvm
i just needed to revoke advancement
i guess i just got it before i wrote code that gives me score
That tracks
thanks for help
bro
i typed this
/scoreboard players set #this player_id 0
and then this
/execute as @a[predicate=apex:match_id] run say I have the same ID.
and nothing shows
Did you check what your id score is?
(my score on player_id is 0)
yes
Show your predicate?
{
"condition": "minecraft:entity_scores",
"entity": "this",
"scores": {
"playerid": {
"min": { "type": "minecraft:score", "target": { "type": "minecraft:fixed", "name": "#this" }, "score": "player_id" },
"max": { "type": "minecraft:score", "target": { "type": "minecraft:fixed", "name": "#this" }, "score": "player_id" }
}
}
}
i just changed playerid to player_id
Good good, that's what I wanted to check
but i did it everywhere
Do you have something that's resetting the score of #this?
i think no
Oh, wait
You didn't change one instance of playerid here
bruh
You changed it for the score you're checking of #this, but not the entry in the scores object
yea it works now
i did somethinglike this /execute as @a unless score @s player_id matches 0..999999 run advancement revoke @s only apex:first_join
will it work if someone is without score?
You don't even need the 999999, but yes