Since I drew inspiration from the help you gave that one random person, I wanted to know how this type of script would play out on a multiplayer server? @tropic steppe
ForgeEvents.onEvent('net.minecraftforge.event.entity.living.LivingHurtEvent', event => {
global.hurtEvent(event)
})
global.hurtEvent = event => {
const { amount, source: { actual }, source, entity } = event
if (entity.type == "minecraft:player" || entity.isMonster()) {
Utils.server.players.forEach(player => {
if (['inFire', 'lava', 'onFire', 'stalagmite', 'thorns', 'explosion.player', 'fall', 'explosion', 'starve', 'dehydrate', 'witherSkull', 'wither', 'magic', 'drown'].includes(source.getType())) {
let baseMultiplier = 1;
let healthMultiplier = entity.maxHealth;
baseMultiplier = player.persistentData?.coef ?? 1;
baseMultiplier = 1 + (baseMultiplier - 1) / 10;
let scaledDamage = ((Math.pow(amount, 0.4)) * baseMultiplier * (Math.pow(healthMultiplier, 0.29))).toFixed(1);
event.setAmount(scaledDamage);
}
})
}
}
For example, how would thinks play out, if 2 players were in the same world/server but they both had individual values of persistentData.coef which is a number between 1 - 20. Would the highest number have a higher priority, therefore always being in charge of the total scaledDamage?
How would I be able to make this only per-player?