Started by
MatosPoljca
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a lifesteal enchantment, but it won't work. This is my proc:
So basically, when you critically hit a unit, it checks if you have lifesteal and then sets your health to your current health + 15 or 30% of the item's damage, depending on lifesteal level. But It does nothing xd.
I think I know why it is not working:
These Global Trigger where it check if you deal Damage like "Before Entity get hurts", "Player deals critical hit"and "Entity attacked" is the Event/Target Entity the Entity that being attacked and the Source Entity is the Entity that attacks the Target.
Also if you want to check if the Attacker has Enchantment you'll need to replace all Event/Target Entity Blocks with Source Entity Blocks.
If something is unclear just comment it here :)
Well, it works now, but not how I want it to. Seems like "item damage" isn't item's attack damage but rather how damaged the item is, so that number is around 2000 for new netherite items, and 15% of that is a lot more than a full health bar... So every hit is insta full health. How do I check for item's stats or damage done to entity? It would be best if I could return the value of how much damage the attack dealt so that I heal less against heavily armored entities.
In these Global Triggers you should see available dependencies.
There is a Number dependency called amount. If you make an number dependency that can be found in the Category "Advanced". The Block has dependencyName as a name and has the color of the normal number blocks. in There just write 'amount' exactly like I write without the quotes. But this is not available for critical hit Global Trigger. Instead there is a 'damagemodifier' event. But what you can could is to heal 15% of the Current Health of the Enemy.
If you want I can make you an Procedure Template for you that adds exactly the Lifesteal Enchantment. (I will make it because I need to visualize it :) )
If I cannot return the value of item's attack damage, then I'll just make the enchatment give flat health (0.5 heart for lvl 1 and 1 heart for lvl 2 for example). That should suffice I guess... Would be broken on spamming tho, so I will have to give it a cooldown too.
Also you're Percentage Calculation is wrong.
Example: 20/100*15 - It means 15% of 20
And you could make an Percentage Chance.
In the Math Category there is an Block called "Number between 'min' and 'max'" with this you can make easily an Percentage Chance.
If you use Entity Attacked or Befor Entity is Hurt Global Trigger you can use the amount dependency and you can make the 15% of the Damage as Life Steal.
I do not know how :(
I found a way how to implement your Idea with the Life Steal that uses the amount of Damage to gain 15% of the Damage you dealt.
I'm testing it currently at the moment where I'm writing it.
So @SparkleArts did you find a way for it to work?
Here is a Picture:
The Heal Procedure Block is Block of a Plugin called Forge Plus that I'm working on. I will release the first version of it in the near future.