How can I make the amount of damage an item does change?

Started by littledude47 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I make the amount of damage an item does change?

I basically want my item to do more damage if a certain thing happens and can't find out how to do that

Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is possible through…
Wed, 08/26/2020 - 00:39

This is possible through procedures, but I guess it would depend on what triggers it.

If you do that certain thing, you could make a new variant of the item that takes more damage but has the same name (or not if you don't want it to have the same name). 

So for the procedure you could do <if> [?????] and the outcome would be "remove [item] from player inventory" and "add [more damage item] to player inventory"

If this is not the situation to use if blocks in that way, you could use the global triggers.

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
that could be useful in a…
Wed, 08/26/2020 - 01:12

that could be useful in a more "exact" type of damage changes but my idea is changing the damage based off the amount of health the entity using it has so that would mean I would have to make about 20 items to perfect it

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sometimes you have to make…
Wed, 08/26/2020 - 03:27

Sometimes you have to make 20 items to create one item. Such is the way of mcreator.

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I feel like it would create…
Wed, 08/26/2020 - 03:42

I feel like it would create a ton of compatibility issues if I were to do so, I might as well just delete what I have of the item

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't know why these…
Wed, 08/26/2020 - 05:05

I don't know why these others are telling you crazy ways to go about this. You don't need to create 20 different items to make one item that deals extra damage based on player health. As long as you're good with logic, math, and procedures, you can use the global trigger "on entity attacked" to check if the player is holding your custom item, then use the "deal (number) damage to entity" to deal extra damage on the hit. You can make that (number) vary depending on the player's health (which you can get with the block "get entities health". Doing whatever math you want to alter how much damage is done.

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
  what did I do wrong here?  
Wed, 08/26/2020 - 05:28

I think I did it wrong

 

what did I do wrong here?

 

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're close! When two…
Wed, 08/26/2020 - 06:01

You're close! When two entities are a part of a global trigger, the event/target entity tends to be the one the effect is happening to (in this case, the one being attacked), and the source entity is the one committing the act (in this case, the player holding the item and attacking). So in the Minecraft Components category, grab the "source entity" block, and replace all the event/target entity blocks other than the last one with the "source entity" block.

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
wait I didn't know a source…
Wed, 08/26/2020 - 06:07

wait I didn't know a source entity block existed, that changes a lot

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ok i'm not sure whats up…
Wed, 08/26/2020 - 06:28

ok i'm not sure whats up with it but for some reason it still does nothing, it'll just do the default damage the item has set

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it is the exact same as the…
Wed, 08/26/2020 - 16:26

it is the exact same as the last one but with source entities instead

https://imgur.com/a/VGnvJDh

Is it supposed to be called by anything external to work? i'm not sure what i'm doing wrong

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use the “send message” block…
Wed, 08/26/2020 - 17:21

Use the “send message” block to send a message to yourself (essentially logging the procedure) to test if all values are being set properly, and if the procedure is even running. So send the max health and current health to yourself inside that if block to see if those are correct, and if the statement is even running. 

Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ok I tried that and the…
Wed, 08/26/2020 - 18:24

ok I tried that and the procedure I guess just isn't being sent whatsoever, I don't think the actual global trigger is working because even a blank one with only the send message doesn't even work