#Add damage to current damage?
1 messages · Page 1 of 1 (latest)
ive tried somthing like this but it just feels off
system.waitTicks(10).then(() => {
target.applyDamage(2, { cause: "entityAttack" })
});
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)
No no, hang on.
Documentation for @minecraft/server
Use this to apply the final damage.
oh-
aint this the same thing tho
idk how dis works
Set the ev.damage = 50 to make the final damahe 50.
Dont need to use systme.run
is there a way i can add on to the damage of the sword instead of it being 1 value?
I dont follow.
ev.damage = ev.damage + 100?
nvm ty