Stat Polygon

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
968
Reaction score
805
First Language
English
Primarily Uses
N/A

Stat Polygon v1.0
by mjshi- OK for use in all projects with credit

Get it here!

A fancy radar chart for your stats!
Commissioned by the wonderful Lonewulf123 of these very forums.
Features
- Customize which and how many stats to show!
- Supports icon labels!
- Change the colors as you like-- just be sure to use hex color codes!
- Compatible with Yanfly Status Menu Core-- read help for more info

Screenshots



Version History
1.0 plugin released

Credit
mjshi
 

Lonewulf123

Veteran
Veteran
Joined
Oct 13, 2014
Messages
300
Reaction score
89
First Language
Enlish
Thank you for taking on my request! It's awesome and works perfectly for me!
 

kovak

Silverguard
Veteran
Joined
Apr 3, 2016
Messages
1,263
Reaction score
1,565
First Language
PT - EN
Primarily Uses
RMMV
Just in case you can't download remember to login in your dropbox account.
 

kovak

Silverguard
Veteran
Joined
Apr 3, 2016
Messages
1,263
Reaction score
1,565
First Language
PT - EN
Primarily Uses
RMMV
I had to edit my post cuz for some reason i could download it only after log in my acc
 

Lionheart_84

Veteran
Veteran
Joined
Oct 27, 2015
Messages
536
Reaction score
48
First Language
Italian
Primarily Uses
Beautiful idea !!! You can do that figure in the middle ... blinking ???
 

Johnboy

Veteran
Veteran
Joined
Jan 13, 2016
Messages
344
Reaction score
124
First Language
English
Primarily Uses
@mjshi Is there any way I can replace the bars in Yanfly's Status Menu core? I would like to remove the bars and have just this polygon to represent my statistics to my players. Or maybe even call this in a separate window or with a separate menu command?
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
968
Reaction score
805
First Language
English
Primarily Uses
N/A
@Johnboy In StatPolygon.js, find these lines:

Code:
if (Imported.YEP_StatusMenuCore) {
Window_StatusInfo.prototype.drawParameters = function() {
    var dx = indent;
    var dy = this.lineHeight() / 2;
    var dw = this.contents.width - indent;
    var dh = this.lineHeight();
    var dw2;
    var text;
    this.changeTextColor(this.systemColor());
    this.drawText(Yanfly.Param.StatusGraphText, dx, dy, dw, 'center');
    dy = this.lineHeight();
    dx = indent;
    dw -= this.standardPadding() * 2;
    for (var i = 2; i < 8; ++i) {
        dy += this.lineHeight();
        var rate = this.drawParamGauge(dx, dy, dw, i);
        this.changeTextColor(this.systemColor());
        this.drawText(TextManager.param(i), dx + 4, dy, dw - 4);
        text = Yanfly.Util.toGroup(this._actor.param(i))
        this.changeTextColor(this.normalColor());
        dw2 = dw * rate;
        this.drawText(text, dx, dy, dw2 - 4, 'right');
    }
and delete everything from this.changeTextColor(this.systemColor()); to this.drawText(text, dx, dy, dw2 - 4, 'right')... all the way to the closing brace } (lines 248 to 262).
 

MORINGA

Veteran
Veteran
Joined
Apr 23, 2017
Messages
30
Reaction score
11
First Language
English
Primarily Uses
RMMV
Hum...can anyone help me with this one? I can't seem to make it work at all...
(Edit: turned off Yanfly's StatusMenuCore, it works! Thanks a lot! =)
I won't be using StatusMenuCore, anyway, so this might be perfect for my project. Again, thanks a lot!)
 
Last edited:

Lonewulf123

Veteran
Veteran
Joined
Oct 13, 2014
Messages
300
Reaction score
89
First Language
Enlish
Hum...can anyone help me with this one? I can't seem to make it work at all...
You've come to the right place, but you'll need to be more specific with the issue you have. What other scripts are you using? Did you try in a fresh project?
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
968
Reaction score
805
First Language
English
Primarily Uses
N/A
@MORINGA This plugin is compatible with Status Menu Core. Make sure to read the help file! If it isn't showing up your Center X and Center Y values probably need to be adjusted.
 

Harken_W

Veteran
Veteran
Joined
Oct 13, 2015
Messages
80
Reaction score
22
First Language
English
Primarily Uses
N/A
Incoming ridiculous question.

Visually I much prefer this way of showing information compared to just having a list of stats and numbers.

The list of stats and numbers window appears in other places such as the equip screen and status screen.

Is there any way in which this Stat Polygon can just replace that entirely?
So when other plugins/scenes want to show that list of stats, the Stat Polygon would be there instead of the list.

TL;DR No more list, only Polygon.
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
968
Reaction score
805
First Language
English
Primarily Uses
N/A
@Harken_W

Do you mean to have two different stat polygons in the equip/status screen that show the changes?
Really, the part of the plugin drawing the entire thing is just the stuff in

Window_Status.prototype.drawParameters = function(x, y) {
and under

//Begin edits
//draw polygon

The actual function that draws the polygon is just

this.contents.SPolyDrawStatPolygon(this._actor);

so if you copy/pasted that to other windows you could have stat polygons there also. However, if you wanted to make two stat polygons side by side you'd have to move the x and y coordinates around a bit and to show the changes rather than this._actor use this._tempActor for the second stat polygon.

But otherwise, there's no built in function for that.
 

Harken_W

Veteran
Veteran
Joined
Oct 13, 2015
Messages
80
Reaction score
22
First Language
English
Primarily Uses
N/A
Not two stat polygons side by side, just this same stat polygon appearing in different places,
so I believe it was the 'this.contents.SPolyDrawStatPolygon(this._actor);' part that I was after!

Thanks for the quick reply and awesome plugin :D
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
968
Reaction score
805
First Language
English
Primarily Uses
N/A
@Harken_W No problem! Also, if you want to make that polygon anywhere else but also have the icons/text etc just copy/paste the relevant portions later on labelled "//draw icon" and "//draw text", respectively.

You might run into issues later on with positioning since the entire thing uses a global x and y variable. You can remedy that by finding this part:

Code:
Bitmap.prototype.SPolyDrawStatPolygon = function(actor) {
    var cx = centerX, cy = centerY;

...(etc code stuff)...

};
and changing that var cx = centerX thing to this:
Code:
Bitmap.prototype.SPolyDrawStatPolygon = function(actor, x, y) {
    if (x !== undefined) {
        var cx = x, cy = y;
    } else {
        var cx = centerX, cy = centerY;
    }

...(etc code stuff)...

};
This way when you call this.contents.SPolyDrawStatPolygon(this._actor); you can also specify a center x and y coordinate.

Example:
this.contents.SPolyDrawStatPolygon(this._actor, 100, 200);
to center it at x=100 and y=200.
 

Zack Phoenix

Artist
Veteran
Joined
Jun 12, 2013
Messages
187
Reaction score
26
First Language
German
Primarily Uses
RMMV
This is so simple yet so awesome and helps to show players information in a way that lets them immediately distinguish strengths and weaknesses. This would be awesome for element resistances etc. too!
Thanks and great job!

Edit:
I do seem to have a problem. Showing the stats on level 1 seems just fine, but as soon as I test it with their initial level being something like 20, all the graphs are completely maxed out.
Do I do something wrong or does the graph not "grow" with the stats? It should probably always be a relative value.
 
Last edited:

Lonewulf123

Veteran
Veteran
Joined
Oct 13, 2014
Messages
300
Reaction score
89
First Language
Enlish
This is so simple yet so awesome and helps to show players information in a way that lets them immediately distinguish strengths and weaknesses. This would be awesome for element resistances etc. too!
Thanks and great job!

Edit:
I do seem to have a problem. Showing the stats on level 1 seems just fine, but as soon as I test it with their initial level being something like 20, all the graphs are completely maxed out.
Do I do something wrong or does the graph not "grow" with the stats? It should probably always be a relative value.
You have to adjust the “max stats” value in the plugin parameters I believe. You can’t change the maximum value dynamically with each level.
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
968
Reaction score
805
First Language
English
Primarily Uses
N/A
@Zack Phoenix It's just as Lonewulf123 said. The default "max stat" values are set intentionally low, so that differences in stats are immediately obvious the second you enable the plugin. However, for it to be useful realistically, you're going to have to decide what approximate upper maximum the stats in your game are going to have.

If you know a little bit about coding and want to change how that's decided though, the relevant portion is this:
Code:
Bitmap.prototype.SPolyDrawStatPolygon = function(actor) {
    var cx = centerX, cy = centerY;

    //draw graph background
    for (var i = 0; i < numSegments; i++) this.SPolyDrawRegularPolygon(cx, cy, radius - (i * radius/numSegments), sides, secondaryColor, lineWeight);
  
    //draw lines
    for (var i = 0; i < sides; i++) this.SPolyDrawLine(cx, cy, cx + radius * Math.cos(Math.PI/2 + i * 2 * Math.PI / sides), cy - radius * Math.sin(Math.PI/2 + i * 2 * Math.PI / sides), secondaryColor, lineWeight);

    //draw stat polygon
    var points = [];
    for (var i = 0; i < stats.length; i++) {
        points.push(cx + Math.min(actor.param(stats[i]) / maxStats[i], 1) * radius * Math.cos(Math.PI/2 + i * 2 * Math.PI / sides));
        points.push(cy - Math.min(actor.param(stats[i]) / maxStats[i], 1) * radius * Math.sin(Math.PI/2 + i * 2 * Math.PI / sides));
    }
    this.SPolyDrawPolygon(points, primaryColor, lineWeight2);
};
Change what the bolded text is. This value should go from 0 to 1 (so 0 to 100% of the polygon). Currently it's based on the percentage created from the actor's current stats divided by the approximate maximum stat.
Math.min(actor.param(stats) / maxStats, 1)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

So I'm practicing ITC with a spirit box, and decide to try to contact my deceased soulmate. It actually gave me multiple identifiers. Me, still a bit skeptical, asked aloud "Fine but does he still love me?" and the box spoke and printed the word "Forever" at the same time. Been a mess of tears since. :kaocry:
Been scratching away at my game and making progress, but just had a revelation. I'm working in full screen and adjusting all my pictures accordingly, but will they resize if someone's screen is smaller?? I hope this doesn't turn out to be a problem later.
Why is there so much month left at the end of money? D=
Hello humans! How goes your day in this journey of living? I hope it is good, for I am human like you, and I am feeling great! Worship the altar.

Forum statistics

Threads
105,627
Messages
1,015,074
Members
137,288
Latest member
GmOcean
Top