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

Started by littledude47 on

Topic category: Help with Minecraft modding (Java Edition)

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
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

Active 4 years ago
Joined Feb 2020
Points:
924

User statistics:

  • Modifications: 1
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 404
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.

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
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

Active 4 years ago
Joined Apr 2020
Points:
789

User statistics:

  • Modifications: 0
  • Forum topics: 19
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 132
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.

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
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

Active 1 month ago
Joined Jun 2020
Points:
728

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 1
  • Comments: 137
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.

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

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

I think I did it wrong

 

what did I do wrong here?

 

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
https://imgur.com/a/dxsaIXX…
Wed, 08/26/2020 - 05:28

https://imgur.com/a/dxsaIXX

since the last comment I sent didn't send the image ill just send this

Active 1 month ago
Joined Jun 2020
Points:
728

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 1
  • Comments: 137
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.

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
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

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
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

Active 1 month ago
Joined Jun 2020
Points:
728

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 1
  • Comments: 137
Screenshot your new…
Wed, 08/26/2020 - 07:20

Screenshot your new procedure?

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
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

Active 1 month ago
Joined Jun 2020
Points:
728

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 1
  • Comments: 137
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. 

Active 4 years ago
Joined Jan 2016
Points:
800

User statistics:

  • Modifications: 0
  • Forum topics: 15
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 29
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