Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
540
Reaction score
1,369
First Language
Norwegian
Primarily Uses
RMMZ
I used the DevTools to add text to the status menu.

Code:
SceneManager._scene._statusWindow.drawTextEx(" \\c[0]Job Lv. \\c[4]10 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]20 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]30 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]40 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]50 \\c[0]-", 15, 210)
SceneManager._scene._statusWindow.drawTextEx(" \\c[0]Job Lv. \\c[4]60 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]70 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]80 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]90 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]99 \\c[0]-", 320, 210)

Which makes it look like this

SceneManager.PNG

But I don't know how to implement it tbh. Anyone able to make this into a plugin or can I use the code as is?

The intention is to show which skills the class learns at the indicated levels, it can just be text form as I don't have class changes, or show the text based on skill id I suppose?

If I could just see how the text is implemented then I would not mind manually adding each text to each class even.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,819
Reaction score
2,875
First Language
EN
Primarily Uses
RMMZ
Each game window controls how its own contents are drawn. For a plugin, you would at least need to know the name of the constructor for the _statusWindow instance. If you're not sure what that might be, you can enter this into the console to check:

SceneManager._scene._statusWindow.constructor.name
 

Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
540
Reaction score
1,369
First Language
Norwegian
Primarily Uses
RMMZ
Capture.PNG

@caethyril found a solution, tnx. I had used Window_StatusBase instead of Window_Status :p

Managed to get the static text working. (I may have screwed up the xp/to next lvl in the process though xD)

Now I need to find out how to draw skill names :p
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,819
Reaction score
2,875
First Language
EN
Primarily Uses
RMMZ
Looks like you have the general idea! Notes:
  1. JavaScript:
       this.drawText(this.JobLevel(), x, y + lineHeight * 4, 270, "left");
    The JobLevel method doesn't return a value, but you're using it as if it returns a string here. It's probably drawing undefined somewhere way off to the right, because x is 800. It looks OK because when JobLevel is called, that method draws the text. Better to rearrange that~

  2. You're passing 6 arguments in each of the drawText calls, but that function only handles 5 arguments: text, x, y, width, align. I assume you first typed the 3rd , instead of a + by accident, then worked around that result.

  3. Block 2 of the status window is the area next to the face image. I feel like it would make more sense to add this drawing call somewhere else.
Suggestion (untested):
JavaScript:
/*:
 * @target MZ
 * @plugindesc Status screen stuff!
 * @help Terms of use: free to use and/or modify for any project.
 */

// Patch - after usual refresh, draw job info if appropriate
(() => {
  const alias = Window_Status.prototype.refresh;
  Window_Status.prototype.refresh = function() {
    alias.apply(this, arguments);
    if (this._actor) {
      this.drawJobInfo();
    }
  };
})();

// New - draw the job info block
Window_Status.prototype.drawJobInfo = function() {
  const lineHeight = this.lineHeight();
  let x = 15, y = 220, level = 10;
  for (let n = 0; n < 5; n++) {
    this.drawJobLevel(level, x, y);
    y += lineHeight;
    level += 10;
  }
};

// New - draw a single job info line at specified coordinated
Window_Status.prototype.drawJobLevel = function(level, x, y, width = 270) {
  const text = "Job Lv. " + level;
  this.drawTextEx(text, x, y, width);
};
I used a loop because it seemed appropriate here. Remember you can reference the displayed actor as this._actor if you need to check their stats, e.g. current job level. I also replaced drawText with drawTextEx for text code support, like you had in your console stuff.

Also, in case it helps to clarify things: Window_Status inherits from Window_StatusBase, i.e. if there isn't a Window_Status method for a thing, it will be "auto-filled" by the Window_StatusBase version. You're correct, though: this override should be for Window_Status because you don't want to affect the others (Window_MenuStatus, Window_EquipStatus, etc). :kaophew:

[Edit: corrected a couple of typos in the code.]
 
Last edited:

Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
540
Reaction score
1,369
First Language
Norwegian
Primarily Uses
RMMZ
Thanks! The reason its all a mess is because I don't know much about coding at all xD

I wanted to use drawTextEx too but couldn't figure out how to do it.

Or, maybe I learned a little bit now.

Got an error but it was fixed when I added ''= function'' to two places.

I don't even have a clue what that means but it seems to have worked (Maybe its not fixed?)

stsa.PNG
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,819
Reaction score
2,875
First Language
EN
Primarily Uses
RMMZ
Oops, sorry! You're correct, e.g. this
JavaScript:
Window_Status.prototype.drawJobInfo() {
...should be this:
JavaScript:
Window_Status.prototype.drawJobInfo = function() {
I just edited my previous post with the corrections, thanks for pointing that out~

Looks like you've got it working, nice! :kaojoy:
 

Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
540
Reaction score
1,369
First Language
Norwegian
Primarily Uses
RMMZ
I used the DevTools to add text to the status menu.

Code:
SceneManager._scene._statusWindow.drawTextEx(" \\c[0]Job Lv. \\c[4]10 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]20 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]30 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]40 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]50 \\c[0]-", 15, 210)
SceneManager._scene._statusWindow.drawTextEx(" \\c[0]Job Lv. \\c[4]60 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]70 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]80 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]90 \\c[0]-\n\n \\c[0]Job Lv. \\c[4]99 \\c[0]-", 320, 210)

Which makes it look like this

Capture.PNG

But I don't know how to implement it tbh. Anyone able to make this into a plugin or can I use the code as is?

The intention is to show which skills the class learns at the indicated levels, it can just be text form as I don't have class changes, or show the text based on skill id I suppose?

If I could just see how the text is implemented then I would not mind manually adding each text to each class even.

My original post should have looked more like this, having a full mock up instead of me trying to explain the rest of it in text :p I wasn't sure how to do it even in the SceneManager stuff, displaying different skills depending on the actor.

But yeah, phase 2 is to add the skills next to the Job Lv. xx :p No rush though :p

I tried to do a sneaky one and morph @caethyril's code for this purpose but...

Code:
  (() => {
    const alias = Window_Status.prototype.refresh;
    Window_Status.prototype.refresh = function() {
      alias.apply(this, arguments);
      if (this._actor) {
        this.drawJobSkills();
      }
    };
  })();
 
  // New - draw the job info block
  Window_Status.prototype.drawJobSkills = function() {
    const lineHeight = this.lineHeight();
    let x = 150, y = 220, skillId = 47;
    for (let n = 0; n < 5; n++) {
      this.drawSkillsLevel(skillId, x, y);
      y += lineHeight + 30;
      skillId + 2;
    }
  };
 
    // New - draw a single job info line at specified coordinated
    Window_Status.prototype.drawSkillsLevel = function(skillId, x, y, width = 270) {
      const text = "- " + skillId;
      this.drawTextEx(text, x, y, width);
    };

Just shows the text ofc, like I said...No idea what im doing xD

Would something like this be possible though? Like showing a list of skills downward? And have a different list depending on actor.

sdfds.PNG
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,819
Reaction score
2,875
First Language
EN
Primarily Uses
RMMZ
You can get the database record for a given skill ID like this:

$dataSkills[skillId]
The name of the skill is stored in its name property. So you could try:
JavaScript:
Window_Status.prototype.drawSkillsLevel = function(skillId, x, y, width = 270) {
  const skill = $dataSkills[skillId];
  const text = "- " + (skill?.name ?? `(skill ${skillId})`);
  this.drawTextEx(text, x, y, width);
};
As I mentioned earlier, you can check some property of this._actor (a Game_Actor reference) if needed, e.g. you can make skillId depend on this._actor.actorId() or this._actor._classId.

In case it helps, you can find details about RMMZ's database structure here:
 

Willibab

The Lord of Whackery
Veteran
Joined
Jun 22, 2017
Messages
540
Reaction score
1,369
First Language
Norwegian
Primarily Uses
RMMZ
@caethyril Thanks! I'm still not quite sure what to do tbh, but I think I'll try to learn more about js. I've always been a really slow learner when it comes to anything to do with computer stuff, not sure why as all I do is sit in front of one xD
 

Latest Threads

Latest Posts

Latest Profile Posts

ScreenShot_8_19_2022_8_51_4.png
Both Mike and Ray here are in a "HYPE!" state after Mike uses "Wild Party", which also heals everyone. they'll do more damage and counter more often, but defense is lower along with hit rate.
WHEEL3.gif
Ooker spookers and fun attack mechanics! What a Friday!
Not today... Not today...
I guess I should send my CV to Hasbro. I've made Monopoly cheaters edition more fun and challenging. I've developed custom cheats and chest/chance cards for it. And I've cleared many nightmares through my cards and rules.
I'm only missing 2 more bgms for my game but maaaaan, searching for these tracks is killing me. Can't find anything good to replace MZ's Theme 2 and Scene 5 I have as placeholders. Everything is too epic or too evil or too alarming. That 'scene 5' track in particular would fit nicely with my scene. Well, at least I finally figured what my last click-fest of a gameplay element will be like, so something positive :D

Forum statistics

Threads
124,707
Messages
1,165,412
Members
163,520
Latest member
Foxx042
Top