Started by
AliveWater
on
Topic category: Help with Minecraft modding (Java Edition)
So I'm making a custom AoE enchant that deals a percentage of your original damage in a radius based on the level of the enchantment. Does anyone know how to do this?
Edited by AliveWater on Tue, 10/01/2024 - 17:49
Use the player uses item trigger and the "get damage of [item in main hand]" block
Wait there is a better trigger for hitting a mob, use that instead.
Yeah, but how do I make the damage affect all of the entities within a certain radius?
Get damage of item in main hand gives you the items current durability.
Use entity iterator to affect all entities in a radius. World procedures, actions, for each entity as entity iterator is square cube of size (x). Change the size to match your desired radius. Then do whatever you want within the entity iterator. When adding any blocks to it you must change event/target entity to entity iterator instead. Unless you want data from the player.
You can also make an if entity iterator = not entity of type player so the effect doesnt apply to the player and only the other entities around it. This would mean it doesnt apply to other players too but you can change type player to source entity if you want it to affect other players and not the player who started the effect/ability.
If you want the attack damage of an item I dont know how without you hitting an entity first. If you use on entity attack global trigger you can call the (amount) dependency to get the damage done to the entity.
Otherwise you can make a long procedure to check if the item is eg iron sword so set local variable attack damge to 5 etc. Then use local variable *0.1 to get 10% of the iron swords damage and apply it to all entities using entity iterator.
Thanks!