How to make a Max on a Variable based off another Variables Value?

Started by s_crowe31 on

Topic category: Help with modding (Java Edition)

Last seen on 05:36, 9. Oct 2024
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a Max on a Variable based off another Variables Value?

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…

Last seen on 08:16, 9. Oct 2024
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You would use the set number…
Wed, 10/09/2024 - 08:16

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!