Ket

Veteran
Veteran
Joined
Oct 17, 2020
Messages
85
Reaction score
29
First Language
English
Primarily Uses
RMMV
I had an issue a while back trying to add sfonts to MOG_BattleResult. I was partially successful; however, I'm just now noticing that every time I fight an enemy and get taken to the results screen for the battle, the sfont changes every time. Almost like it's cycling through all my sfonts, or choosing them at random.

Line 423 - 438
JavaScript:
//==============================
// * Add ICon
//==============================
BattleResult.prototype.addIcon = function(sprite,data) {
    var icon = new Sprite(this._icon_img);
    var w = Window_Base._iconWidth;
    var h = Window_Base._iconHeight;
    var sx = data.iconIndex % 16 * w;
    var sy = Math.floor(data.iconIndex / 16) * h;
    icon.setFrame(sx,sy,w,h);
    sprite.addChild(icon);
    var name = new Sprite(new Bitmap(160,32));
    name.bitmap.drawText(data.name,0,0,160,32);
    name.x = w + 4;
    sprite.addChild(name);
};

Line 711 - 721
JavaScript:
//==============================
// * Create Actor Name
//==============================
BattleResult.prototype.createActorName = function() {
    this._name = new Sprite(new Bitmap(140,32));
    this._name.opacity = 0;
    this._name.bitmap.drawText(this._actor._name,0,0,140,32);
    this._name.x = Moghunter.bresult_name_x;
    this._name.y = Moghunter.bresult_name_y;
    this.addChild(this._name);   
};

Line 734 - 763
JavaScript:
//==============================
// * Create Parameters
//==============================
BattleResult.prototype.createParameters = function() {
    var x = Moghunter.bresult_par1_x;
    var y = Moghunter.bresult_par1_y;
    this._par = new Sprite(new Bitmap(Graphics.boxWidth,Graphics.boxHeight));
    this._par.opacity = 0;
    this._par.bitmap.drawText(this._actopar[0],x,y,100,32);
    this._par.bitmap.drawText(this._actopar[1],x,y + 32 * 1,100,32);
    this._par.bitmap.drawText(this._actopar[2],x,y + 32 * 2,100,32);
    this._par.bitmap.drawText(this._actopar[3],x,y + 32 * 3,100,32);
    this._par.bitmap.drawText(this._actopar[4],x,y + 32 * 4,100,32);   
    this._par.bitmap.drawText(this._actopar[5],x,y + 32 * 5,100,32);
    this._par.bitmap.drawText(this._actopar[6],x,y + 32 * 6,100,32);
    this._par.bitmap.drawText(this._actopar[7],x,y + 32 * 7,100,32);
    this._par.bitmap.drawText(this._actopar[8],x,y + 32 * 8,100,32);
    var x = Moghunter.bresult_par2_x;
    var y = Moghunter.bresult_par2_y;   
    this._par.bitmap.drawText(this._actor._level,x,y,100,32);
    this._par.bitmap.drawText(this._actor.mhp,x,y + 32 * 1,100,32);
    this._par.bitmap.drawText(this._actor.mmp,x,y + 32 * 2,100,32);
    this._par.bitmap.drawText(this._actor.atk,x,y + 32 * 3,100,32);
    this._par.bitmap.drawText(this._actor.def,x,y + 32 * 4,100,32);   
    this._par.bitmap.drawText(this._actor.mat,x,y + 32 * 5,100,32);
    this._par.bitmap.drawText(this._actor.mdf,x,y + 32 * 6,100,32);
    this._par.bitmap.drawText(this._actor.agi,x,y + 32 * 7,100,32);
    this._par.bitmap.drawText(this._actor.luk,x,y + 32 * 8,100,32);   
    this.addChild(this._par);
};

Line 423 - 439
Added: name.bitmap.changeSFont(0) after line 434
JavaScript:
//==============================
// * Add ICon
//==============================
BattleResult.prototype.addIcon = function(sprite,data) {
    var icon = new Sprite(this._icon_img);
    var w = Window_Base._iconWidth;
    var h = Window_Base._iconHeight;
    var sx = data.iconIndex % 16 * w;
    var sy = Math.floor(data.iconIndex / 16) * h;
    icon.setFrame(sx,sy,w,h);
    sprite.addChild(icon);
    var name = new Sprite(new Bitmap(240,32));
    [B]name.bitmap.changeSFont(0)[/B]
    name.bitmap.drawText(data.name,0,0,240,32);
    name.x = w + 4;
    sprite.addChild(name);
};

Line 712 - 723
Added: this._name.bitmap.changeSFont(0) after line 716
JavaScript:
//==============================
// * Create Actor Name
//==============================
BattleResult.prototype.createActorName = function() {
    this._name = new Sprite(new Bitmap(140,32));
    [B]this._name.bitmap.changeSFont(0)[/B]
    this._name.opacity = 0;
    this._name.bitmap.drawText(this._actor._name,0,0,300,32);
    this._name.x = Moghunter.bresult_name_x;
    this._name.y = Moghunter.bresult_name_y;
    this.addChild(this._name);   
};

Line 736 - 766
Added: this._par.bitmap.changeSFont(0) after line 742
JavaScript:
//==============================
// * Create Parameters
//==============================
BattleResult.prototype.createParameters = function() {
    var x = Moghunter.bresult_par1_x;
    var y = Moghunter.bresult_par1_y;
    this._par = new Sprite(new Bitmap(Graphics.boxWidth,Graphics.boxHeight));
    [B]this._par.bitmap.changeSFont(0)[/B]
    this._par.opacity = 0;
    this._par.bitmap.drawText(this._actopar[0],x,y,100,32);
    this._par.bitmap.drawText(this._actopar[1],x,y + 32 * 1,100,32);
    this._par.bitmap.drawText(this._actopar[2],x,y + 32 * 2,100,32);
    this._par.bitmap.drawText(this._actopar[3],x,y + 32 * 3,100,32);
    this._par.bitmap.drawText(this._actopar[4],x,y + 32 * 4,100,32);   
    this._par.bitmap.drawText(this._actopar[5],x,y + 32 * 5,100,32);
    this._par.bitmap.drawText(this._actopar[6],x,y + 32 * 6,100,32);
    this._par.bitmap.drawText(this._actopar[7],x,y + 32 * 7,100,32);
    this._par.bitmap.drawText(this._actopar[8],x,y + 32 * 8,100,32);
    var x = Moghunter.bresult_par2_x;
    var y = Moghunter.bresult_par2_y;   
    this._par.bitmap.drawText(this._actor._level,x,y,100,32);
    this._par.bitmap.drawText(this._actor.mhp,x,y + 32 * 1,100,32);
    this._par.bitmap.drawText(this._actor.mmp,x,y + 32 * 2,100,32);
    this._par.bitmap.drawText(this._actor.atk,x,y + 32 * 3,100,32);
    this._par.bitmap.drawText(this._actor.def,x,y + 32 * 4,100,32);   
    this._par.bitmap.drawText(this._actor.mat,x,y + 32 * 5,100,32);
    this._par.bitmap.drawText(this._actor.mdf,x,y + 32 * 6,100,32);
    this._par.bitmap.drawText(this._actor.agi,x,y + 32 * 7,100,32);
    this._par.bitmap.drawText(this._actor.luk,x,y + 32 * 8,100,32);   
    this.addChild(this._par);
};

I remember reading somewhere that I had to call bitmap.changesfont(index). Though I'm still not fairly adept at coding and I'm pretty sure I did something wrong. I kind of just added those bits of code after every "bitmap" I saw. Any help would be appreciated.
 

Attachments

  • MOG_BattleResult.js
    29.2 KB · Views: 1
  • Edited MOG_BattleResult.js
    29.3 KB · Views: 0

Latest Threads

Latest Profile Posts

One tried and true way to trigger a lot of people to be nasty is to tell a truth that they are uncomfortable with, like how most people will stand by while they see a crime happening, unless it's illegal to stand by. We probably wouldn't have stories about "special heroes" or games about heroes if the "everyday common folk" were largely capable of being heroes. Heroes face dangers that most people are not willing to.
I'm having toooo much fun designing the new MP (Mental Psyche) system. I've only worked it out for enemies so far, but it's fun to stun them, then go after their MP and delete them instead to farm for better item drops.
anyone know of a place I can promote my game? sorta like game awards but for indie devs, like a place where I can drop a trailer and like stir up some hype
Doing RPG Maker News for 17th October 2021

That moment when you came up with a very good game title, but when you searched it, it has already been used... T.T

Forum statistics

Threads
115,875
Messages
1,093,676
Members
151,123
Latest member
Smitty
Top