Started by
Pepper
on
Topic category: Help with Minecraft modding (Java Edition)
I have been trying to make every mob drop these hearts that heal you (and that works) and i made the possibility to drop 1 or 2 hearts (which also works) BUT for some reason, i cant make it drop NO hearts. its always either a heart or the golden heart. please help me.
Edited by Pepper on Sat, 05/08/2021 - 21:43
Don't know if it's the cause, but the golden heart's "Else If" you put tells the game to drop the golden heart when the number is above 0.01, which is common enough to happen once in 100 kills, shouldn't be the other way around? instead of > it should be <.
I will tell you 3 things:
- every time you use random give it a different value, if you want the whole procedure to use the same value of "random" use local variable.
- The delay time is how long the gem will be on the ground, if you set it to one it will disappear very fast.
- do not use "if" inside "if" because it causes errors.
Donagao, can you clarify? also the delay time is how long it takes before you can pick it up, and the ifs inside of ifs work just fine for me.
Every time the procedure runs into a Random (0, 1] block, it picks an entirely new value for it. It does not save the value for the first random block it found. So essentially each drop possibility is being tested from a different number. What you need to do instead is create a variable, call it whatever you want. Then at the beginning of the procedure, set it to Random (0, 1]. Then use the variable itself instead of the regular Random blocks in your conditions.
Some of those random blocks are probable not even firing off.