death.sk

Created by JayJayJay175

Other available versions. Ordered by newest to oldest versions:

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

on script load:
	loop {grave::*}:
		loop {grave::%loop-index-1%::*}:
			execute console command "particle minecraft:flash %x-coord of loop-value-2% %y-coord of loop-value-2% %z-coord of loop-value-2%"
			delete {grave::%loop-index-1%::%loop-value-2%}
			loop {grave::%loop-index-1%::%loop-value-2%::*}:
				drop loop-value-3 at loop-value-2
				loop-value-3 is not air
				wait 1 tick
			set block at loop-value-2 to air
			execute console command "particle minecraft:explosion %x-coord of loop-value-2% %y-coord of loop-value-2% %z-coord of loop-value-2%"
			delete {grave::%loop-index-1%::%loop-value-2%::*}
	delete {grave::*}
on death:
	victim is a player
	player's world is not "spawn"
	clear drops
	set {_n} to 0
	loop 36 times:
		add slot {_n} of player to {_inv::*}
		add 1 to {_n}
	add slot 40 of player to {_inv::*}
	add the helmet of player to {_inv::*}
	add the chestplate of player to {_inv::*}
	add the boots of player to {_inv::*}
	set {grave::%player%} to player
	set {_loc} to location of block at player
	if block at player is air:
		set block at player to skull of victim
		set {grave::%player%::%location of block at player%} to location of block at player
		add {_inv::*} to {grave::%player%::%location of block at player%::*}
		send "&cA grave was created at the location of your death." to victim
		loop 300 times:
			wait 1 second
			{grave::%player%::%{_loc}%} is not set
			stop
		send "&cYour grave has been broken automatically!" to player
		execute console command "particle minecraft:flash %x-coord of {_loc}% %y-coord of {_loc}% %z-coord of {_loc}%"
		delete {grave::%player%::%{_loc}%}
		loop {grave::%player%::%{_loc}%::*}:
			drop loop-value at {_loc}
			loop-value is not air
			wait 1 tick
		set block at {_loc} to air
		execute console command "particle minecraft:explosion %x-coord of {_loc}% %y-coord of {_loc}% %z-coord of {_loc}%"
		delete {grave::%player%::%{_loc}%::*}
		stop
	else:
		loop blocks in radius 2 around player:
			loop-block is air
			set loop-block to skull of victim
			set {grave::%player%::%location at loop-block%} to location of loop-block
			add {_inv::*} to {grave::%player%::%location at loop-block%::*}
			send "&cA grave was created at the location of your death." to victim
			loop 300 times:
				wait 1 second
				{grave::%player%::%location at loop-block%} is not set
				stop
			send "&cYour grave has been broken automatically!" to player
			execute console command "particle minecraft:flash %x-coord of {_loc}% %y-coord of {_loc}% %z-coord of {_loc}%"
			delete {grave::%player%::%location at loop-block%}
			loop {grave::%player%::%location at loop-block%::*}:
				drop loop-value-2 at location at loop-block
				loop-value-2 is not air
				wait 1 tick
			set block at location at loop-block to air
			execute console command "particle minecraft:explosion %x-coord of {_loc}% %y-coord of {_loc}% %z-coord of {_loc}%"
			delete {grave::%player%::%location at loop-block%::*}
			stop
	add {_inv::*} to {gravebad::%player%::*}
on respawn:
	{gravebad::%player%::*} is set
	give player {gravebad::%player%::*}
	delete {gravebad::%player%::*}
	message "&cThere was no room to create a grave, so your items were returned."
on break:
	loop {grave::*}:
		if player is loop-value-1:
			{grave::%player%::%event-location%} is event-location
			cancel event
			execute console command "particle minecraft:flash %x-coord of event-location% %y-coord of event-location% %z-coord of event-location%"
			delete {grave::%player%::%event-location%}
			loop {grave::%player%::%event-location%::*}:
				drop loop-value-2 at event-location
				loop-value-2 is not air
				wait 1 tick
			set block at event-location to air
			execute console command "particle minecraft:explosion %x-coord of event-location% %y-coord of event-location% %z-coord of event-location%"
			delete {grave::%player%::%event-location%::*}
		else:
			{grave::%loop-value-1%::%event-location%} is event-location
			cancel event
			message "&cYou can't break other people's graves!"