Sword deals more damage to a certain mob

Started by Kamikase26 on

Topic category: Help with modding (Java Edition)

Last seen on 22:03, 23. Sep 2023
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sword deals more damage to a certain mob

Hello! I've been trying to make a sword that when i attack a enderman it deals more damage then if i was attacking a zombie, it isn't working.

I tried doing it troung the triggers of the tool but it didn't work, also tried doing it in a procedure alone but it didn't worked either.

If someone has any help or any procedure that does what im trying to do, i would appreciate leaving a comment or any help possible.

 

Thank you.

Last seen on 21:58, 23. Nov 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you make a procedure for …
Thu, 07/21/2022 - 00:09

If you make a procedure for 'When living entity is hit with tool' of your tool/sword. And make a If statement that checks if the subtype is an enderman, then make it do the additional damage you want in the if statement. it should work

Last seen on 05:05, 30. Oct 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There's no clean and easy…
Thu, 07/21/2022 - 06:35

There's no clean and easy way to do this unfortunately.  Applying damage on a hit trigger runs afoul of damage immunity, where a mob becomes immune to most damage for 10 ticks after being damaged. 

I've found that reducing the target's current health on a "before entity is hurt" trigger works pretty well to get a similar result.  One issue with this method is that it has the same effect on a spammed attack as it does with a full swing.  I mitigated this by checking if the damage "amount" was less than 3.5, and if so, reduced the health reduction by 2/3.  It's not perfect, works well enough for me.  One also needs to include a check to see if the damage reduction would kill the entity, and if so set health to 1 instead.