#Differentiate player_hurt_entity by tag

1 messages · Page 1 of 1 (latest)

solemn jetty
#

I want to execute a function only if a tagged interaction entity is left clicked. Currently it detects when an interaction entity is clicked, but not which one

unborn schoonerBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

fervent hazel
#

You can easily add a Tag condition to the advancement by adding the nbt to the nbt field

devout lark
#

nope just use @selector[tag=whatever] in the function you're calling as a reward

solemn jetty
devout lark
fervent hazel
solemn jetty
fervent hazel
#

I suggest using misode to make your advancements. It helps a lot.

polar bisonBOT
#
**📖 Misode**

Awesome website with generators for almost everything. Also contains a technical changelog for new versions, guides on how to use some features, a performance report inspector and more!

Full list of generators: Loot Tables, Predicates, Item Modifiers, Advancements, Recipes, Text Components, Damage Types, Chat Types, Trim Materials, Trim Patterns, pack.mcmetas, Dimensions, Dimension Types, Biomes, Configured Carvers, Configured Features, Placed Features, Density Functions, Noise, Noise Settings, Structures, Structure Sets, Processor Lists, Template Pools, World Presets, Flat World Presets, World Settings, Block Tags, Entity Type Tags, Fluid Tags, Game Event Tags, Item Tags, Biome Tags, Structure Tags, Blockstates, Models, Fonts, Atlases

Link: https://misode.github.io/

solemn jetty
#

i did

#

this is the advancement code

fervent hazel
#

Ok, there is a field called NBT, put the Tag nbt in there and that should be it

devout lark
rose bough
#

execute on target if entity @s[tag=...] ...

#

where on target selects the entity that @s is targeting

devout lark
solemn jetty
#

yeah i got it

devout lark
#

im so sorry for my rotted brain

#

but do you still wanna the solution without nbt tags by any chance

solemn jetty
#

is there a way to do without

solemn jetty
#

not familiar with target what does that do

rose bough
solemn jetty
#

light mode more like shite mode

devout lark
solemn jetty
# fervent hazel

so the player clicks the thing, gets achievement, the achievement runs the function that executes as the entity the player clicked on only if the interaction entity is tagged

rose bough
devout lark
#

can i ask you to test something, i am not sure. can you put say @s in your funciton that runs after you punch an interaction entity

devout lark
solemn jetty
#

yeah

#

the first command in the function is just tp @s coords and it teleports the player

rose bough
devout lark
#

back when i learned datapacks i didnt know about datapack hub

rose bough
#

I don't see why you don't just execute on target if entity @s[tag=...] ...?

#

it's a solution

devout lark
#

and

#

on target should be ran as the entity

rose bough
solemn jetty
rose bough
#

left click still requires you to put your cursor on the entity (eeyuh boio probs hasn't opened mc in a year)

devout lark
#

so basically it should be

execute as @e[tag=start_tag_thing] on attacker run function the_funciton_here

the_function_here

say "now this should work fine"
#

@solemn jetty

solemn jetty
devout lark
rose bough
#

on target

devout lark
#

left

solemn jetty
devout lark
#

click

rose bough
#

read this

devout lark
#

read that

solemn jetty
#

attacking = left click?

devout lark
#

i mean you have to press lleft mouse button to attack

rose bough
solemn jetty
#

i think he means "interaction" is right click

#

while attack is left click

devout lark
#

yes

devout lark
solemn jetty
#

he's fine

solemn jetty
rose bough
#
#function run by advancement
execute on target if entity @s[tag=...] on attacker run function do_something:with_player
advancement @s revoke ... 
devout lark
solemn jetty
devout lark
solemn jetty
devout lark
devout lark
#

iirc you click it once and then tp to another place?

#

then its actually ok to use the nbt variant

solemn jetty
#

yeah you TP after clicking so that couldn't happen

devout lark
#

yea

#

you could do that then

#

more readable solution

#

sorry i might suggested the wrong thing

solemn jetty
#

i like not having 2 functions for basically the same action also

#

i'll make a new post for the other thing