#Hit dettect

1 messages · Page 1 of 1 (latest)

dark elk
#

Hi! I wanted to make an smp, where you have a few group's. One of this is poison group, that when hitting a player, you get a regeneration 1 for 2 seconds. How could I make it, because it's hard. I tried using advancments that reward is a function, but the advancment doesn't work. I don't know if I should use advancement or not, but still used advancement tag

green saffron
#

advancements should be able to work. Show your work.

Also try to be specific as the above can be read four ways.

  • poison group is hit
    • poison group (victim) gets regen
    • attacker gets regen
  • poison group hits something else
    • poison group (attacker) gets regen
    • victim gets regen
dark elk
#

this os the adancment:

#

{ "criteria": { "poison_hit": { "trigger": "minecraft:player_hurt_entity", "conditions": { "damage": { "type": { "is_projectile": false, "is_explosion": false, "is_magic": false, "is_fire": false, "is_fall": false, "is_drowning": false, "is_starve": false, "is_cactus": false, "is_fly_in_wall": false } } } } }, "rewards": { "function": "toxic:poison_hit" } }

#

and this is the function:

#

`execute if entity @s[tag=poison] run effect give @s regeneration 1 0 true
execute as @e[distance=..5,tag=!poison,nbt={HurtTime:10s}] run effect give @s poison 5 0

advancement revoke @s only toxic:poison_hit`

#

idk why, but before when i typed advancement revoke @s only toxic:poison_hit vs code made it yellow, but now its okay

#

i changed the advancment to this:

#

{ "criteria": { "poison_hit": { "trigger": "minecraft:player_hurt_entity" } }, "rewards": { "function": "toxic:poison_hit" } }

#

and the function to say hello, still doesnt work

#

I'm dumb, i didnt add the parent etc.

green saffron
#

you don't need a parent advancement

dark elk
#

oh, okay

green saffron
#

and you are sure it does not do the say hello when you hurt any entity?

if that is the case your advancement hasn't been revoked properly or you forgot to reload

dark elk
#

I changed it to tellraw, and it doesn't pop up

#

This is my code now

#

{ "criteria": { "poison_hit": { "trigger": "minecraft:player_hurt_entity" } }, "rewards": { "function": "toxic:poison_hit" } }

#

`tellraw @a hello

advancement revoke @a only toxic:poison_hit`

#

I don't know what's wrong

green saffron
#

did you reload and have you checked the logs?

dark elk
#

i realoded, and i didnt check the logs

#

it's the thing you turn on, in the minecraft launcher?

green saffron
#

yes, usually helps finding errors like typos etc.

dark elk
#

okay, so i turned it on, and when i kill a pig, nothing happens

green saffron
#

the error should be upon reload

#

if any

#

also, what is your folder structure and minecraft version

dark elk
#

it's 1.21.11 and wait

#

I'm stupid

#

it should be advancement instead of advancements