0

I want to make a projectile "belong" to a team by adding a tag to it. the players throw snowballs that are supposed to only hurt the enemies. Is there anyway I can use the owner nbt data to extract what tag it should use (the tags are T1 for team 1 and T2 for team 2). I have tried detecting the player within a certain distance (doesnt work if distance is less than 2) but that causes it to belong to both teams if 2 people are too close together. Thanks for reading and have a nice day.

2
  • You can make an If to see if the snowball has any tags before adding either the T1 or T2. You are asking how to extract the tag but looks like you've done it already. Yes it should be distance based, (..2 or @p) should work since it will only get the tag if it doesn't have already. In case you are struggling to make the if, post what you have so far.
    – BunnyMerz
    Oct 17 '21 at 3:58
  • @BunnyMerz I want to copy the tag from the thrower. the problem with it is that 2 people with T1 and T2 too close can cause one team to have their command block run first and thus unfairly win the encounter because every snowball counts as theirs. Oct 18 '21 at 1:33
1

I figured it out! If I give the potential thrower a snowball like so: /give selector snowball{tags:["tag"]} then I can search it using @e[type=snowball,nbt={Item:{tag:{tags:["tag"]}}}]!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.