Numbers multiples of other numbers

Started by Agil on

Topic category: Help with modding (Java Edition)

Last seen on 14:15, 15. May 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Numbers multiples of other numbers
Fri, 03/18/2022 - 18:35 (edited)

Hi, im trying to make a variable called "level" that has to check the level of the player, and if it has a number multiple of 10 tigger an efect. Is there a way to do so? I cant figure out how to do it.

Edited by Agil on Fri, 03/18/2022 - 18:35
Last seen on 00:18, 12. Oct 2024
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I am not sure what you mean…
Sat, 03/19/2022 - 03:22

I am not sure what you mean exactly, but there is a procedure block for "get XP level of entity".

If you mean to check if the players level is 10 then do something like:

if get Xp level of entity = 10

do (what you wanted it to do)

Last seen on 14:15, 15. May 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What i want is: Every time…
Sat, 03/19/2022 - 23:17

What i want is:

Every time you gain 10 xp levels, add 1 level of the enchantment of the weapon in your main hand, if it has the enchantment Growth

Last seen on 00:18, 12. Oct 2024
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh i see, that is a bit more…
Sun, 03/20/2022 - 12:11

Oh i see, that is a bit more complex. I have never fiddled with enchanting in Mcreator but i know that it is possible to do that you are trying to do.

I think there are some enchanting tutorials on youtube and make use of get xp level procedures.

 

But for now, i cant help, hope you can figure something out, good luck!

Last seen on 14:15, 15. May 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, i use nbt to do the…
Sun, 04/24/2022 - 18:18

Yes, i use nbt to do the thing. Every level i get with the weapon in my hand it gain a nbt point, and when it reach 10, it add 1 level of the other enchantments wile the nbt points return to 0.

The only thing is the enchantment don replace the previous one, so i end with a swort with flame 1, flame 2, flame 3, etc XD

I have to figure out how to erase the previus enchantmen without erasin the new level...

Last seen on 05:05, 30. Oct 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can't you have the effect…
Sun, 04/24/2022 - 21:43

Can't you have the effect reference your current level whenever it triggers?

 

Effect level = ((Player Level / 10) truncate to 0 decimal places)

 

Not sure why there doesn't seem to be an easy way to truncate a number value via procedure blocks, but you can make a simple Custom Code snippet to do it.

The following truncates the value in local variable "vNumber" to 0 decimal places:

(Math.floor(vNumber * 1) / 1)