Custom potion effect

Started by MrBOBERTAK on

Topic category: Advanced modding

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom potion effect

i would need some help, i want to make a potion effect, that, when given to the player absorbs all of its damage, and once the effect is gone, it deals it back to the player

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So you'll need to create a…
Mon, 01/29/2024 - 23:57

So you'll need to create a potion effect like normal. Then you need to create a player-lifetime number variable. Lastly, you want to make a procedure with the 'before entity is hurt' global trigger.

  • In this procedure, check if the entity has your custom potion effect. If it does, set the variable, (I'll call it 'kickback,') to itself plus the 'amount,' which is a special dependency provided by this trigger; then use the 'cancel event that started global trigger' function. So when the entity would normally take damage, it will instead increase the variable by that amount and then cancel the damage.
  • Then, make another procedure that triggers on player update tick. If at any time the player no longer has your potion effect, but their 'kickback' is greater than zero, deal that much damage to the player, then reset kickback.
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thank you !
Tue, 01/30/2024 - 16:07

thank you !