Jump to content

Do certain stuff at a certain HP level


pnguin

Recommended Posts

Hi there! So i need some help with skript! I made a sort of boss skript but idk how to make it like if the boss is at 25 hp it kills itself and turns into a slime

heres the skript

		spawn 1 zombie at {zombiespawn}
		set max health of last spawned zombie to 50
		set health of last spawned zombie to 50
		set name of last spawned zombie to "&c&lBOSS"

 

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

You could use a while loop and make it while that mob is alive, check for the it's health. And if it is lower than 25 health, kill it and replace it with a slime. Don't forget a delay in the while loop or your server will crash. 

  • Confused 1

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

11 hours ago, _Tarna_ said:

You could use a while loop and make it while that mob is alive, check for the it's health. And if it is lower than 25 health, kill it and replace it with a slime. Don't forget a delay in the while loop or your server will crash. 

Soz for the late response how am i supposed to do that?

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

12 hours ago, _Tarna_ said:

You could use a while loop and make it while that mob is alive, check for the it's health. And if it is lower than 25 health, kill it and replace it with a slime. Don't forget a delay in the while loop or your server will crash. 

Heres the code if it helps

command /mayorfight:
	trigger:
		make console execute "/time set night"
		make console execute "/npc remove 8"
		play sound "ENTITY_ENDERMAN_TELEPORT" with volume 1 and pitch 1 to all players
		play sound "ENTITY_ENDER_DRAGON_AMBIENT" with volume 1 and pitch 1 to all players
		wait 10 seconds
		teleport all players to {spawn}
		broadcast "&a&lGuard&a: Where is the mayor?"
		wait 5 seconds
		broadcast "&a&lGuard&a: Yes where has the mayor gone to?"
		wait 20 seconds
		play sound "ENTITY_ENDER_DRAGON_AMBIENT" with volume 2 and pitch 1 to all players
		broadcast "&6&lMayor Jimmy&6: I have finally awakened"
		play sound "ENTITY_ZOMBIE_BREAK_WOODEN_DOOR" with volume 2 and pitch 1 to all players
		wait 5 seconds
		play sound "ENTITY_ENDER_DRAGON_AMBIENT" with volume 2 and pitch 1 to all players
		broadcast "&6&lMayor Jimmy&6: With this power..."
		play sound "ENTITY_ZOMBIE_BREAK_WOODEN_DOOR" with volume 2 and pitch 1 to all players
		wait 5 seconds
		play sound "ENTITY_ENDER_DRAGON_AMBIENT" with volume 2 and pitch 1 to all players
		broadcast "&6&lMayor Jimmy&6: I can become a GOD"
		play sound "ENTITY_ZOMBIE_BREAK_WOODEN_DOOR" with volume 2 and pitch 1 to all players
		wait 5 seconds
		play sound "ENTITY_ENDER_DRAGON_AMBIENT" with volume 2 and pitch 1 to all players
		broadcast "&6&lMayor Jimmy&6: You should prepare while you have the chance to >:)"
		play sound "ENTITY_ZOMBIE_BREAK_WOODEN_DOOR" with volume 2 and pitch 1 to all players
		wait 5 seconds
		play sound "ENTITY_ENDER_DRAGON_AMBIENT" with volume 2 and pitch 1 to all players
		broadcast "&6&lMayor Jimmy&6: And may god have mercy with you..."
		play sound "ENTITY_ZOMBIE_BREAK_WOODEN_DOOR" with volume 2 and pitch 1 to all players
		wait 5 seconds
		play sound "ENTITY_ENDER_DRAGON_AMBIENT" with volume 2 and pitch 1 to all players
		broadcast "&6&lMayor Jimmy&6: GOONS ATTACK"
		play sound "ENTITY_ZOMBIE_BREAK_WOODEN_DOOR" with volume 2 and pitch 1 to all players
		make console execute "/smiteall"
		make console execute "/smiteall"
		wait 3 ticks
		summon 10 adult zombies at {spawn}
		summon 10 adult zombies at {skeletonspawn}
		summon 10 adult zombies at {skeletonspawn1}
		set max health of all zombies to 20
		set health of all zombies to 20
		set displayname of all zombies to "&4&l&kD &c&lGOON &4&l&kD"

 

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

Just now, pizzaschut said:

Its so funny that this topic has 41 views and most people who viewed this just came here to steal the skript

Honestly I opened this post but there was such a big skript that I couldn't be bothered to check it out and see what it is lel.

Also, I think you can use this to check for a monster's health:

health of %living entities%

or

%living entities%'[s] health

for something like:

on command /test:
    trigger:
        spawn 1 zombie at location of player

while zombie's health >= 0:
    wait 1 second
    broadcast "hehehe"

I didn't test this so I don't know how it'll work, but in theory i think it should work.

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to comment
Share on other sites

9 minutes ago, BanditEagle said:

Honestly I opened this post but there was such a big skript that I couldn't be bothered to check it out and see what it is lel.

Also, I think you can use this to check for a monster's health:

health of %living entities%

or

%living entities%'[s] health

for something like:


on command /test:
    trigger:
        spawn 1 zombie at location of player

while zombie's health >= 0:
    wait 1 second
    broadcast "hehehe"

I didn't test this so I don't know how it'll work, but in theory i think it should work.

I have a error 2021-04-26_14_48_10.thumb.png.c098ba2f1be57e73a332b719a53592a2.png

I used to play Minehut I guess?
Yeah, I still watch the forums for some reason. (15/5/2023)
Link to comment
Share on other sites

2 hours ago, BanditEagle said:

Honestly I opened this post but there was such a big skript that I couldn't be bothered to check it out and see what it is lel.

Also, I think you can use this to check for a monster's health:

health of %living entities%

or

%living entities%'[s] health

for something like:


on command /test:
    trigger:
        spawn 1 zombie at location of player

while zombie's health >= 0:
    wait 1 second
    broadcast "hehehe"

I didn't test this so I don't know how it'll work, but in theory i think it should work.

That wouldn't work since the while loop isn't in any event and that is not how you make a command either.

 

3 hours ago, pizzaschut said:

Btw: I dont mind if anyone gives me an example i'd appreciate that too

 

command /test:
	trigger:
		spawn zombie at player
		set {_z} to last spawned zombie
		while {_z} is alive:
			wait 1 second
			if {_z}'s health < 25:
				spawn slime at {_z}
				kill {_z}

I have not tested this but according to a parser I use, it has no errors. But it should look something like this.

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

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...