I've edited a lifesteal datapack so that if you have 5 hearts you can't lose hearts anymore, so that you can't get banned. to prevent heart farming I also made it so that if you kill a player that has 5 hearts you won't get a heart from the kill. It works this way: once you have 5 hearts, you are granted an impossible advancement. Killing a player with that advancement means you won't get a heart. However there is a problem: when you kill a player with 6 hearts, you should get a heart but you don't. This is because if you die your max health is instantly set to 5 hearts and the advancement is granted, which prevents the killer from getting a heart even though the killed had 6 hearts. How can i fix this? I already tried many possibilities
#lifesteal datapack help
1 messages · Page 1 of 1 (latest)
When they reach 5 hearts for the first time give them a tag, then if they die and have this tag give them another tag, if you only check for the second tag it should work
can you check for tags in advancements?
because i would need to check if the killed player has the tag in the advancement
Yes
In nbt you can check for tags.
"nbt": "{Tags:[\"your_tag_here\"]}"
can i also check for scoreboard values?
although if i detect the health scoreboard the problem would be the same
i did this.
it doesnt work
it would work if i could check for éverything except a tag in an advancement
can i do this???
so check if the player does NOT have that tag
You can check the opposite with the inverted predicate type
it doesnt rlly work
i have this as my predicate
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"nbt": "{Tags:["mark2"]}"
}
}
}
and this as my advancement
{
"criteria": {
"requirement": {
"trigger": "minecraft:player_killed_entity",
"conditions": {
"player": [
{
"condition": "minecraft:reference",
"name": "lifesteal:notmark2"
}
],
"entity": {
"type": "minecraft:player"
}
}
}
},
"rewards": {
"function": "lifesteal:health/playerkilled"
}
}
however if i kill a player with mark2 you still get a heart(the advancement triggers) even though it shouldn't