Started by
dbm1234
on
Topic category: Help with Minecraft modding (Java Edition)
How make a sword do more damage after killing an entity? I intended to make the sword I made increase its damage by 5 when killing a villager with it. Can someone help me?
Sorry but could I ask your some more questions about your question? When you said you want it to increase damage after killing a villager, you want it to increase permanently or just for an amount of time or maybe increase the damage of the next attack?
Permanently
Sorry for not finding the best solution for your problem, but I think you could try this for the mean time:
First you should create a global variable like this:
https://ibb.co/Wy41rWG
Then create a procedure like this one:
https://ibb.co/PgLf1xP
Anyway, hope this helps.
hi there, i cant find the Get Global and Set Global for the procedure tuonkhung made. idk if its bc of an update but can you tell me where to find? also if you found a new way of doing the procedure i would like to ear it too
im having the same problem could someone post a pic on how to do it
Something you could try is setting an NBT tag on the item (let's call it "strength") and when an entity is killed, increase the NBT tag.
Then, in the "before entity is hurt" global trigger, check if the source entity has the correct item in their main or offhand, then deal additional damage based on the strength NBT tag on the item.
Let me know if you need any more information!
thank you for the help, but i dont know the name of all the tags
could you lease post a pic
that would help a lot
I'm not entirely sure how to put an image (because it uses urls instead of uploaded files)
The name of the nbt tags should all be a number tag named "strength" (although you can change the name of the tag, just make sure all the names of the tags are the same)
To check items in a players hand, use item in mainhand/offhand of source entity in the before entity is hurt global trigger (set it in the green block that appears in the procedure by default)
o, ok i just would really benafit from a pic
could u please take a screenshot and make it a url then post it here???
First Procedure
Second Procedure
Procedure Downloads
https://www.dropbox.com/home?preview=ApplyDamageModifier.ptpl
https://www.dropbox.com/home?preview=CheckEntityDies.ptpl
Thank u so much