Random Potion Effect on Right Click with an item, then giving it a 30 cooldown

Started by lamon_damon on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Random Potion Effect on Right Click with an item, then giving it a 30 cooldown

I wanted to make a sword that, when right-clicked with, it gives a random positive potion effect that lasts 20 seconds, and after you get the potion, a 30 cooldown so you can't spam getting potion effects.

 

I've tried for hours to make it work and I don't know what I'm doing wrong, could someone help?

 

Here's the procedure I made: https://imgur.com/a/CGqLCD2

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
there is a "when item right…
Sat, 07/05/2025 - 16:42

there is a "when item right clicked" trigger you should use instead then you just need to get a random number > activate an effect based on that number > cooldown the provided item stack 

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I put an image with my code,…
Sun, 07/06/2025 - 19:25

I put an image with my code, I think I kinda did all of that, but it still doesn't work...

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
is that a new image in the…
Mon, 07/07/2025 - 00:53

is that a new image in the top post or the old one?

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
the new one, I basically…
Mon, 07/07/2025 - 09:42

the new one, I basically didn't change anything

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
if you used the "when item…
Mon, 07/07/2025 - 17:32

if you used the "when item right clicked" trigger so shouldn't need "item in main hand of" in the if loops

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it still doesn't work even…
Mon, 07/07/2025 - 19:50

it still doesn't work even without the "item in main hand of"

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1st try removing "simulate…
Tue, 07/08/2025 - 02:56

1st try removing "simulate right click"

if that doesn't work try moving "cooldown item in main hand" to the bottom and/or change it to "cooldown provided item stack"

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So I tried what you said,…
Wed, 07/09/2025 - 10:48

So I tried what you said, but it still doesn't do anything...

Here's the new code, maybe I messed something up: https://imgur.com/a/Sda89AK

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
honestly I have no idea…
Thu, 07/10/2025 - 19:31

honestly I have no idea maybe you linked the wrong procedure or something

I made a what I told you to make and it worked fine

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
"maybe you linked the wrong…
Thu, 07/10/2025 - 23:21

"maybe you linked the wrong procedure or something" sorry I didn't realize how this could sound what I meant to say is to make sure you have the right procedure selected under triggers

 

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think the problem is that…
Fri, 07/11/2025 - 03:33

I think the problem is that you're using the "Random number between min X and max X" block, but I think sure that also includes numbers like 0.1, but you're checking for whole numbers. Try switching to the "Random integer between min X and max X included" block. That one will only do whole numbers.

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@TheMrCrow good catch
Fri, 07/11/2025 - 07:33

@TheMrCrow good catch

Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yep, that worked!! I don't…
Fri, 07/11/2025 - 18:28

Yep, that worked!! I don't know how I didn't think on changing the random block to be an integer one, but it's alright now. Thank you so much for the help, I appreciate both of you!!

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@TheMrCrow would you please…
Sun, 07/13/2025 - 17:29

@TheMrCrow would you please like to help me make a mod together?