- Supported Skript Version
- 2.8
- Supported Minecraft Versions
- 1.20
A very simple Skript which displays damage when you attack.
SkBee is required!
Code:
#
#ADDONS REQUIRED: SKBEE
#
options:
display: "&c{dmg}"
alive-time: 15 ticks
#
#Summon holo with damage value
#If random set to true, x, y and z axis will have a random value
#
function DamageIndicator_SummonHoloAtLocation(location: location, damage: integer, random: boolean=false):
set {_summon} to a text display
if {_random} is false:
summon a text display at {_location}
else:
set {_x} to random integer between (x-coords of {_location}+0.7) and (x-coords of {_location}-0.7)
set {_y} to random integer between (y-coords of {_location}+0.7) and (y-coords of {_location}-0.7)
set {_z} to random integer between (z-coords of {_location}+0.7) and (z-coords of {_location}-0.7)
summon a text display at location({_x}, {_y}, {_z})
set {_summon} to last spawned text display
set {_display} to {@display}
replace all "{dmg}" with "%{_damage}%" in {_display}
set display text of {_summon} to formatted {_display}
set display billboard of {_summon} to center
wait {@alive-time}
kill {_summon}
#
#Summon holo with a custom display (use {dmg} as a placeholder for damage)
#If random set to true, x, y and z axis will have a random value
#
function DamageIndicator_SummonCustomHoloAtLocation(location: location, damage: integer, display: string="&c{dmg}" random: boolean=false):
set {_summon} to a text display
if {_random} is false:
summon a text display at {_location}
else:
set {_x} to random integer between (x-coords of {_location}+0.7) and (x-coords of {_location}-0.7)
set {_y} to random integer between (y-coords of {_location}+0.7) and (y-coords of {_location}-0.7)
set {_z} to random integer between (z-coords of {_location}+0.7) and (z-coords of {_location}-0.7)
summon a text display at location({_x}, {_y}, {_z})
set {_summon} to last spawned text display
replace all "{dmg}" with "%{_damage}%" in {_display}
set display text of {_summon} to formatted {_display}
set display billboard of {_summon} to center
wait {@alive-time}
kill {_summon}
#
#
#
on damage:
attacker is a player
event is not cancelled
DamageIndicator_SummonHoloAtLocation(block above location of victim, final damage, true)