Projectile not shooting?

Started by TheBlargMan on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Projectile not shooting?

I have no clue why, but suddenly the projectiles aren't shooting from the gun I made at all! All that happens is it plays the shooting animation (bow charging) and shoots nothing! The gun I am making shoots projectiles that summon lighting when they hit something, it has a special overheating system, and everything about it worked flawlessly until I made some small visual tweaks, then the gun just stopped working, even after I reverted said tweaks! I know it doesn't have to do with the "Can use ranged item" condition, because the animation still plays and the game still registers that I fired it. I have NO clue what is wrong, and no other forum topics cover this without it making no sense or just not working for me. Please help soon!

Screenshots: https://imgur.com/a/Fb2sFoq

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok something to add- it DOES…
Sun, 12/08/2024 - 18:51

Ok something to add- it DOES have to do with the "Can use ranged item" condition, and it seems to be working but not firing the projectile? I have the value for the amount of shots before overheating and if the code returns true or false printing to the console, for Render thread it is working but for server thread it is constantly set to -50. Please help!

Screenshots: https://imgur.com/a/p2pbpnz

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Basically on server-side the…
Sun, 12/08/2024 - 19:01

Basically on server-side the variable is constantly set to -50 and on the client it works as it should

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm slightly new & im…
Sun, 12/08/2024 - 21:28

I'm slightly new & im actually struggling with my own Gun Procedure right now lol, but suggestion; Is the Global Variable "lightningShots" set to something like Player Persistent? Which only syncs on the Client. If so and your not setting its value somewhere else (Like -1 when you use it, or +1 when you get ammo or whatever) Then my assumption is that it is saving the information of your Variable to the Player and loading it everytime you load the game, So the value doesn't return what you were expecting it to. It would help to know what prints in console and what else procedures you have connected to this. but anyways, this is only my newbie assumption lol.

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh also i don't know why i…
Sun, 12/08/2024 - 21:30

Oh also i don't know why i forgot about your last replies you left; But is it also possible that wherever you are changing the lightningShots value number, that it is just firing too often? Like if you have it on Tick update for example, its going to fire 20 times per second (sometimes more if you have a high framerate).. So that's something to consider, maybe it's just firing to quickly so adding a "Wait" block or some type of NBT timer could help?

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It isn't firing on tick…
Mon, 12/09/2024 - 02:28

It isn't firing on tick update, the firing is just like a normal ranged item, and it isn't automatic

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and yes the variable is on…
Mon, 12/09/2024 - 02:30

and yes the variable is on player lifetime, but it wouldn't work the way i want it to on any global scopes. It also doesn't work on the global scopes either.

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I would recommend to create…
Mon, 12/09/2024 - 06:15

I would recommend to create a new projectile and if this hits a block or entity summon then a lightning

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well of course it needs to…
Mon, 12/09/2024 - 21:08

Well of course it needs to be in the clients scope & not the server, or else that would be extremely laggy i assume. But also my main point about the Variable scope was that, maybe your procedure is constantly setting it to -50 on the server-side because of the fact that your variable only syncs on the client side and technically can't sync over the server like you would with Global Variable scopes. So if you have a Check statement of something like "If Is Server-Side" then I could see it not firing because of that . And my other point was that if you have a value you want it to start at by Default and increase or decrease it over use / overtime, and when using a Variable Scope that saves information to the world or Player, to create or find a procedure where you can Check everytime the Player joins back into the World and then set its Default value again, Because for say on one Play test you let the value get to -10 from 0 then you left and saved the world, Well it would load again as -10.. Get me? Also your screenshots don't really help, we would need to see all procedures related to your weapon in order to actually figure out why it's constantly being set to -50....

Joined Nov 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh lastly, don't know if you…
Mon, 12/09/2024 - 21:12

Oh lastly, don't know if you tried it already; but maybe try adding a short wait before firing your action that subtracts value from your variable? Because maybe, just maybe, the item is firing to often (maybe even constantly firing when holding right click) causing it to set that number to -50 very fast.