As per the title. I'm trying to implement a modified version of the Libra skill (as seen in this link, although the version posted there does not work either). The modifications include checking for notetags to see for example if said enemy is a spider, moving some sections to the message's name box, making it work through an action sequence instead, and adding commas if there is more than one weakness, resist, immune or absorb. These all play out fine. However, with both my modifications and the original post in the link above, the message will always say the targeted enemy does not absorb any elements (defined by VisuStella's element/status core with the note tag Element Absorb: ID or name, I'm also using the majority of their other plugins although I don't think most of them have any effect on absorptions), while my test boss is definitely tagged with
Neither of these make any changes. Below are my modifications:
Could anyone help me figure out what the issue is?
(edit: For clarity, the console.log always returns an empty string, and Absorb in the message window defaults to Nothing for some reason.)
JavaScript:
<Element Absorb: 4>
//alternatively
<Element Absorb: Shock>
JavaScript:
if ($target.isEnemy()) {
const id = $target._enemyId;
$gameSystem.registerDefeatedEnemy(id);
}
let whodis = $target.name() + '\\}';
if ($target.meta.spider) { whodis += '\\c[0]\\i[0]\\i[1829] Arachnid'}
whodis += '\\c[0]\\i[0]\\i[1827] ' + $target.hp;
whodis += '/' + $target.mhp;
whodis += '\\c[0]\\i[0]\\i[1818] ' + $target.mp;
whodis += '/' + $target.mmp;
$gameMessage.setSpeakerName(whodis);
let text = '';
text += ' \\>\\c[4]Power:\\c[0] ' + $target.atk;
text += '\\i[0]\\c[4]Armor:\\c[0] ' + $target.def;
text += '\\i[0]\\c[4]Healing:\\c[0] ' + $target.mat;
text += '\\i[0]\\c[4]Fortune:\\c[0] ' + $target.mdf;
text += '\\i[0]\\c[4]Speed:\\c[0] ' + $target.agi + '<br>';
$gameMessage.add(text);
let weakness = '';
let resist = '';
let immune = '';
let absorb = '';
let elements = $dataSystem.elements;
let weaknessLength = 0;
let absorbLength = 0;
let immuneLength = 0;
let resistLength = 0;
for (let i = 1; i < elements.length; ++i) {
const name = elements[i];
const rate = $target.elementRate(i);
if (rate > 1) {
if (weaknessLength > 0) {
weakness += ', ';
}
weakness += name;
weaknessLength += 1;
} else if (rate < 0) {
if (absorbLength > 0) {
absorb += ', ';
}
absorb += name + ' ';
absorbLength += 1;
} else if (rate === 0) {
if (immuneLength > 0) {
immune += ', ';
}
immune += name;
immuneLength += 1;
} else if (rate < 1) {
if (resistLength > 0) {
resist += ', ';
}
resist += name;
resistLength += 1;
}
}
console.log(absorb);
if (weakness === '') weakness = 'Nothing';
if (resist === '') resist = 'Nothing';
if (immune === '') immune = 'Nothing';
if (absorb === '') absorb = 'Nothing';
weakness = '\\>\\c[4]Weak to:\\c[0] ' + weakness;
resist = '\\i[0]\\c[4]Resists:\\c[0] ' + resist + '<br>';
immune = ' \\>\\c[4]Immune to:\\c[0] ' + immune;
absorb = '\\i[0]\\c[4]Absorbs:\\c[0] ' + absorb;
text = weakness + resist + immune + absorb;
$gameMessage.add(text);
Could anyone help me figure out what the issue is?
(edit: For clarity, the console.log always returns an empty string, and Absorb in the message window defaults to Nothing for some reason.)