Hide useless stats

Discussion in 'Javascript/Plugin Support' started by Draw, Oct 25, 2015.

  1. Draw

    Draw Veteran Veteran

    Messages:
    83
    Likes Received:
    1
    First Language:
    French
    Hi everyone !

    I've already made a topic for the same thing with VX ACE not so long ago. I would like to hide stats I don't use in the Equip Window. ATK, MAT, AGI instead of ATK, DEF, MAT, MDF, AGI, LUK. I found "ParamId" in the js script but I don't know how to write stats one by one. If someone knows, feel free to post it there :)
     
    #1
  2. Aluvien

    Aluvien Veteran Veteran

    Messages:
    33
    Likes Received:
    15
    First Language:
    English
    I'm new to this too, but I figured I'd give this one a shot. The order of parameters is in objects_js:

    Object.defineProperties(Game_BattlerBase.prototype, { // Hit Points hp: { get: function() { return this._hp; }, configurable: true }, // Magic Points mp: { get: function() { return this._mp; }, configurable: true }, // Tactical Points tp: { get: function() { return this._tp; }, configurable: true }, // Maximum Hit Points mhp: { get: function() { return this.param(0); }, configurable: true }, // Maximum Magic PointsAnd so on. You want ATK, MAT, and AGI, which conveniently, are parameters 1, 3, and 5. The most straightforward way to do this is to replace the counter code in Window_EquipStatus so that it skips the unwanted stats. Try this:

    Window_EquipStatus.prototype.refresh = function() { this.contents.clear(); if (this._actor) { this.drawActorName(this._actor, this.textPadding(), 0); for (var i = 0; i < 6; i+=2) { this.drawItem(0, this.lineHeight() * (1 + i / 2), 2 + i); } }};Note that here, your stats are parameters 0, 2, and 4. In rpg_objects, ATK is parameter 1, so note for any future changes that item in this function is 1 lower than param in rpg_objects. The order, however, seems to be the same. Note also that I changed the y value for each line to adjust for the missing lines on the screen. Hope this helps!
     
    Last edited by a moderator: Oct 25, 2015
    #2
  3. Draw

    Draw Veteran Veteran

    Messages:
    83
    Likes Received:
    1
    First Language:
    French
    It works fine, thank you !

    By the way, can we do it with other stats, but one by one ?

    Something like that :

    atk(x, y, lineHeight x 1)

    mat(x, y, lineHeight x 2)

    ...
     
    #3
  4. Aluvien

    Aluvien Veteran Veteran

    Messages:
    33
    Likes Received:
    15
    First Language:
    English
    That is possible, but is slightly more complicated. If you look at the code above, the relevant line is:

    this.drawItem(0, this.lineHeight() * (1 + i / 2), 2 + i);The first two arguments are clearly X and Y, but the last one is unclear. (It's important to note that the last argument is 2 + i, meaning that what I said in my last post is mistaken: ATK is parameter 2 here, not parameter 0.)

    In order to find out what that argument is, we need to look for the drawItem function of Window_EquipStatus (since the function itself is "this.drawItem"):

    Window_EquipStatus.prototype.drawItem = function(x, y, paramId) { this.drawParamName(x + this.textPadding(), y, paramId); if (this._actor) { this.drawCurrentParam(x + 140, y, paramId); } this.drawRightArrow(x + 188, y); if (this._tempActor) { this.drawNewParam(x + 222, y, paramId); }};This function takes three arguments: x, y, and parameter ID. Thus, you should be able to structure calls for individual parameters like this:

    this.drawItem(0, this.lineHeight() * (1 + 1 / 2), 2) //Draws ATKSo that the code as a whole would be:

    Window_EquipStatus.prototype.refresh = function() { this.contents.clear(); if (this._actor) { this.drawActorName(this._actor, this.textPadding(), 0); this.drawItem(0, this.lineHeight() * 1, 2); this.drawItem(0, this.lineHeight() * 2, 4); this.drawItem(0, this.lineHeight() * 3, 6); }};I removed the counter, since we're directly writing each command instead of iterating over a list. Note that because of this, I had to change how Y is calculated, since variable i no longer exists. This way you can put in individual lines for every parameter you want, and only have to change Y and paramId. Hope this helped.
     
    #4
    Draw likes this.
  5. Kane Hart

    Kane Hart Elmlor.com Veteran

    Messages:
    656
    Likes Received:
    166
    Location:
    Barrie, Ontario, Canada
    First Language:
    English
    Would be nice to have this made into a proper plugin for everyone to use. I myself hate seeing this:

    [​IMG]
     
    #5
  6. Draw

    Draw Veteran Veteran

    Messages:
    83
    Likes Received:
    1
    First Language:
    French
    Thank you, it works fine !

    I hope it'll be usefull for all.
     
    Last edited by a moderator: Oct 28, 2015
    #6
  7. Amuseum

    Amuseum Veteran Veteran

    Messages:
    71
    Likes Received:
    66
    Location:
    San Francisco
    First Language:
    English Chinese
    Primarily Uses:
    RMXP
    several steps. 1. create an array to hold the ids of the stats you want in specific order. 2. iterate through this new array. a temp var to hold the current id, not i, is passed to drawItem.
     
    Last edited by a moderator: Oct 29, 2015
    #7
  8. junglechief

    junglechief Veteran Veteran

    Messages:
    46
    Likes Received:
    3
    First Language:
    English
    Running this right now. Trying to only show HP, Atk, Def, and Agi. 

    Window_EquipStatus.prototype.refresh = function() {

        this.contents.clear();

        if (this._actor) {

            this.drawActorName(this._actor, this.textPadding(), 0);

            this.drawItem(0, this.lineHeight() * 1, 2);

      this.drawItem(0, this.lineHeight() * 2, 3);

            this.drawItem(0, this.lineHeight() * 3, 6);

        }

    };

     

    Doesn't appear to be doing anything.
     
    #8
  9. Neo Soul Gamer

    Neo Soul Gamer Veteran Veteran

    Messages:
    614
    Likes Received:
    332
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    N/A
    Are you using Yanfly's Equip Core? This won't work if you are. There's something else you have to edit.
     
    #9
  10. junglechief

    junglechief Veteran Veteran

    Messages:
    46
    Likes Received:
    3
    First Language:
    English
    Yes I am, you wouldn't happen to know what else needs to be added?
     
    #10
    Neo Soul Gamer likes this.
  11. Neo Soul Gamer

    Neo Soul Gamer Veteran Veteran

    Messages:
    614
    Likes Received:
    332
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    N/A
    No, but I think I can figure it out in a bit. I also used the Equip Core plugin and ran some quick tests with and without it. It definitely overwrites whatever displays the parameters. I'll take a look shortly. Stay tuned for the edit.

    EDIT:

    Window_StatCompare.prototype.refresh = function() {    this.contents.clear();    if (this._actor) {        this.drawActorName(this._actor, this.textPadding(), 0);        this.drawItem(0, this.lineHeight() * 1, 2);this.drawItem(0, this.lineHeight() * 3, 3);this.drawItem(0, this.lineHeight() * 5, 4);    }};

    Create a new plugin with this code and put it below Equip Core. Notice the numbers "1, 2" "3, 3" "5, 4" The first number (1, 3, and 5) is the spacing and placement of which row the parameters will be in. The second number (2, 3, and 4) is tied to the Parameter that you want to display. In this example, ATK, DEF, and MAT should show with a skipped row between them.

    Hope this helps.
     
    Last edited by a moderator: Dec 6, 2015
    #11
  12. junglechief

    junglechief Veteran Veteran

    Messages:
    46
    Likes Received:
    3
    First Language:
    English
    Create a new plugin with this code and put it below Equip Core. Notice the numbers "1, 2" "3, 3" "5, 4" The first number (1, 3, and 5) is the spacing and placement of which row the parameters will be in. The second number (2, 3, and 4) is tied to the Parameter that you want to display. In this example, ATK, DEF, and MAT should show with a skipped row between them.

    Hope this helps.
    Got the equip screen to work, now which function draws the stats on the item screen.
     
    Last edited by a moderator: Dec 7, 2015
    #12
  13. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,460
    Likes Received:
    1,052
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    So what do I do if I want to skip MP? Would that also remove the box for it?
     
    #13
  14. Neo Soul Gamer

    Neo Soul Gamer Veteran Veteran

    Messages:
    614
    Likes Received:
    332
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    N/A
    Can't really explain it any better than I did above. Each number is tied to a parameter. Aluvien also explains where you can find out which parameters are tied to which number in post #2. Take a look at the code, you'll definitely figure it out. 
     
    #14
    BloodletterQ likes this.

Share This Page