Please help me create a procedure

Started by koyote on

Topic category: Help with modding (Java Edition)

Last seen on 18:43, 16. Nov 2023
Joined Oct 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please help me create a procedure

How can I make it so that when I right click, the potion effect is activated and when I right click again, it is deactivated?

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You need to use a player…
Tue, 11/07/2023 - 04:53

You need to use a player-persistant logic variable. When the player right clicks, if the variable is already true, set it to false; and if it's already false, set it to true. (Possibly with an additional number variable for a cooldown time, if you want to discourage spamming/keep track of how long the effect has been active.) 

Then, using a procedure on player update tick, if the variable is true, apply 10 ticks or so of the potion effect. If it isn't, don't.