Damage Indicator - ⚔ Display damage when attacking!

Script Damage Indicator - ⚔ Display damage when attacking! 1.0

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Supported Skript Version
  1. 2.8
Supported Minecraft Versions
  1. 1.20
DAMAGE-INDICATOR-03-05-2024.png

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)
Author
Palgia
Downloads
57
Views
151
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Palgia