Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shield Equip Macro broken #349

Open
Reidsb opened this issue Jan 13, 2025 · 1 comment
Open

Shield Equip Macro broken #349

Reidsb opened this issue Jan 13, 2025 · 1 comment
Labels
broken macro bug Something isn't working

Comments

@Reidsb
Copy link

Reidsb commented Jan 13, 2025

seems like the newer version of 5e has broken this somehow.

@AnthonyVadala AnthonyVadala added bug Something isn't working broken macro labels Jan 13, 2025
@ChrisJCannon
Copy link

My fix for it was to change the equipped attribute to system.equipped. So for instance, I have a much more specific macro to simulate/cast shield of faith on myself. Hopefully this helps:

const itemName = 'FaithShield'; // <--- Change this to the *exact* item name (capitals count!)
const regShieldname = 'Shield';

if (!actor) {
    ui.notifications.warn('You need to select a token before using this macro!');
} else {
    // Get both items
    const myItem = await actor.items.getName(itemName);
    const regShield = actor.items.getName(regShieldname);
    if (myItem) {
        let item = actor.items.get(myItem.id);
        let regShieldItem = actor.items.get(regShield.id);
        let equipped = regShieldItem.system.equipped;

        // Cast "Shield of Faith"
        if (equipped) {
            const result = await dnd5e.documents.macro.rollItem("Shield of Faith");
        }
        
        await regShieldItem.update({ ["system.equipped"]: !equipped});
        await item.update({ ["system.equipped"]: equipped});
    } else {
        ui.notifications.warn("No item named '" + itemName + "' found on character!");
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
broken macro bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants