jbtwist

Veteran
Veteran
Joined
Jun 4, 2017
Messages
49
Reaction score
6
First Language
Spanish
Primarily Uses
RMMV
Hi guys, while developing my game i noticed that yanfly's libra skill works great, but doesn't shows to the player the status resistences from enemies. I would like to fix that. But i can't.

I've been searching through the code to find the way to check enemies status resiscences, and i found this method: target.stateResistSet();

This returns an array with all id's an enemie can resist.

Now, i need to change that id to text and just show it, but here is where i cant continue.

Ive used $dataStates on the debug console and ive saw its content, which is an Object array that contains all status in the game.

Using on console $dataStates[id].name, the console returns the name of that status, but when I use it on the skill, the game crashes.

Can some1 to help me on this?
 

jbtwist

Veteran
Veteran
Joined
Jun 4, 2017
Messages
49
Reaction score
6
First Language
Spanish
Primarily Uses
RMMV
ok, on the discord server some1 resolved this, so im gonna post that code with some corrections to be used by any1:

Code:
<Before Eval>
if (target.isEnemy()) {
var id = target._enemyId;
$gameSystem.addHpGaugeEnemy(id);
var centinela1 = true;
var centinela2 = true;

var text = target.name() + '\n';
text += '\\px[100]\\c[4]HP:\\c[0] ' + target.hp;
text += '/' + target.mhp;
text += '\\px[400]\\c[4]MP:\\c[0] ' + target.mp;
text += '/' + target.mmp;
text += '\\px[700]\\c[4]TP:\\c[0] ' + target.tp;
text += '\n';
text += '\\px[100]\\c[4]ATK:\\c[0] ' + target.atk;
text += '\\px[400]\\c[4]MAT:\\c[0] ' + target.mat;
text += '\\px[700]\\c[4]AGI:\\c[0] ' + target.agi;
text += '\n';
text += '\\px[100]\\c[4]DEF:\\c[0] ' + target.def;
text += '\\px[400]\\c[4]MDF:\\c[0] ' + target.mdf;
text += '\\px[700]\\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 = 'Ninguna';
if (resist === '') resist = 'Ninguna';
if (immune === '') immune = 'Nada';
if (absorb === '') absorb = 'Nada';

weakness = '\\c[4]Debilidades:\\c[0] ' + weakness + '\n';
resist = '\\c[4]Resistencias:\\c[0] ' + resist + '\n';
immune = '\\c[4]Immune a:\\c[0] ' + immune + '\n';
absorb = '\\c[4]Absorbe:\\c[0] ' + absorb;
text = weakness + resist + immune + absorb;

$gameMessage.add(text);

// show state resistances
text = '\\c[4]Inmune a:\\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>
 
Last edited:

Xaygon

Villager
Member
Joined
Nov 8, 2018
Messages
11
Reaction score
1
First Language
German
Primarily Uses
RMMV
I tried using this but it was not compatible with my games.
I tried only copying the state part but it will only display: "c[4]Inmune a:"

Can you maybe show me the code without your changes? Maybe that remedies the problem.
 

Silva

Scoobityboo
Veteran
Joined
Nov 5, 2018
Messages
402
Reaction score
224
First Language
English
Primarily Uses
RMMV
You can find information about the original Yanfly Libra skill here.
 

Xaygon

Villager
Member
Joined
Nov 8, 2018
Messages
11
Reaction score
1
First Language
German
Primarily Uses
RMMV
The link to Yanfly´s Libra skill does not help me.
I was looking to make the Libra skill display state resistances as well as state weaknesses.
These were however not included in Yanfly´s original Libra skill.
 
Last edited:

jbtwist

Veteran
Veteran
Joined
Jun 4, 2017
Messages
49
Reaction score
6
First Language
Spanish
Primarily Uses
RMMV
Yeah, I noticed later, I am gonna update the code.

It doesn't work with GALV's Message Styles plugin, but I am working on fixing it
 

Latest Threads

Latest Profile Posts

Too bad the Boss Battle Build Bout isn't also for VXAce.
I might not participate in the Boss Battle contest after all... I have more important things to do, like Wishful Wanda. And of course the Dark Deception spinoff I plan to pitch, Demon Slayer.
Changed my avatar, goodbye Alan Sugar, hello George Carlin (one of my favorite human beings ever)
If you still don't subscribe our Polish channel please consider it :)
1.png
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.

Forum statistics

Threads
115,171
Messages
1,087,814
Members
149,724
Latest member
scurvyDan
Top