Started by
BurntDonut
on
Topic category: Help with Minecraft modding (Java Edition)
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
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.
Oh sweet it actually worked. Thank you ^^