3

Help with a data packcontact_support

Flashbulb's Avatar Flashbulb3/17/22 11:08 am
3 emeralds 145 3
3/17/2022 8:57 pm
toothgenie's Avatar toothgenie
I am working on a data pack, and I wanted to add a special lifesteal weapon. In essence, whenever you kill an entity, you are given the instant health effect. However, I need some help on how to set it up and what is needed, such as predicates, scoreboards, etc.
Posted by Flashbulb's Avatar
Flashbulb
Level 48 : Master Fish
88

Create an account or sign in to comment.

3

OhGodImADad
03/17/2022 2:41 pm
Level 25 : Expert Engineer
history
OhGodImADad's Avatar
Hello Flashbulb. I like this idea, and normally I just troll through the forums looking for threads to read through, because I really enjoy seeing the ideas that flow through people, but this caught my attention because I might implement this into a pack I am working on myself.

I think this predicate below would comeback true anytime anything dies by a player with a Diamond Sword that has the NBT tag of "lifesteal" attached to it. (I also added an option to make the predicate fire when they have an achievement called "lifesteal", in case you want to make it unlockable that way)

Life Steal Predicate

{
"condition": "minecraft:entity_properties",
"entity": "killer",
"predicate": {
"type": "minecraft:player",
"equipment": {
"mainhand": {
"items": [
"minecraft:diamond_sword"
],
"nbt": "lifesteal"
}
},
"player": {
"advancements": {
"example:test/lifesteal": true
}
}
}
}


So basically, if you want the equipment to be what sets the Life Steal, you use the "equipment" player predicate, and if you want the Achievement to be what allows Life Steal, the "player 'advancements'" would be what you use. Then you just put a looping "execute if predicate" in your tick function file. I will test it out, but I am pretty sure this would work.

Also, alternatively, you could even use this method in tandem with a random choice predicate, making life steal a random chance, and leveling it up to happen more often as it's used.
3
toothgenie
03/17/2022 8:57 pm
Level 15 : Journeyman Crafter
toothgenie's Avatar
Also, to add to OhGodImADad's reply, if you want a website to do all the tricky json generation use https://misode.github.io/predicate/ to make your predicates.
3
Kefaku
03/17/2022 1:30 pm
Level 42 : Master Nerd
history
Kefaku's Avatar
You could add a scoreboard that uses the "totalKillCount" criteria to track which players killed something. Then you could use /execute if entity to check for all players with a score >0 holding your lifesteal weapon and give them an instant health effect. Then you just need to reset the scoreboard back to 0 (even for players not holding the weapon).
I think predicates would be more efficient, but I don't know how to do this with predicates.
Feel free to ask, if you have any further questions.
2
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome