First and foremost: Apologies for creating threads close to each other time wise. Hopefully I won't have any other issues after this one... at least, for a few days.
Skript Version: Skript 2.2 (dev32d)
Skript Author: bensku
Minecraft Version: 1.12
Full Code:
What this skript essentially does is remove the death screen entirely and make a new death system. By adding to the death counter (which I don't know how to do yet; it's there so I don't forget to do it later) this skript acts like an actual death. The code is fine, but I've tested this skript several times in game and something unusual happened; the death screen showed for some deaths. From my tests, I found that if the player's health is equal to the amount of damage the mob deals, then the skript doesn't work (and death screen shows).
One test I did had a mob dealing 5 hearts of damage while I had 5 hearts left. The test was unsuccessful, and the death screen showed. I ran the test again, but this time I had 4 hearts. The skript worked on that test.
I am a beginner with Skript, so if the error I made is obvious, I apologize.
Note: I /killed myself in game and the skript worked.
Errors on Reload:
None
Console Errors: (if applicable)
None
Addons using (including versions):
None
Troubleshooting:
Have you tried searching the docs? Yes, it didn't offer much help on my case though
Have you tried searching the forums? Yes
What other methods have you tried to fix it? I've tried setting the line "less than or equal to 0" to "less than or equal to 0.1" but still had similar results.
Skript Version: Skript 2.2 (dev32d)
Skript Author: bensku
Minecraft Version: 1.12
Full Code:
code_language.skript:
on damage of player:
if (victim's health - damage) is less than or equal to 0:
cancel event
heal the victim
add 1 to {deathcounter}
#the following 2 lines are to make the player's screen twitch when they respawn
damage the victim by 0.01
heal the victim
execute console command "/execute %victim% ~ ~ ~ particle witchMagic ~ ~0.8 ~ 0.3 0.5 0.3 1 100"
execute console command "/execute %victim% ~ ~ ~ playsound entity.player.hurt master %victim% ~ ~ ~ 1 1 0"
wait 1 tick
#next line teleports the victim to spawn
execute console command "/minecraft:tp %victim% -34 66 -1 -90 0"
What this skript essentially does is remove the death screen entirely and make a new death system. By adding to the death counter (which I don't know how to do yet; it's there so I don't forget to do it later) this skript acts like an actual death. The code is fine, but I've tested this skript several times in game and something unusual happened; the death screen showed for some deaths. From my tests, I found that if the player's health is equal to the amount of damage the mob deals, then the skript doesn't work (and death screen shows).
One test I did had a mob dealing 5 hearts of damage while I had 5 hearts left. The test was unsuccessful, and the death screen showed. I ran the test again, but this time I had 4 hearts. The skript worked on that test.
I am a beginner with Skript, so if the error I made is obvious, I apologize.
Note: I /killed myself in game and the skript worked.
Errors on Reload:
None
Console Errors: (if applicable)
None
Addons using (including versions):
None
Troubleshooting:
Have you tried searching the docs? Yes, it didn't offer much help on my case though
Have you tried searching the forums? Yes
What other methods have you tried to fix it? I've tried setting the line "less than or equal to 0" to "less than or equal to 0.1" but still had similar results.