Make Entities register more than one damage event per tick?

Started by MightyMoZes on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make Entities register more than one damage event per tick?

Hello,

I've been toying around with creating a simple shotgun-like ranged item and there is just one problem left for me to tackle:
The Item shoots 8 bullets per attack(1 though the ranged item settings itself and 7 via "on item used"-procedure)I want the item do do most damage at close distance, but any entity only recieves/registers one hit( =only the damage of a single bullet)
This is kind of frustrating because despite the useful bullet spread, common mobs are killed in two hits regardless of dsitance from the player.

Could this be resolved with changes to the ranged item itself, or would there have to be changes to the way any entity handles a damage event(per tick)? Unfortunately this is already beyond my comprehension.

Thank you for any advice

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Not possible in Mcreator
Mon, 08/15/2022 - 22:59

Not possible in Mcreator

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Aw, waht a bummer. But I…
Wed, 08/17/2022 - 10:02

Aw, waht a bummer. But I already suspected that.
Big thanks nontheless. That means I've got it working as best as I could.

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Do zero damage projectiles,…
Wed, 08/17/2022 - 18:05

Do zero damage projectiles, but make a procedure for when the projectile hits, and set their health to 1 less or something. 

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmm, that migh actually work…
Fri, 08/19/2022 - 09:51

Hmm, that migh actually work.
Would you go about it by usind a command similar to this:
/damage @e[type=!player, distance=..2] 1 entity_attack entity @e[type=player, name="shotgun"]

?

I'll report back if this works as a simple solution
 

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok. Jut tested it. Sadly it…
Fri, 08/19/2022 - 10:38

Ok. Jut tested it.
Sadly it does not overcome the initial problem. Even if the damage is applied via "projectile hits living entity" it still only applies it once, even if all 8 pellets hit at the same time. So the outcome is the same as before :/

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, so after all I tried the…
Fri, 08/19/2022 - 14:03

Ok, so after all I tried the only solution is to make the projectiles do zero(0) damage and apply damage via the command.
But to scale damage according to distance you should instead define many individual if->do conditions of "does entity exist in cube of size x of type [player]" this way you can define damage dealt in relation to distance between player and target.
Just male sure to define a bunch for maybe diefferent cube-sizes in steps of 4 blocks until you have defined the maximum range that your "shotgun" should work.

I also set a block with a timer in the "on ranged item used" to despawn the bullets via command after x ticks to limit the range regardless of shoot power. This is optional of course

Joined Dec 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
pls show procedure!  
Tue, 03/12/2024 - 12:59

pls show procedure!