Closed paulo-roger closed 2 years ago
This worked:
let systemSkills = game.dnd5e.config.skills;
let filtered = {};
filtered = game.actors.filter(a => (a.collectionName === 'actors') === true);
const keys = Object.keys(filtered);
const total = keys.length;
keys.forEach((key, index) => {
let actor = filtered[key];
let updatedDataSkills = {}, skillKeys = {};
console.log('cleaning ACTOR:', actor);
let actorSkills = actor.data.data.skills;
// we need to find what actual actor skills and abilities comes from this module.
if (typeof actorSkills !== 'undefined') // could be undefined in case of vehicles
skillKeys = Object.keys(actorSkills).filter(k => k.startsWith('cus_'));
// here we store a list of keys representig properties we don't need anymore on actors.
let skillsToRemove = [];
// prepare data to remove leftover skills
for (let s = 0; s < skillKeys.length; s++) {
let skillKey = skillKeys[s];
skillsToRemove.push(skillKey);
}
//we use foundry "-=" syntax to erase old properties
skillsToRemove.forEach(key => updatedDataSkills[`data.skills.-=${key}`] = null);
// prepare the update actor data
let updatedData = {
...updatedDataSkills
};
// finally update this actor
actor.update(updatedData);
})
don't get it..
For some reason this modules was conflicting with my 'booming blade' macro (booming blade is a spell from dnd5e). I know they were conflicting after running 'find culprit' module. then I proceed to unistall 'dnd5e custom skill' and followed the steps in the readme to remove the custom skills (i had added two, thus 'cus_0' and 'cus_1')
running the reset option from the module settings wasn't working for me, so I read through your code and did the macro above (which was particular hard for me, because I am still learning JS). And that worked, now the two 'cus_' skills wont show anymore under 'data.skills' anymore.
Reseting wont remove all skills from actor data
Tried several times now following every step as in the readme.md
could you help me please?