I just wrote "heart" of my plugin to display main heroes biography
However I stuck at few major problems:
#1 How to add and bind new menu command to main menu?
#2 How to display list of all present party members before showing biography?
#3 How to get and pass argument to drawActorFace method, since it's take as 1st argument Game_Actors object?
#4 How to return to previous menu, when esc key is pressed?
I'm attaching a code to make things easier.
Thank you for your time and help.
However I stuck at few major problems:
#1 How to add and bind new menu command to main menu?
#2 How to display list of all present party members before showing biography?
#3 How to get and pass argument to drawActorFace method, since it's take as 1st argument Game_Actors object?
#4 How to return to previous menu, when esc key is pressed?
I'm attaching a code to make things easier.
JavaScript:
function Scene_Biography() {
this.initialize.apply(this, arguments);
}
Scene_Biography.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Biography.prototype.constructor = Scene_Biography;
Scene_Biography.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_Biography.prototype.create = function(){
Scene_MenuBase.prototype.create.call(this);
this._windowActorStats = new Window_ActorStats(64, 64, 448, 448);
this._windowActorBio = new Window_ActorBio(64 + 448, 64, 448, 448);
this.addWindow(this._windowActorStats);
this.addWindow(this._windowActorBio);
}
function Window_ActorStats() {
this.initialize.apply(this, arguments);
}
Window_ActorStats.prototype = Object.create(Window_Base.prototype);
Window_ActorStats.prototype.constructor = Window_ActorStats;
Window_ActorStats.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.drawAllItems(this.actorId());
this.refresh();
};
Window_ActorStats.prototype.actorId = function(){
return $gameActors.actor($gameParty._targetActorId) || $gameActors.actor(1);
}
Window_ActorStats.prototype.lineHeight = function(){
return 36;
}
Window_ActorStats.prototype.drawAllItems = function(){
this.drawActorFace(this.actorId(), 8, 8, 144, 144);
this.drawTextEx("\\hc[ffcc00][Lv. %1]\\hc[ffffff] - %2".format(this.actorId().level, this.actorId().name()), 160, 8);
this.drawTextEx($dataClasses[this.actorId()._classId].name, 160, 8 + this.lineHeight());
this.drawTextEx("\\hc[32cd32]Life: %1 / %2\\hc[ffffff]".format(this.actorId().hp, this.actorId().mhp), 160, 8 + (this.lineHeight()*2));
this.drawTextEx("\\hc[87ceeb]Magic: %1 / %2\\hc[ffffff]".format(this.actorId().mp, this.actorId().mmp), 160, 8 + (this.lineHeight()*3));
this.drawText("Offensive stats:", 8, 160, "center")
this.drawTextEx("Strength: %1".format(this.actorId().atk), 16, 176 + this.lineHeight());
this.drawTextEx("Inteligence: %1".format(this.actorId().mat), 16, (176 + this.lineHeight()*2));
this.drawTextEx("Agility: %1".format(this.actorId().agi), 16, 176 + (this.lineHeight()*3));
this.drawText("Defensive stats:", 232, 160, "center")
this.drawTextEx("Defense: %1".format(this.actorId().def), 248, 176 + this.lineHeight());
this.drawTextEx("Resistance: %1".format(this.actorId().mdf), 248, (176 + this.lineHeight()*2));
this.drawTextEx("Luck: %1".format(this.actorId().luk), 248, 176 + (this.lineHeight()*3));
}
Window_ActorStats.prototype.refresh = function() {
if (this.contents) {
this.contents.clear();
this.drawAllItems();
}
};
function Window_ActorBio() {
this.initialize.apply(this, arguments);
}
Window_ActorBio.prototype = Object.create(Window_Base.prototype);
Window_ActorBio.prototype.constructor = Window_ActorBio;
Window_ActorBio.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.drawBio();
};
Window_ActorBio.prototype.actorId = function(){
return $gameActors.actor($gameParty._targetActorId) || $gameActors.actor(1);
}
Window_ActorBio.prototype.drawBio = function(){
this.drawTextEx(this.actorId().profile(), 8, 8);
}
Thank you for your time and help.