Hi, im not expert in javascript programing but i am working with a selfmade plugin code using AI, this plugin should work with SRD_SuperToolsEngine.js.
The thing is in the following capture:
This is my skill scene and i would like to simply show the actor status, skill description at right and the skill list in bottom using two rows to display it...
The problem is that the skills arent being properly listed on and it is just empty.
The skills has been previously configured in the data base of rpg maker mv and assigned to the actor but not even one are showing up...
This is my plugin code:
I would appreciate a little help here 🙂
The thing is in the following capture:
This is my skill scene and i would like to simply show the actor status, skill description at right and the skill list in bottom using two rows to display it...
The problem is that the skills arent being properly listed on and it is just empty.
The skills has been previously configured in the data base of rpg maker mv and assigned to the actor but not even one are showing up...
This is my plugin code:
JavaScript:
(function() {
function Window_SkillStatus() {
this.initialize.apply(this, arguments);
}
Window_SkillStatus.prototype = Object.create(Window_Base.prototype);
Window_SkillStatus.prototype.constructor = Window_SkillStatus;
Window_SkillStatus.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._actor = null;
this.refresh();
};
Window_SkillStatus.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
Window_SkillStatus.prototype.refresh = function() {
this.contents.clear();
if (this._actor) {
var x = this.textPadding();
var y = this.lineHeight();
var faceWidth = 144; // Ancho del retrato
var barX = x + faceWidth + this.textPadding(); // Posición X de las barras
var barWidth = this.contents.width - faceWidth - this.textPadding() * 3; // Ancho de las barras
this.drawActorFace(this._actor, x, 0, faceWidth, 144);
this.drawActorSimpleStatus(this._actor, x, y + 144);
this.drawActorHp(this._actor, barX, y, barWidth);
this.drawActorMp(this._actor, barX, y + this.lineHeight() * 2, barWidth);
}
};
Window_SkillStatus.prototype.drawActorHp = function(actor, x, y, width) {
width = width || 186;
var color1 = this.hpGaugeColor1();
var color2 = this.hpGaugeColor2();
this.drawGauge(x, y, width, actor.hpRate(), color1, color2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.hpA, x, y, 44);
this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,
this.hpColor(actor), this.normalColor());
};
Window_SkillStatus.prototype.drawActorMp = function(actor, x, y, width) {
width = width || 186;
var color1 = this.mpGaugeColor1();
var color2 = this.mpGaugeColor2();
this.drawGauge(x, y, width, actor.mpRate(), color1, color2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.mpA, x, y, 44);
this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width,
this.mpColor(actor), this.normalColor());
};
Window_SkillStatus.prototype.setSkillWindow = function(skillWindow) {
this._skillWindow = skillWindow;
};
Scene_Skill.prototype.create = function() {
Scene_ItemBase.prototype.create.call(this);
this.createHelpWindow();
this.createStatusWindow();
this.createSkillListWindow();
this.createActorWindow();
};
Scene_Skill.prototype.createHelpWindow = function() {
this._helpWindow = new Window_Help();
this.addWindow(this._helpWindow);
};
Scene_Skill.prototype.createStatusWindow = function() {
var wy = this._helpWindow.height;
var wh = Graphics.boxHeight - wy;
this._statusWindow = new Window_SkillStatus(0, wy, Graphics.boxWidth / 2, wh);
this._statusWindow.setActor(this.actor());
this.addWindow(this._statusWindow);
};
Scene_Skill.prototype.createSkillListWindow = function() {
var wy = this._helpWindow.height;
var wx = this._statusWindow.width;
this._skillListWindow = new Window_SkillList(wx, wy, Graphics.boxWidth - wx, Graphics.boxHeight - wy);
this._skillListWindow.setHelpWindow(this._helpWindow);
this._skillListWindow.setActor(this.actor());
this._skillListWindow.setHandler('ok', this.onSkillOk.bind(this));
this._skillListWindow.setHandler('cancel', this.popScene.bind(this));
this.addWindow(this._skillListWindow);
this._statusWindow.setSkillWindow(this._skillListWindow);
this._skillListWindow.refresh(); // Asegúrate de refrescar la ventana para cargar las habilidades
};
Scene_Skill.prototype.start = function() {
Scene_ItemBase.prototype.start.call(this);
this.refreshActor();
this._skillListWindow.activate(); // Activa directamente la ventana de lista de habilidades
this._skillListWindow.selectLast(); // Selecciona la última habilidad seleccionada
};
Scene_Skill.prototype.refreshActor = function() {
var actor = this.actor();
this._statusWindow.setActor(actor);
this._skillListWindow.setActor(actor);
this._skillListWindow.refresh(); // Asegúrate de refrescar la ventana para cargar las habilidades
};
Scene_Skill.prototype.onSkillOk = function() {
this.actor().setLastMenuSkill(this.item());
this.determineItem();
};
Scene_Skill.prototype.onItemCancel = function() {
this._skillListWindow.deselect();
this._skillListWindow.activate();
};
Scene_Skill.prototype.createActorWindow = function() {
this._actorWindow = new Window_MenuActor();
this._actorWindow.setHandler('ok', this.onActorOk.bind(this));
this._actorWindow.setHandler('cancel', this.onActorCancel.bind(this));
this.addWindow(this._actorWindow);
};
// Asegurarse de que la ventana de habilidades esté configurada correctamente
Window_SkillList.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
this.resetScroll();
}
};
Window_SkillList.prototype.includes = function(item) {
return this._actor && this._actor.isLearnedSkill(item);
};
Window_SkillList.prototype.makeItemList = function() {
if (this._actor) {
this._data = this._actor.skills().filter(function(item) {
return this.includes(item);
}, this);
} else {
this._data = [];
}
};
Window_SkillList.prototype.refresh = function() {
this.makeItemList();
this.createContents();
this.drawAllItems();
};
})();
I would appreciate a little help here 🙂