My goal is to make a pig have its name and its lvl displayed on the same text
but to do this I need to combine "name" and "its lvl"
is there any way that I can take both variables and put them in one string
Additional Info
I am right now taking the pigs name from a sign and its lvl from a different one
I can put one name on the pig but not both
on a multiplayer server,
1.16 is my version, i am in java
my end goal is I'm also trying to make a hypixel skyblock health system if you are wondering
Best Answer
You can simply do this by using this command:
This command will spawn a pig with the name and level you choose, although this will not change the pig itself, only its name, the pig will remain the same as it would be if you spawned it with a spawn egg. If you want to change the pigs health and other attributes you can do this with this command:
This command simply adds an effect to the pig that boosts its health for an infinite amount of time where, {health amount} is the number put you can input to change the health, the number has to be between 1 and 255, you can also change the id to another effect or add one using this template, you just have to know the effect id, which you can easily find on the internet, or more simply use a command generator.
If you want to change the color of the pig's name and level just put this in the name slot:
If you want to change the name for both the name and level use this:
Ex:
Finally since you are on a server, you can add plugins that can do this for you, the plugins will have much more configurations for the mob, (such as showing the mobs current health).
Notice: I haven't yet tested if the color works, but if it doesn't you can just use the first and/or second command.
Hope this helps! If you have any questions feel free to ask me!
(Also this is my first time doing this)