Started by
s_crowe31
on
Topic category: Help with Minecraft modding (Java Edition)
I have a stat system in my mod and I want there to be a max energy. I thought I could do, if Energy > Intelligence*2 then Energy is no greater than or equal to Intelligence*2. But I can't even configure the modules like that. Please help! Here is the link to my screenshot of the procedure, thank you for your brain power!!!
https://www.dropbox.com/scl/fi/b3jav8mxhikmhw2sw8bib/Screenshot-2024-10…
You would use the set number block (which is a block below all the get number blocks of which you have used) and make it set Energy to [Intelligence*2] (in the case that energy is higher than intelligence).
The reason why your current setup isn't working is because you're trying to use a value, not a block. The difference between a value and a block is that a block is something in a chain of code which actually does things (e.g. replacing a mc block, or summoning an entity), whereas a value is something that you can use to tell blocks more specific info about what they should do (e.g. telling a set number block what value to set a variable to, or an if block the conditions that need to be met in order to continue with the flow that they have specified).
Hope this helped!
It doesn't allow me to put the floating piece of get number Energy < or = get number Int*2 inside of the Set number block, i should've specified that first, my bad! Thanks for the timely response.
What your asking for doesnt make sense. You cant set a number to be a limit.
If you want it so energy cant surpass intelligence^2:
I dont know why I thought it said ^2 when it said *2. But its the same thing.
Oh you mean i don't have to do < or = to INT because its redundant if i just make it Set Energy to INT*2?
I removed the if statement as well and did what you said and it's working! Thanks a bunch for your time! If you have the chance maybe check out my other post about how to make percentage based mana bar, Thanks Again BUNCHES!
OH WAIT I don't even have a post about that rip i'll post one later
Now that I have done this, my energy drain item cannot drain the energy below INT*2, I do need a max but I need it to be able to fluctuate as well
The procedure above should only force the energy value to be at 2*int if its above 2*int. If for some reason one of your other procedures is constantly feeding energy, e.g. making energy go above 2*int then thats the problem.
For any and all other procedures involving energy, you should add an IF clause to check whether energy is below 2*int. Or more easily just make another variable called max energy which is set to 2*int on tick update. Then you just check whether energy is below max energy to be able to add any energy. You might also want to check if energy is below 0 and then set it to 0 etc.