Ranged Weapon Projectile damages self

Started by JustHaven on Tue, 11/29/2022 - 04:48

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:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Ranged Weapon Projectile damages self
Tue, 11/29/2022 - 04:48

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 18:18, 24. Jan 2023
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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!