#How to assign an entity to a player

1 messages · Page 1 of 1 (latest)

frank sky
#

i am making guns but without instant raycast and i want to give points to players wich hit other players but i dont know how to check for wich player i should give points

minor horizonBOT
lyric mistBOT
frank sky
#

quick question

lyric mistBOT
frank sky
#

what will happen if a player named .max join?

timber ether
#

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

frank sky
#

and if i reset the scoreboard without /advancement revoke @a it will break i too?

timber ether
#

I'm not sure what you mean

frank sky
#

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

timber ether
#

...right, so don't do that

frank sky
#

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" }
}
}
}

timber ether
#

Yes

frank sky
#

cant i just copy player id score on bullet score and then find player on hit using macros?

#

or this thing does something else?

timber ether
#

This simplifies that process to not require macros

frank sky
#

i think i prefer to write a little more but understand what i am doing

timber ether
#

It will be worse for performance

frank sky
#

predicates?

timber ether
#

That's a predicate, yes

timber ether
frank sky
#

it is next to advancement and function?

timber ether
#

Yes

frank sky
#

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

timber ether
#

That tracks

frank sky
#

thanks for help

lyric mistBOT
frank sky
#

bro

lyric mistBOT
frank sky
#

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

timber ether
#

Did you check what your id score is?

frank sky
#

(my score on player_id is 0)

frank sky
timber ether
#

Show your predicate?

frank sky
#

{
"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

timber ether
#

Good good, that's what I wanted to check

frank sky
#

but i did it everywhere

timber ether
#

Do you have something that's resetting the score of #this?

frank sky
#

i think no

timber ether
#

Oh, wait

timber ether
frank sky
#

bruh

timber ether
#

You changed it for the score you're checking of #this, but not the entry in the scores object

frank sky
#

yea it works now

frank sky
#

will it work if someone is without score?

timber ether
#

You don't even need the 999999, but yes