Started by
OliB2012
on
Topic category: Help with Minecraft modding (Java Edition)
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?
Topic category: Help with Minecraft modding (Java Edition)
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?
Doesn't this work?
I tried that
its soposed to do damage every 60 ticks and when I do that it waits 60t the does 19 damage
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.