reddino21

https://forums.skunity.com/resources/hyperslib-cooldowns-small-caps-bossbars-unremovable-items-easy-vision-changing.1853/

📎 1 file 1,370 chars
📄
pasted-code-1775586520144.txt
txt 30 lines
▶
function TDamage(a: player, v: entity, d: number):
    add {_d} to {p::%uuid of {_v}%}
    {proc::%uuid of {_v}%} is not set
    set {proc::%uuid of {_v}%} to true
    set {_t} to {p::%uuid of {_v}%}
    delete {p::%uuid of {_v}%} and {proc::%uuid of {_v}%}
    if {_a} is in region "spawn":
        stop
    if {_v} is in region "spawn":
        stop
    if {_t} >= (health of {_v} + absorption amount of {_v}):
        make {_a} damage {_v} by 50
    else:
        play hurt animation on {_v}
        play sound "entity.generic.hurt" at {_v}
        set {_left} to {_t} - absorption amount of {_v}
        set absorption amount of {_v} to max(0, (absorption amount of {_v} - {_t}))
        if {_left} > 0:
            set health of {_v} to (health of {_v} - {_left})
    set {_kbDir} to vector from location of {_a} to location of {_v}
    set {_kbDir} to normalized {_kbDir}
    set velocity of {_v} to velocity of {_v} + ({_kbDir} * 0.4)
    if {_v} is a player:
        set saturation of {_v} to max(0, saturation of {_v} - ({_t} * 0.75))
        set food level of {_v} to max(0, food level of {_v} - ({_t} * 0.375))
    set {_duraDmg} to floor({_t} * {@armor_dura_mult})
    damage helmet of {_v} by {_duraDmg}
    damage chestplate of {_v} by {_duraDmg}
    damage leggings of {_v} by {_duraDmg}
    damage boots of {_v} by {_duraDmg}
Kodari AI
KodariApr 7 at 6:33 pm 51,389 (v2)

I’ll create a custom combat system based on the TDamage function you provided, with enhanced features and proper configuration.

TrueDamageSystem
A comprehensive custom damage system that bypasses Minecraft's default damage mechanics. Features true damage calculations with absorption support, custom knockback physics, armor durability scaling, saturation/hunger penalties, spawn region protection, and damage tracking. Includes configurable multipliers, combat logging, and admin tools for fine-tuning PvP balance. Perfect for RPG servers requiring precise damage control.

✅ TrueDamage System created successfully!

Created files:

  • truedamage-core.sk - Main damage system with custom calculations, absorption, knockback, and armor penalties

  • truedamage-examples.sk - Example weapons and abilities (True Blade sword, Fireball Staff, Ground Slam, Execute mechanic)

  • truedamage-admin.sk - Admin commands for testing and management (/tdamage, /combatlog)

  • truedamage-combat-tracker.sk - Combat logging prevention with 10-second combat tag

Installation:

  1. Place all .sk files in plugins/Skript/scripts/

  2. Run /sk reload all or restart server

  3. Grant permissions: truedamage.admin, truedamage.staff, truedamage.ability.groundslam

Dependencies: Requires WorldGuard for spawn region protection (optional - can remove region checks if not needed)

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
truedamage-admin.sk
truedamage-combat-tracker.sk
truedamage-core.sk
truedamage-examples.sk
Code
4 326
truedamage-admin.sk
# TrueDamage Admin Commands
# Management and testing tools for server administrators

options:
    prefix: &6[TDamage]&r
    admin_perm: truedamage.admin

command /tdamage [<text>] [<player>] [<number>]:
    permission: {@admin_perm}
    permission message: {@prefix} &cYou don't have permission to use this command!
    trigger:
        if arg-1 is not set:
            send "{@prefix} &7TrueDamage Admin Commands:"
            send "&e/tdamage deal <player> <amount> &7- Deal true damage to player"
            send "&e/tdamage setmult <player> <multiplier> &7- Set damage multiplier"
            send "&e/tdamage clearmult <player> &7- Clear damage multiplier"
            send "&e/tdamage info <player> &7- View player combat info"
            send "&e/tdamage test &7- Test damage on nearest entity"
            send "&e/tdamage reload &7- Reload TrueDamage scripts"
            stop
        
        if arg-1 is "deal":
            arg-2 is set
            arg-3 is set
            arg-2 is online
            TDamage(player, arg-2, arg-3)
            send "{@prefix} &7Dealt &c%arg-3% &7true damage to &e%arg-2%&7!" to player
            send "{@prefix} &c%player% &7dealt &c%arg-3% &7true damage to you!" to arg-2
            stop
        
        if arg-1 is "setmult":
            arg-2 is set
            arg-3 is set
            arg-2 is online
            setTrueDamageMultiplier(arg-2, arg-3)
            send "{@prefix} &7Set &e%arg-2%&7's damage multiplier to &c%arg-3%x&7!" to player
            send "{@prefix} &7Your damage multiplier is now &c%arg-3%x&7!" to arg-2
            stop
        
        if arg-1 is "clearmult":
            arg-2 is set
            arg-2 is online
            clearTrueDamageMultiplier(arg-2)
            send "{@prefix} &7Cleared &e%arg-2%&7's damage multiplier!" to player
            send "{@prefix} &7Your damage multiplier has been reset!" to arg-2
            stop
        
        if arg-1 is "info":
            arg-2 is set
            arg-2 is online
            set {_mult} to getTrueDamageMultiplier(arg-2)
            set {_lastAttacker} to {truedamage.lastattacker::%uuid of arg-2%}
            set {_lastTime} to {truedamage.lastattack::%uuid of arg-2%}
            send "{@prefix} &7Combat Info for &e%arg-2%&7:" to player
            send "&7Damage Multiplier: &c%{_mult}%x" to player
            send "&7Last Attacker: &e%{_lastAttacker} ? {_lastAttacker} : "None"%&7" to player
            send "&7Last Attack: &e%difference between now and {_lastTime} ? difference between now and {_lastTime} : "Never"% ago" to player
            send "&7Health: &c%health of arg-2%&7/&c%max health of arg-2%" to player
            send "&7Absorption: &6%absorption amount of arg-2%" to player
            stop
        
        if arg-1 is "test":
            set {_target} to target entity of player
            {_target} is set
            send "{@prefix} &7Testing 5 true damage on &e%{_target}%&7..." to player
            TDamage(player, {_target}, 5)
            send "{@prefix} &aTest complete!" to player
            stop
        
        if arg-1 is "reload":
            make console execute command "/sk reload truedamage-core"
            make console execute command "/sk reload truedamage-examples"
            make console execute command "/sk reload truedamage-admin"
            send "{@prefix} &aReloaded all TrueDamage scripts!" to player
            stop
        
        send "{@prefix} &cInvalid argument! Use /tdamage for help." to player

command /combatlog [<offline player>]:
    permission: {@admin_perm}
    permission message: {@prefix} &cYou don't have permission to use this command!
    trigger:
        if arg-1 is not set:
            set {_target} to player
        else:
            set {_target} to arg-1
        send "{@prefix} &7Combat log for &e%{_target}%&7:" to player
        send "&7Last Attacker: &e%{truedamage.lastattacker::%uuid of {_target}%} ? {truedamage.lastattacker::%uuid of {_target}%} : "None"%&7" to player
        send "&7Last Attack: &e%difference between now and {truedamage.lastattack::%uuid of {_target}%} ? difference between now and {truedamage.lastattack::%uuid of {_target}%} : "Never"% ago" to player

on load:
    send "{@prefix} &aTrueDamage Admin Commands loaded!" to console