Ranged Weapon Projectile damages self

Started by JustHaven on

Topic category: Help with modding (Java Edition)

Last seen on 21:46, 29. Dec 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ranged Weapon Projectile damages self

When trying to make a gun mod I noticed that, in survival, the projectile sometimes kills the player that shot it which is undesirable. How I have it wired up is the projectile itself does no damage but instead asks a procedure if it hit a player to do an instant damage effect so I can have a custom death message. Hopefully, with this script, I can simultaneously do a check where if the target entity = entity that used the weapon it won't do damage, else it will. Any way to achieve this?

Last seen on 16:48, 17. Jan 2024
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Run an if then else…
Mon, 01/23/2023 - 16:11

Run an if then else statement that checks if the target entity = source entity.

 

Basically, when dealing with projectiles source entity=whatever fired it, the immediate source entity=the projectile itself, and the target entity is what is being hit. Hope this helps!