Weapon ability doesnt work

Started by intheend on

Topic category: Help with modding (Java Edition)

Last seen on 20:19, 4. Sep 2024
Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Weapon ability doesnt work

Idea: When right clicked spawning particles and damage entity on radius 5 blocks around the player


That's how I realize it (i didn't figure out how to upload photos, so I'll describe it in text):

spawn particles on server side in area
if not is event/target entity (sub) type player
do     for each entity as entity iterator at x y z in square cub with size 5
         do deal 15 damage to event/target entity from source Damage source of type PLAYER_ATTACK
Cooldown Proviced itemstack for 100 ticks for event/target entity

particles spawning, but mobs doesnt hit
if i delete words about player damage start work only in player, mobs around doesnt hit

Last seen on 21:38, 5. Oct 2024
Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay, I see what you need to…
Sun, 07/07/2024 - 14:42

Okay, I see what you need to change

The particles and cooldown are fine as they are, but you need to move the if block inside the for each block, instead of the other way around. And you need to use the entity iterator block instead of event/target entity for the if block and the damage block.

It will look something like this:

 

spawn particles on server side in area
for each entity as entity iterator at x y z in square cub with size 5
do     if not is entity iterator (sub) type player
         do deal 15 damage to entity iterator from source Damage source of type PLAYER_ATTACK
Cooldown Proviced itemstack for 100 ticks for event/target entity

 

That should work