Is it possible to make an Item that if in inventory or worn you get one heart deleted? If yes how?

Started by LOLBroSave on

Topic category: Help with modding (Java Edition)

Last seen on 15:55, 22. Oct 2024
Joined Oct 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is it possible to make an Item that if in inventory or worn you get one heart deleted? If yes how?

So I’m very new at this. I wanted to make an Item if you have it in inventory or as armor you get one heart deleted, but you get strenght. I know how to give effects, but I dont´t know how to delete hearts for example from 10 to 9 hearts(so you canˋt regenerate the heart), I would like to do it that it could stack, so if I have two of it I get two hearts deleted (not the Item should stack, the heart delete should stack) It would be very nice to get some help. Thanks in advance :)

Last seen on 17:20, 22. Oct 2024
Joined Oct 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is one way I am…
Tue, 10/22/2024 - 17:20

There is one way I am working on I will reply when finished

Last seen on 17:37, 22. Oct 2024
Joined Oct 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Event Trigger set number …
Tue, 10/22/2024 - 17:30

Event Trigger

set number  Local: Number(VariableName) to 0

if has entity/player in inventory (Your damage item)

       repeat 27 times (one per inventory slot)

               if get copy of item in slot (Number) of entity/player if it has inventory =  (Your item) these blocks are red.

                      set local number NumberofItems(Number of damage items) NumberofItems + 1

                      set local number Number to Number +  1

                else 

                       set local number Number to Number + 1

        set health of entity/player to [(max health of entity/player) - (get local number NumberOfItems)]

 

 

This section of code is not tested so I have no idea if it works but it should.

Hope this helps