DarkSearinox92

Veteran
Veteran
Joined
Jan 8, 2013
Messages
497
Reaction score
84
First Language
Italian
Primarily Uses
Hi guys, i'm trying to create a compatibility between two script.

Yanfly Job Points and an alternative menu of SumRn.

Basically, yanfly job points draw the job points in the main menu, in a precise position and i think that the part of the code that add it, it's this:

JavaScript:
//=============================================================================
// Window_Base
//=============================================================================

Yanfly.JP.Window_Base_dASS = Window_Base.prototype.drawActorSimpleStatus;
Window_Base.prototype.drawActorSimpleStatus = function(actor, wx, wy, ww) {
    this._drawMenuJP = Yanfly.Param.JpShowMenu;
    Yanfly.JP.Window_Base_dASS.call(this, actor, wx, wy, ww);
    this._drawMenuJP = undefined;
};

Yanfly.JP.Window_Base_drawActorClass = Window_Base.prototype.drawActorClass;
Window_Base.prototype.drawActorClass = function(actor, wx, wy, ww) {
    ww = ww || 168;
    Yanfly.JP.Window_Base_drawActorClass.call(this, actor, wx, wy, ww);
    if (!this._drawMenuJP) return;
    var classId = actor.currentClass().id;
    this.drawActorJp(actor, classId, wx, wy, ww, 'right');
};

Window_Base.prototype.drawActorJp = function(actor, id, wx, wy, ww, align) {
    var jp = actor.jp(id);
    var icon = '\\i[' + Yanfly.Icon.Jp + ']';
    var fmt = Yanfly.Param.JpMenuFormat;
    var text = fmt.format(Yanfly.Util.toGroup(jp), Yanfly.Param.Jp, icon);
    if (align === 'left') {
      wx = 0;
    } else if (align === 'center') {
      wx += (ww - this.textWidthEx(text)) / 2;
    } else {
      wx += ww - this.textWidthEx(text);
    }
    this.drawTextEx(text, wx, wy);
};

Window_Base.prototype.textWidthEx = function(text) {
    return this.drawTextEx(text, 0, this.contents.height);
};



If i use the alternative menu, this function disappear and the part that add the job points in the main menu is not visible.
If i see the code of the alternative menu, i see this:

JavaScript:
    Window_MenuStatus.prototype.drawItemStatus = function(index) {
        var actor = $gameParty.members()[index];
        var rect = this.itemRect(index);
        var x = rect.x + 4;
        var y = rect.y;
        if(!useCharacters) y += (rect.height / 2);
        else y += (characterSizeY/2);
        if(drawTp && !useCharacters) {
            y -= this.lineHeight() / 2;
        }
        var width = rect.width - 8;
        var lineHeight = this.lineHeight();
        this.drawActorName(actor, x, y, width);
        this.drawActorLevel(actor, x, y + lineHeight, width);
        this.drawActorHp(actor, x, y + lineHeight * 2, width);
        this.drawActorMp(actor, x, y + lineHeight * 3, width);
        if(drawTp) this.drawActorTp(actor, x, y + lineHeight * 4, width);
        this.resetFontSettings();
    };

If i try to comment the line "this.drawActorMp", the mp under the character disappear.
Now, if the Yanfly script create a new entry, how can i call it and put it under the mp? I really don't understand how to do it :(
Maybe the part of the code of the alternative menu it's not this... But i'm pretty sure, in ignorance, that the part of code of script jp points that draw the info in the main menu, near every character, it's right. :/
 

DarkSearinox92

Veteran
Veteran
Joined
Jan 8, 2013
Messages
497
Reaction score
84
First Language
Italian
Primarily Uses
After some trouble, i've done it. Now it's visible with


this.drawActorJp(actor, id, x, y + lineHeight * 4, width);

but the value remain always on 0... <_>

What am i missing? If i don't specify "id" the function didn't appear. If i specify "id" the function appear. But the value of JP is always 0...
 
Last edited:

Traverse

Veteran
Veteran
Joined
Jul 3, 2014
Messages
192
Reaction score
125
First Language
English
Primarily Uses
Since Yanfly has made his MV plugins commercial, I cannot ask you to show the script and since I don't personally have a copy, I can't check the full workings of the code to see exactly what the "id" variable is pointing to in his plugin.

For a 100% accurate solution, you would need to ask Yanfly or members of his team or someone else who has bought a copy of his script to be sure. All I can offer is a guess.

My guess - based on how his VX Ace version of his JP script was written - is that the "id" argument asked for in his "drawActorJp" function refers to the database ID of the actor's character class (Hero, Warrior, Mage, Priest, etc).

I'm guessing that when you're calling the function, you are looking for a variable called "id", but there is either no "id" variable specified in the code for your alternate menu (so it possibly defaults to nil/0) or there is an "id" variable that points to some number that is not the actor's character class ID. Character classes are indexed in the database starting from 1 ("Hero" is id #1 by default) while 0 is a null value dummy entry, so if it is defaulting to 0, it may be the reason why you are seeing 0 JP as the value.

Again, I cannot be sure this is this case. Yanfly's MV plugin may not be written the same way as the Ace version and "id" may refer to something else entirely.
 

DarkSearinox92

Veteran
Veteran
Joined
Jan 8, 2013
Messages
497
Reaction score
84
First Language
Italian
Primarily Uses
Since Yanfly has made his MV plugins commercial, I cannot ask you to show the script and since I don't personally have a copy, I can't check the full workings of the code to see exactly what the "id" variable is pointing to in his plugin.

For a 100% accurate solution, you would need to ask Yanfly or members of his team or someone else who has bought a copy of his script to be sure. All I can offer is a guess.

My guess - based on how his VX Ace version of his JP script was written - is that the "id" argument asked for in his "drawActorJp" function refers to the database ID of the actor's character class (Hero, Warrior, Mage, Priest, etc).

I'm guessing that when you're calling the function, you are looking for a variable called "id", but there is either no "id" variable specified in the code for your alternate menu (so it possibly defaults to nil/0) or there is an "id" variable that points to some number that is not the actor's character class ID. Character classes are indexed in the database starting from 1 ("Hero" is id #1 by default) while 0 is a null value dummy entry, so if it is defaulting to 0, it may be the reason why you are seeing 0 JP as the value.

Again, I cannot be sure this is this case. Yanfly's MV plugin may not be written the same way as the Ace version and "id" may refer to something else entirely.

Thank you so much, i will retry to see if i can do it :( But if that part of the code is already "implemented in another script, how can i "import" the function of that script into this one?

I mean, if it's all setted, and the code for "write" is that

this.drawActorJp(actor, id, x, y + lineHeight * 4, width);

How can i tell to the script to "see" parameters configured in another script?
 
Last edited:

Traverse

Veteran
Veteran
Joined
Jul 3, 2014
Messages
192
Reaction score
125
First Language
English
Primarily Uses
But if that part of the code is already "implemented in another script, how can i "import" the function of that script into this one?
You're already "importing" the function when you are calling "drawActorJp()", the "drawActorJp()" function was created by Yanfly's script, it does not exist in the default code of the engine.

If my guess is right, the "id" in that line of code should just be asking for the actor's character class ID and is not a parameter set by Yanfly's script, but part of the engine's default code (the GameParty object). So you can try using:
Code:
this.drawActorJp(actor, actor._classId, x, y + lineHeight * 4, width)
But if it doesn't work, then unfortunately I can't help you, since I don't have access to Yanfly's script and can't see what it is asking for.
 

DarkSearinox92

Veteran
Veteran
Joined
Jan 8, 2013
Messages
497
Reaction score
84
First Language
Italian
Primarily Uses
You're already "importing" the function when you are calling "drawActorJp()", the "drawActorJp()" function was created by Yanfly's script, it does not exist in the default code of the engine.

If my guess is right, the "id" in that line of code should just be asking for the actor's character class ID and is not a parameter set by Yanfly's script, but part of the engine's default code (the GameParty object). So you can try using:
Code:
this.drawActorJp(actor, actor._classId, x, y + lineHeight * 4, width)
But if it doesn't work, then unfortunately I can't help you, since I don't have access to Yanfly's script and can't see what it is asking for.

It works!! You are the best!!! T_T
 

Latest Threads

Latest Posts

Latest Profile Posts

You know you've been working on RPGMaker for a while when you go to move your projects to a 16 GB USB drive and get told not enough space to do this operation.
The latest post on TheDazzlingsAreBack...
besides itch and occasionally here where are people doing game jams at y'all? (plz do not cross reference this with my previous status lol)
Go out all day!
★No work★
Just want to sleep when I get home Zzzzz
just went through 50 issues of Fables, only to left kind of disappointed by it, I guess I have to wait for season 2 of TWAU instead.

Forum statistics

Threads
110,442
Messages
1,053,318
Members
143,508
Latest member
Mike-Turtle
Top