Mog Monogatari Menu - Gold Display

Discussion in 'Javascript/Plugin Support' started by IAmJakeSauvage, May 16, 2018.

  1. IAmJakeSauvage

    IAmJakeSauvage Veteran Veteran

    Messages:
    417
    Likes Received:
    669
    Location:
    Hamilton, ON
    First Language:
    English
    Primarily Uses:
    RMMV
    Hey guys!,

    I'm having trouble figuring out how to get the gold display to show from right-left rather than left-right with this plugin. I attached visual examples so you could see what I'm talking about as well as the current version of the plugin so you don't have to download the full master project.

    Thanks in advance!,


    moggold.png
     

    Attached Files:

    #1
  2. Alexander Hawksmoor

    Alexander Hawksmoor Veteran Veteran

    Messages:
    375
    Likes Received:
    1,955
    Location:
    England
    First Language:
    English
    Primarily Uses:
    RMMV
    If I remember correctly you can change it from the plugin option themselves. If I get to my laptop before anyone else comments I'll take a quick look.
     
    #2
  3. IAmJakeSauvage

    IAmJakeSauvage Veteran Veteran

    Messages:
    417
    Likes Received:
    669
    Location:
    Hamilton, ON
    First Language:
    English
    Primarily Uses:
    RMMV
    You can change the X/Y from the parameters but not the orientation of the layout itself and it just doesn't make sense vs. everything else. :kaocry:
     
    #3
  4. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,626
    Likes Received:
    1,053
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    I read through that Moghunter plugin and it doesn't look like it changes the default behavior of the gold window. If you turn off all your plugins, you'll see that the gold window behaves like that already, so I don't believe it has anything to do with the Moghunter plugin.

    Anyways, the function to write the gold value is this:
    Code:
    Window_Base.prototype.drawCurrencyValue = function(value, unit, x, y, width) {
       var unitWidth = Math.min(80, this.textWidth(unit));
       this.resetTextColor();
       this.drawText(value, x, y, width - unitWidth - 6, 'right');
       this.changeTextColor(this.systemColor());
       this.drawText(unit, x + width - unitWidth, y, unitWidth, 'right');
    };
    
    If you add that to a new plugin and change the first drawText to use 'left' instead of 'right', then you'll overwrite the default behavior and it will be left-aligned.
     
    #4
  5. IAmJakeSauvage

    IAmJakeSauvage Veteran Veteran

    Messages:
    417
    Likes Received:
    669
    Location:
    Hamilton, ON
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks for taking the time to do that - but unfortunately the plugin itself pulls from an image and not from a draw text command. I think the code below is what controls the image itself - I just can't figure out how to control the alignment.

    Code:
    //==============================
    // * create HP Number
    //==============================
    Scene_Menu.prototype.createGold = function() {
        this._gold_number = [];
        this._GoldData = [this._goldImg.width / 10,this._goldImg.height]
        var x = Moghunter.scMenu_GoldNumberX;
        var y = Moghunter.scMenu_GoldNumberY;
        for (var i = 0; i < 9; i++) {
             this._gold_number[i] = new Sprite(this._goldImg);
             this._gold_number[i].visible = false;
             this._gold_number[i].opacity = 255;
             this._gold_number[i].x = x ;
             this._gold_number[i].y = y ;
             this._field.addChild(this._gold_number[i]);         
        };   
        this.refresh_number(this._gold_number,$gameParty.gold(),this._GoldData,x)
     
    #5
  6. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,626
    Likes Received:
    1,053
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Sorry, I misunderstood. Reading the plugin further, I realize that it actually completely hides the normal gold window and creates a different one from scratch, and that the numbers are actually pictures instead of text.

    The function you are looking for is called:
    Scene_Menu.prototype.refresh_number

    You need to make 4 changes (well 2 changes, each 2 times):
    Find the lines starting with
    Code:
    var nx =
    
    Change both lines to:
    Code:
    var nx = (img_data[0] * i);
    
    Next find the lines starting with
    Code:
    sprites[i].x
    
    Change those to:
    Code:
    sprites[i].x = x + nx;
    
    You'll need to update your x position, but now it will left-align the number to your x position instead of right-align.
     
    #6
  7. IAmJakeSauvage

    IAmJakeSauvage Veteran Veteran

    Messages:
    417
    Likes Received:
    669
    Location:
    Hamilton, ON
    First Language:
    English
    Primarily Uses:
    RMMV
     
    #7

Share This Page