Help changing MOG's Scene File

Discussion in 'Javascript/Plugin Support' started by Padramyr, Mar 31, 2019.

  1. Padramyr

    Padramyr Veteran Veteran

    Messages:
    91
    Likes Received:
    75
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Hey there folks :)

    I hope this is the right forum for this (I wasn't sure if this is the right one or if I should post it in "Learning JS"). I've just started learning JS so I need help.
    So, I'm using Moghunter's Scene File. I managed to edit it the way I like it to be but now I ran into two problems.

    First of all: I want to have the picture depending on a variable instead of the actor ID. That's because the picture should change depending on the story progression (which is "saved" within a variable). For example, it should be the picture Actor_1 when the variable is under 5, Actor_2 when the variable is between 6 and 11 and so on. But I'm not sure how I need to change the JS to do that.
    The picture is drawn with this line:
    this._ActorPicture.bitmap = ImageManager.loadPicture("Actor_" + String(this._actorIndex));

    The second thing is that I want to show the name and level of all party members instead of HP, MP and such things of the first party member. With the default script it shows the name and level (and all stats) of the actor on the first position. Like I said, it should show the name and level of all party members that are currently in the group. I think the plugin part that's needed is the following (I deleted all the parts I don't need already):
    Window_FileData.prototype.drawData = function() {
    var actor = this.data().actor;
    var x = Moghunter.scFile_ParX;
    var y = Moghunter.scFile_ParY;
    var s = Moghunter.scFile_ParS;
    var w1 = this.width - 120 + x;;
    this._actorID = actor[10];
    this.changeTextColor(this.textColor(Moghunter.scFile_TextColor));
    this.drawText(TextManager.levelA, w1, y, 120, 'left'); // Level
    this.resetTextColor();
    this.drawText(actor[0], x, y, 120, 'left'); // Name
    this.drawText(actor[1], w1, y, 80, 'right'); // Level
    };


    I hope someone can help me and tell me how I need to change the according parts :)
     
    #1
  2. Padramyr

    Padramyr Veteran Veteran

    Messages:
    91
    Likes Received:
    75
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Anyone able to help? It would be really appreciated :)
     
    #2
  3. Eliaquim

    Eliaquim Raze: The Rakuen Zero's Guardian! Veteran

    Messages:
    563
    Likes Received:
    166
    Location:
    Brazil - Rio de Janeiro
    First Language:
    Portuguese - Br
    Primarily Uses:
    RMMV
    If you keeping add this:

    Code:
    Window_FileData.prototype.drawData = function() {
    var actor = this.data().actor;
    var x = Moghunter.scFile_ParX;
    var y = Moghunter.scFile_ParY;
    var s = Moghunter.scFile_ParS;
    var w1 = this.width - 120 + x;;
    this._actorID = actor[10];
    this.changeTextColor(this.textColor(Moghunter.scFile_TextColor));
    this.drawText(TextManager.levelA, w1, y, 120, 'left'); // Level
    this.resetTextColor();
    this.drawText($gameParty.members()[0]._name, x, y, 120, 'left'); // Name actor in position 1 in the party
    this.drawText($gameParty.members()[0]._level, w1, y, 80, 'right'); // Level  actor in position 1 in the party
    this.drawText($gameParty.members()[1]._name, x, y, 120, 'left'); // Name  actor in position 2 in the party
    this.drawText($gameParty.members()[1]._level, w1, y, 80, 'right'); // Level  actor in position 2 in the party
    And keep changing the position of each "drawtext". Maybe can work?
    I believe that if there is no actor in the group's specified position, nothing will be drawn.
     
    #3
  4. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,451
    Likes Received:
    929
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    You can use an "if" statement to change the value of something based on some condition. If you're not sure what an "if" statement is, I'd encourage you to read more here:
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else

    Here's an example based on your example:
    Code:
    let fileName;
    if ($gameVariables.value(X) < 5) {
        fileName = 'Actor_1';
    } else if ($gameVariables.value(X) < 11) {
        fileName = 'Actor_2';
    } else {
        fileName = 'Actor_3';
    }
    this._ActorPicture.bitmap = ImageManager.loadPicture(fileName);
     
    #4
  5. Padramyr

    Padramyr Veteran Veteran

    Messages:
    91
    Likes Received:
    75
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Thanks to both of you :)
    I managed to get it to work like I want it to. Even though Eliaquims suggestion didn't work ;)

    I felt really stupid after reading that. Why hadn't I thought of if functions sooner?! xD
    It worked btw. And it was far easier than I thought originally. Sometimes one is just at a loss even though the solution is that simple :kaoswt:
     
    #5
    Eliaquim likes this.

Share This Page