- Joined
- Nov 8, 2018
- Messages
- 11
- Reaction score
- 1
- First Language
- German
- Primarily Uses
- RMMV
Hey,
for my game I wanted to include somekind of scan skill. Yanflys Libra works already fairly well but I would like to know if it is possible to display status ailments in the same fashion as the element weaknesses and resistances are displayed in the libra skill.
Unfortunately states were not mentioned in Yanfly´s post: http://yanfly.moe/2015/12/02/tips-tricks-libra/
Here is the code that I am currently using I added some code that someone posted here that at least already displays states immunities. But like mentioned above I would prefer to display state weaknesses as well as states they are simply strong against not immune.
Anyways here is the code I am currently using (disregard the part about passive states).
for my game I wanted to include somekind of scan skill. Yanflys Libra works already fairly well but I would like to know if it is possible to display status ailments in the same fashion as the element weaknesses and resistances are displayed in the libra skill.
Unfortunately states were not mentioned in Yanfly´s post: http://yanfly.moe/2015/12/02/tips-tricks-libra/
Here is the code that I am currently using I added some code that someone posted here that at least already displays states immunities. But like mentioned above I would prefer to display state weaknesses as well as states they are simply strong against not immune.
Anyways here is the code I am currently using (disregard the part about passive states).
Code:
<Before Eval>
if (target.isEnemy()) {
var id = target._enemyId;
$gameSystem.addHpGaugeEnemy(id);
var text = target.name() + '\n';
text += '\\px[0]\\c[4]HP:\\c[0] ' + target.hp;
text += '/' + target.mhp;
text += '\\px[200]\\c[4]MP:\\c[0] ' + target.mp;
text += '/' + target.mmp;
text += '\\px[400]\\c[4]TP:\\c[0] ' + target.tp;
text += '\n';
text += '\\px[0]\\c[4]ATK:\\c[0] ' + target.atk;
text += '\\px[200]\\c[4]MAT:\\c[0] ' + target.mat;
text += '\\px[400]\\c[4]AGI:\\c[0] ' + target.agi;
text += '\n';
text += '\\px[0]\\c[4]DEF:\\c[0] ' + target.def;
text += '\\px[200]\\c[4]MDF:\\c[0] ' + target.mdf;
text += '\\px[400]\\c[4]LUK:\\c[0] ' + target.luk;
$gameMessage.add(text);
var weakness = '';
var resist = '';
var immune = '';
var absorb = '';
var elements = $dataSystem.elements;
for (var i = 1; i < elements.length; ++i) {
var name = elements[i];
var rate = target.elementRate(i);
if (rate > 1) {
weakness += name + ' ';
} else if (rate < 0) {
absorb += name + ' ';
} else if (rate === 0) {
immune += name + ' ';
} else if (rate < 1) {
resist += name + ' ';
}
}
if (weakness === '') weakness = 'None';
if (resist === '') resist = 'None';
if (immune === '') immune = 'None';
if (absorb === '') absorb = 'None';
weakness = '\\c[4]Weakness:\\c[0] ' + weakness + '\n';
resist = '\\c[4]Resist:\\c[0] ' + resist + '\n';
immune = '\\c[4]Immune:\\c[0] ' + immune + '\n';
absorb = '\\c[4]Absorb:\\c[0] ' + absorb;
text = weakness + resist + immune + absorb;
$gameMessage.add(text);
// show state resistances
text = '\\c[4]State Resistance:\\c[0]';
var stateResist = target.stateResistSet().map(function(stateId) { return $dataStates[stateId]; });
stateResist.forEach(function (state) {
text += "\t\t" + state.name + " ";
// Adds line jump if text is too long
if (text.length > 100 && centinela1 ){
text += "\n";
centinela1 = false;
}
});
$gameMessage.add(text);
// show passives
var passives = target.passiveStates().filter(function (state) {
return !state.meta.hiddenpassive;
});
var text = "\c[4]Estados Pasivos:\\c[0]";
if (passives.length > 0) {
passives.forEach(function (state) {
text += "\t\t" + state.description + "\n";
// Adds line jump if text is too long
if (text.length > 100 && centinela2 ){
text += "\n";
centinela2 = false;
}
});
} else {
text += " Ninguno";
}
$gameMessage.add(text);
}
</Before Eval>
