Jump to content

I need help with a skript.


CoolAlex4734

Recommended Posts

Hi Everyone! I'm currently in progress of making an rpg server and I need help with a skript. I haven't made it but I will if I can get my answer! So, basically I want it so that when a mob spawns, for example a pig, it shows something like this, Pig - 10/10. The 10/10 means what health it is. I hope someone can help me!

-Alex

Always Stay Cool No Matter What! 😎 

Link to comment
Share on other sites

how are you spawning the entity?

if you are spawning the entity via skript, then this is what you should do

command /pig:
	trigger:
		spawn 1 pig at the player
		set {_health} to health of last spawned pig
		set the name of the last spawned entity to "Pig - %{_health} * 2%/10"

on damage of pig:
	set {_health} to health of victim
	set the name of victim to "Pig - %{_health} * 2%/10"

the reason you are multiplying the health variable is because the pig max hp is 5, so if you double the variable it doesnt change the hp of the pig but changes the name to 10/10, if that makes sense.

otherwise, you could just do 5/5 instead of 10/10

 

hope this helps

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...