How to add custom stat that increases all damage you deal by a percentage?

Started by Necromancer14 on

Topic category: Help with modding (Java Edition)

Last seen on 17:02, 6. Jun 2023
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to add custom stat that increases all damage you deal by a percentage?

So like I know strength increases your damage by a set amount obviously, but I want something that will increase your damage by a percentage, eg if the stat was 10 it would increase damage 10%, so like Diamond sword would do 7.7 damage, iron sword 6.6 damage, etc.

 

 is there any way to do this?

Last seen on 20:09, 15. Aug 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If what you need is to…
Tue, 05/03/2022 - 03:16

If what you need is to increase the damage by percentage, you only need to add the maximum damage with the maximum damage by the percentage, which would be 0.1, an example, I have a maximum damage of 10, which is the maximum damage that your sword can do, then:

maximum damage 10
percentage 10% which would be 0.1

it would be 10+10*0.1

that would increase its damage by percentages and it would be 11 damage
hope this helps you

Last seen on 17:02, 6. Jun 2023
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok but like what procedures…
Tue, 05/03/2022 - 04:08

Ok but like what procedures would that be?

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unfortunately I don't think…
Tue, 05/03/2022 - 06:39

Unfortunately I don't think there is a clean way to do this in Mcreator, at least I couldn't find one.  One can "get" the <Amount> of damage about to be dealt to an entity during a "Entity attacked" or "Before entity is hurt" trigger, but I found no way to "set" this value.  Damage immunity means you can't just add extra damage during a trigger since only the highest damage instance in a 10 tick window is taken.  You could use a procedure to deal damage equal to the original amount + your bonus to deal your intended amount, but this has the problem of not counting as damage done by a player or weapon.

I ended up resorting to lowering the target's health by the amount of bonus damage I wanted to deal. Even this solution had issues where I had to compensate for when the target health was already too low or for when an attack wasn't at full strength from spam clicking.

Last seen on 17:02, 6. Jun 2023
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hmm… what about weapon…
Tue, 05/03/2022 - 10:16

Hmm… what about weapon damage attribute commands? Is there a way to check the damage of a a tool in player’s main hand? Or can you only check how much damage you are about to deal?

Last seen on 20:09, 15. Aug 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
if there is a procedure…
Tue, 05/03/2022 - 15:59

if there is a procedure block in item boxes that returns damage from an item stack

Last seen on 17:02, 6. Jun 2023
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hmm its not working because…
Tue, 05/03/2022 - 19:02

hmm its not working because there are no procedures for getting the weapon damage of an item, how would I do that with java code?

Last seen on 20:09, 15. Aug 2022
Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have searched for…
Wed, 05/04/2022 - 23:50

I have searched for information about this, but I have not found information on how to do it in code, if there is any way to do it by code in procedure, I would be interested in implementing a procedure block in my plugin that returns the damage of a weapon

Last seen on 17:02, 6. Jun 2023
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I actually did find a way of…
Thu, 05/05/2022 - 01:58

I actually did find a way of doing it, I used a plugin that allowed me to get the base attack damage attribute of the player, and I edited the code so that it gets the full attack damage which includes the weapon not just the base attack damage. 

Last seen on 17:02, 6. Jun 2023
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The plugin was called dtm’s…
Thu, 05/05/2022 - 02:00

The plugin was called dtm’s toolkit btw and I had to use an older version of mcreator.

Last seen on 20:34, 16. Apr 2024
Joined Dec 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There's a new plugin for…
Wed, 10/05/2022 - 01:15

There's a new plugin for this called Azzier's Tools or something that is for the newest edition