#reading enchants on player

1 messages · Page 1 of 1 (latest)

golden mountain
#

is it possible to read what enchants the player has on their armour?

bold wagon
#

u can use this as a base

function getArmorProtection(player) {
    const listOfEquipmentSlots = ["Head", "Chest", "Legs", "Feet"];
    let totalProtLevel = 0
    for (let i = 0; i < listOfEquipmentSlots.length; i++) {
        const equipment = player.getComponent("equippable").getEquipment(listOfEquipmentSlots[i]);
        const protLevel = equipment?.getComponent("enchantable").getEnchantment(new EnchantmentType("protection"))?.level
        totalProtLevel += (protLevel*0.04)
    }

    return totalProtLevel;
}```