Started by
milkycashews
on
Topic category: Help with Minecraft modding (Java Edition)
i have an enchantment that takes a heart, 2 , or 3 off of a mob and heals them to the player depending on the level. while making it, i realized a sweep attack could heal the player back to full health thus making it too op. is there any way to make it occur once every second or two, or anything else i can do to make it less op? here's the enchant
ive got an idea, i hope that i understood everything correctly.
you can create a variable for a player, that would work like some sort of a cooldown. for example: when you attack an entity, the game will check if the cooldown is at 0, the bleed enchantment will activate and the cooldown will be added so you wouldnt be able to abuse the mechanic.
the cooldown itself will go down by 1 every player tick update in other procedure. you need to also make game check the cooldown to not go lower than 0 (ex: if get number global:cooldown < 0, do set number global:cooldown to 0 for entity: event/target entity).
this way the bleed effect will activate not at all the times, making some hits normalš (also maybe you wouldnt want the effect to take away hp in %, cuz it can be veeeery op against high hp entities)
i hope I have formulated it rightill try this, thanks! (also for the % points i realized that which is why i made it in percentages of the player's max hp so for example set the enderman's health to current health - 0.1 x the players max hp so it minuses one heart since that is 10% of the player's max hp)
oh damn, didnt see that one srry. thats very cool actually