# 0 = fall, 1 = lava, 2 = void, 3 = tnt minecart, 4= slime block bounce, 5= out of map, 6= minecart, 7=fangs, 8=rising water, 9 =witch

scoreboard players set @a deathCause 0
execute at @s if block ~ ~ ~ lava run scoreboard players set @s deathCause 1
scoreboard players set @a[scores={death=1..,inVoid=1..}] deathCause 2
scoreboard players set @a[scores={death=1..,tntMinecartDeath=1..}] deathCause 3
scoreboard players set @a[scores={death=1..,bounceDeath=1..}] deathCause 4
scoreboard players set @a[scores={death=1..,outOfMapDeath=1..}] deathCause 5
execute as @a[scores={death=1..}] at @s if entity @e[type=minecart,name=lvl26Minecart,distance=..2] run scoreboard players set @s deathCause 6
execute as @a[scores={death=1..}] at @s if entity @e[type=evoker_fangs,distance=..2] run scoreboard players set @s deathCause 7
execute as @a[scores={death=1..,level=37}] at @s if block ~ ~ ~ water run scoreboard players set @s deathCause 8
execute as @a[scores={death=1..,level=37}] at @s if block ~ ~ ~ #parkour_pyramid:waterlogged[waterlogged=true] run scoreboard players set @s deathCause 8
execute as @a[scores={death=1..,level=37}] at @s if block ~ ~ ~ seagrass run scoreboard players set @s deathCause 8
execute as @a[scores={death=1..,level=20}] at @s if entity @e[type=witch,distance=..3] run scoreboard players set @s deathCause 9

scoreboard players reset @a tntMinecartDeath
scoreboard players reset @a bounceDeath
scoreboard players reset @a outOfMapDeath