#My advancement doesn't seem to work

1 messages · Page 1 of 1 (latest)

barren knoll
#

it checks for skeleton ,skeleton horse and wither skeleton in player_hurt_entity
and another function checks if the player has triggered the advancement.
I'll post the code below

barren knoll
#

this function runs as tick ⬇️

#

execute as @a[tag=YesAmVampire,scores={vamphurtEntity=1..}] run function vampire_gets_blood:check_if_hurt_entity

waxen talon
#

what has the function to do with the advancement?

barren knoll
#

just a sec

#

this is check_if_hurt_entity
execute unless items entity @s weapon.offhand minecraft:glass_bottle run function vampire_gets_blood:vamphunt_set_0 execute if entity @s[advancements={vampire_gets_blood:hit_a_skeleton=true}] if items entity @s weapon.offhand minecraft:glass_bottle run function vampire_gets_blood:vamphunt_set_0 execute unless entity @s[advancements={vampire_gets_blood:hit_a_skeleton=true}] if items entity @s weapon.offhand minecraft:glass_bottle run function vampire_gets_blood:blood_bottle

barren knoll
waxen talon
#

you do know that all this command code can all be condensed inside the advancement and the advancement can also run a function automatically once it is true?

barren knoll
#

lemme educate myself

waxen talon
#

btw, which version?

barren knoll
#

1.21.10

novel rose
#

😭

barren knoll
novel rose
#

hi

waxen talon
#

I suggest you use misode for advancements or any json files for that matter, it makes your like 100 times easier

elfin basinBOT
barren knoll
#

the health nbt checks the health value of the mob but i want it to check only if the entity has health or not
{ "criteria": { "hit_other_mob_no_bottle": { "trigger": "minecraft:player_hurt_entity", "conditions": { "entity": [ { "condition": "minecraft:all_of", "terms": [ { "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "nbt": "{Health:1.0f}" } }, { "condition": "minecraft:inverted", "term": { "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "type": "minecraft:armor_stand" } } }, { "condition": "minecraft:inverted", "term": { "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "type": "#minecraft:skeletons" } } } ] } ] } } }, "rewards": { "function": "vampire_gets_blood:hit_a_skeleton" } }

latent holly
#

If I understand correctly, you can just check if Health is not zero

barren knoll
#

i dont see anything that compares health in advancements

latent holly
#

wait

#

you wanna check if the entity has 0 health

#

you can just check if it's dead

barren knoll
#

well what i wanted to do after player_hurt_entity is :-

  • check if entity has health
  • check if its not an armor stand
  • check if its not skeleton
    then run the function
latent holly
#

can you not just use inverted Health:0.0f?

novel rose
#

you can just invert Health:0.0f

#

because checking for a specific in a predicate will just be true if that entity has the specific Health

barren knoll
#

Inverting the health did work ,but due to Health:0.0f ,the advancement stopped running the moment i hit the entity which had half heart left.

So i had to make it Health:0.1f to just run the function after i hit it for the last time.

but thanks alot for the help