[SOLVED] How to make enchantment based on consecutive hits?

Started by AliveWater on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[SOLVED] How to make enchantment based on consecutive hits?
Tue, 10/01/2024 - 17:49 (edited)

I want to make an enchantment that when you do a certain amount of consecutive hits an event will occur. (Such as a thunderbolt striking all near mobs after 5 hits). Does anyone know how to do this?

Edited by AliveWater on Tue, 10/01/2024 - 17:49
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use on entity attacked…
Tue, 10/01/2024 - 11:54

Use on entity attacked global trigger. Then either use an nbt on the entity being hit, or use a variable on the player. Depends on how you want the enchantment to work. Then get the nbt or variable number, if < 5 then set number (get number+1), else if =5 then strike lightning or whatever you want.

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you want the ability to…
Tue, 10/01/2024 - 11:55

If you want the ability to be on the player/item side then use a variable or item nbt eg every 5 hits with the item the ability activates. If you want it to be on the entity side eg hit each entity 5 times to activate ability, then use entity nbt.

Joined Sep 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks!  
Tue, 10/01/2024 - 17:48

Thanks!