How to reload ammo when right click?

Started by Toibithieunang on

Topic category: Help with modding (Java Edition)

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to reload ammo when right click?

I'm trying to make a musket, but i want to make a reloading ammo system in it. 

When you shoot, the musket switchs to "no ammo" . To reload the musket, you need to right click. When right clicked, the gun will have a cooldown ( and you can't shoot) by 1-6 secs.

But if you switch the gun slot, it will not load ammo. How can I make that?

Thanks.

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
instead of "right click", if…
Mon, 11/14/2022 - 14:31

instead of "right click", if I press R then is there possible?

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your tutorial is very good,…
Mon, 11/14/2022 - 23:05

Your tutorial is very good, but do you know how to check the gun slot? 

("But if you switch the gun slot, it will not load ammo")

Last seen on 20:36, 15. Oct 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not sure what you mean…
Tue, 11/15/2022 - 13:54

I'm not sure what you mean by "checking the gun slot"

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Let me explain: When you…
Wed, 11/16/2022 - 10:33

Let me explain:

When you press R if gun has no ammo, it will start a cooldown for 1- 6 secs

In the reloading time (1-6secs) you need to keep the gun slot (Minecraft slot)

If you switch slot when It doesn't  cooldown complete, It will not reload the gun ( and reset the cooldown)

hope you understand

 

 

Last seen on 20:36, 15. Oct 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Did you try my method tho? I…
Thu, 11/17/2022 - 11:22

Did you try my method tho? I'm 90% sure it should work

 

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I can't find the "Get (..)…
Fri, 11/18/2022 - 05:27

I can't find the "Get (..) for entity (..) block

I'm using mcreator 2022.2

Last seen on 20:36, 15. Oct 2023
Joined Nov 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That should be in the …
Fri, 11/18/2022 - 13:14

That should be in the "custom variables" tab

 

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I found it
Sun, 11/20/2022 - 11:48

I found it

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks Screech - Obamium ,…
Sun, 11/20/2022 - 11:50

Thanks Screech - Obamium , you help me a lot!

But do you know how to check the gun slot? 

Last seen on 14:00, 24. Apr 2024
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Toibithieunan What about…
Sun, 11/20/2022 - 12:11

@Toibithieunan What about checking if you hold the Musket in the Main Hand? This is much easier to do.

And don't use Global Variables for Items. Use instead of NBT Data to check. You could add for every Musket an boolean NBT that change if you need to reload or not. And for checking if you hold the Musket in the Main Hand you could use an Global Player persistent Variable.

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't know to use…
Sun, 11/20/2022 - 14:42

I don't know to use something like NBT Data or Variables.

Can you help me? 

Last seen on 11:32, 26. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to use NBT Data on…
Tue, 11/29/2022 - 13:16

How to use NBT Data on musket?