#Add damage to current damage?

1 messages · Page 1 of 1 (latest)

surreal rain
#

using world.afterEvents.entityHitEntity i want to add +5 damage on top of a sword that does +8 damage. ive noticed that if the swords damage is higher than the damage the script gives it cancels it, does anyone know how i can fix this?

#

ive tried somthing like this but it just feels off

system.waitTicks(10).then(() => {
                    target.applyDamage(2, { cause: "entityAttack" })
                });
surreal rain
# white bison Use before entityhurt.

ive tried that and it doesnt work either

world.beforeEvents.entityHurt.subscribe(ev => {

    const player = ev.damageSource.damagingEntity;
    const damage = ev.damageSource.cause;
    const target = ev.hurtEntity;

    if (!player || !target) return;
    if (player.typeId !== "minecraft:player") return;

    const item = getHeldItem(player);
    if (!item) return;

    if (item.typeId === "minecraft:iron_sword") {
        system.run(() => {
            target.applyDamage(5, { cause: "entityAttack" })
        })
        world.sendMessage(`Damage: ${damage}`)
    }
});
#

the only time it works is when the applied damage it bigger than the swords damage (sorta)

surreal rain
#

oh-

surreal rain
#

idk how dis works

white bison
#

Dont need to use systme.run

surreal rain
white bison
#

ev.damage = ev.damage + 100?

surreal rain
#

nvm ty