Started by
Agil
on
Topic category: Help with Minecraft modding (Java Edition)
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
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)
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
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!
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...
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: