Repeat amount of max health [solved]

Started by OliB2012 on

Topic category: Help with Minecraft modding (Java Edition)

Active 5 months ago
Joined Apr 2022
Points:
480

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
Repeat amount of max health [solved]
Fri, 02/21/2025 - 12:38 (edited)

Hello. I'm trying to make a custom prodocure that will cause a piece of code to repeat the amount of times that the current hp is at. Anyone know how?

Edited by OliB2012 on Fri, 02/21/2025 - 12:38
Active 7 hours ago
Joined Dec 2014
Points:
1359

User statistics:

  • Modifications: 0
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1221
Doesn't this work?
Thu, 11/07/2024 - 13:14

Doesn't this work?

Active 5 months ago
Joined Apr 2022
Points:
480

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
I tried that
Thu, 11/07/2024 - 21:21

I tried that

Active 5 months ago
Joined Apr 2022
Points:
480

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
its soposed to do damage…
Thu, 11/07/2024 - 21:25

its soposed to do damage every 60 ticks and when I do that it waits 60t the does 19 damage

Active 3 hours ago
Joined Apr 2023
Points:
720

User statistics:

  • Modifications: 5
  • Forum topics: 24
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 559
This is due to how the wait…
Thu, 11/07/2024 - 22:31

This is due to how the wait block works. Putting a wait block in a repeat 20 times(or repeat health times if health=20) block triggers the wait 20 times at once, each trigger waits 60 ticks, but as they all start at the same time, they all finish at the same time.

Explanation aside, there is a solution.

First you need to create a local number variable called 'delay'

Second, you need to switch the '60' in wait 60 ticks to be 'delay' for wait 'get number variable delay' ticks

Third, you need to put a 'set number variable' block before the wait block but still in the repeat block.

Fourth, configure the 'set number variable' block to set 'delay' to 'delay' + 60, by using the math block for addition and then setting 'delay' in one side and the '0' block configured to be '60' instead in the other.

That should accomplish the desired effect.

Active 5 months ago
Joined Apr 2022
Points:
480

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
Thank you it worked
Fri, 02/21/2025 - 12:38

Thank you it worked