[solved] How do I make a potion effect in which it heals and grants resistance

Started by BurntDonut on

Topic category: Help with modding (Java Edition)

Last seen on 08:03, 7. Jul 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[solved] How do I make a potion effect in which it heals and grants resistance
Sun, 12/31/2023 - 01:46 (edited)

I wanted to make a potion effect for a weapon which has a random chance to give you the effect that heals you from time to time and grants some resistance to lessen the given damage from an entity. I really don't know how and I've looked through the blocks and even searched and I can't seem to find any that could be

Edited by BurntDonut on Sun, 12/31/2023 - 01:46
Last seen on 20:43, 20. Aug 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There should be potion…
Sun, 12/31/2023 - 01:36

There should be potion functions in the entity management tab, or entity actions tab if you're using the new version. You can also set the level of the effect, the duration, and whether or not to display particles. If you want the weapon to grant these effects while it's held, you could use the 'item in hand tick' trigger for your sword item. This will call the procedure every tick, (twenty times per second), so if you tell it to give a small amount of this effect, the player will constantly get a couple seconds of resistance and regeneration.

If you want the effect to be randomized, you could add the 'do with 70% chance' procedure template. You can find procedure templates in the upper right hand corner of the code editor- they contain example code for various things. This one is a simple if bracket that you can give a decimal number- if you put the rest of your procedure inside, you can then determine the chance of it occuring. Since this will trigger every tick the item is in the player's hand, you'll want it to be something pretty small.

Last seen on 08:03, 7. Jul 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh sweet it actually worked…
Sun, 12/31/2023 - 01:45

Oh sweet it actually worked. Thank you ^^