Help with Random delay

Started by Ray262 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with Random delay
Tue, 09/12/2023 - 16:04 (edited)

I'm trying to make a gun mod and I wanna add a feature that jams your gun while using a gun it has a chance to jam after a random delay but I don't know how to do it

Edited by Ray262 on Tue, 09/12/2023 - 16:04
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Random delay as in random…
Fri, 09/22/2023 - 03:43

Random delay as in random number of times fired, or as in random amount of time until you can fire again? 

If you just want it to jam after a random number of times fired, each time the gun fires, have a random percentage check that can jam the gun. (There's a 'do with 70% chance' procedure template that gets the idea across pretty well.) This could be frustrating though, so maybe have a minimum number of times you can fire in sucession before it can jam. 

If you want a random delay until you can use it again, that's even easier- just use the 'cooldown item' procedure block, and where it asks for delay, put in a 'random integer between... (whatever you want for your minimum and maximum delay).'