YEP Battle Status Window Extension

Discussion in 'JS Plugin Releases (RMMV)' started by DreamX, Jul 19, 2016.

  1. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    This is an extension plugin for YEP Battle Status Window by Yanfly.


    This plugin adds several parameters to customize the battle hud.


    I'm also very open to adding more options based on feedback.


    This plugin is used best when you know some javascript, so try asking here or in the help sections for javascript to learn more if you need to.


    Example I did using the parameters and some javascript:


    Untitled.png


    * ============================================================================
    * Actor Notetags
    * ============================================================================
    * <HideBattleStatusHp> will hide the hp gauge from the battle status window
    * for the actor.
    *
    * <HideBattleStatusMp> will hide the mp gauge from the battle status window
    * for the actor.
    *
    * <HideBattleStatusTp> will hide the tp gauge from the battle status window
    * for the actor.
    *
    * <HideBattleStatusAtb> will hide the tp gauge from the battle status window
    * for the actor.
    *
    * <BattlerPicture: x> will use x as the actor's picture. See parameters.
    * ============================================================================
    * Tips
    * ============================================================================
    * Other Yanfly plugins like Core Engine, Buffs State Core and of course
    * Battle Status will change how the battle hud looks like. Also look at those
    * parameters to customize your hud.
    *
    * The rect variable refers to the entire rectangle. It's best to use this
    * instead of basicAreaRect, gaugeRect etc if you want to change positioning.
    * ============================================================================
    * DreamX Setup Suggestion Parameter Info
    * ============================================================================
    * This parameter sets up the hud similar to my example screenshot.
    * It overrides parameters for these things:
    *
    * Face X, Width, Height
    * Gauge/Name X, Width
    *
    * Name Y
    * HP Gauge Y
    * MP Gauge Y
    *
    * Icons X, Y
    *
    * Name Alignment
    *
    * Adjust Columns set to true in YEP Battle Status Window
    *
    * Therefore, you can still use the other parameters to your liking to
    * customize further.
    *
    * You can also of course individually use the functions provided by this
    * plugin.
    * ============================================================================
    * Terms Of Use
    * ============================================================================
    * Free to use and modify for commercial and noncommercial games, with credit.
    * ============================================================================
    * Credits
    * ============================================================================
    * DreamX
    * Yanfly for YEP Battle Status Window


    Script
     
    Last edited by a moderator: Oct 13, 2016
    #1
    caethyril, jihoon, Nanaya and 23 others like this.
  2. Aidensmercy

    Aidensmercy Veteran Veteran

    Messages:
    121
    Likes Received:
    24
    First Language:
    english
    Very nice, I always enjoy a plugin that gives some customizing features.


    Is there any way of adding that LP stat as a variable from you Permadeath plugin, say instead of the TP or something?
     
    #2
  3. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    Will it be a gauge or just text?
     
    #3
  4. Aidensmercy

    Aidensmercy Veteran Veteran

    Messages:
    121
    Likes Received:
    24
    First Language:
    english
    For me, I would like just the text.
     
    #4
  5. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English


    Make a plugin, paste this code in and adjust it if you want, then turn the plugin on.


    alias_Window_BattleStatus_drawItem = Window_BattleStatus.prototype.drawItem;
    Window_BattleStatus.prototype.drawItem = function (index) {
    alias_Window_BattleStatus_drawItem.call(this, index);
    var actor = $gameParty.battleMembers()[index];
    var variableId = actor.actor().meta.NoPermadeathVariable;

    if (!variableId) {
    return;
    }

    var rect = this.itemRect(index);

    variableId = parseInt(variableId.trim());

    // adjust the text as you wish
    var text = "LP: " + $gameVariables.value(variableId);

    // adjust the x position by changing 0 to something else
    var x = rect.x + 0;

    // adjust the y position by changing 0 to something else
    var y = rect.y + 0;

    this.drawTextEx(text, x, y);
    };


    This will draw the lifepoints of the actor. The way it is in this example it is drawn on the upper left, but you can adjust it.
     
    #5
  6. Aidensmercy

    Aidensmercy Veteran Veteran

    Messages:
    121
    Likes Received:
    24
    First Language:
    english
    thank you very much, it works perfectly!
     
    #6
    DreamX likes this.
  7. MrPurpleDreadlocks

    MrPurpleDreadlocks Veteran Veteran

    Messages:
    159
    Likes Received:
    19
    First Language:
    English
    I really like how you set up your HUD. What settings would I have to change to emulate that?


    Thanks so much!
     
    #7
  8. RogdagoR

    RogdagoR Veteran Veteran

    Messages:
    127
    Likes Received:
    29
    Location:
    Venice
    First Language:
    Italian
    This is nice! How can i remove the MP bar and place there only a circle bar with a counter inside showing the current amount of MP? Or just the counter without the circle bar, or something like the picture

    cross-edge-20090529080141892-000.jpg
     
    #8
  9. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    You can remove the mp bar by turning the Draw MP Gauge parameter off.


    I haven't seen a circle gauge in MV before.


    Here's how to draw the actor's current mp. Adjust x and y values as you want.


    alias_Window_BattleStatus_drawItem = Window_BattleStatus.prototype.drawItem;
    Window_BattleStatus.prototype.drawItem = function (index) {
    alias_Window_BattleStatus_drawItem.call(this, index);
    var actor = $gameParty.battleMembers()[index];

    var rect = this.itemRect(index);

    // adjust the text as you wish
    var text = "" + actor.mp;

    // adjust the x position by changing 0 to something else
    var x = rect.x + 0;

    // adjust the y position by changing 0 to something else
    var y = rect.y + 0;

    this.drawTextEx(text, x, y);
    };





    I used these functions and put into a plugin:


    Window_BattleStatus.prototype.DXIconX = function (actor, rect) {
    if (actor.actor().meta.IsPlayer) {
    return rect.x + this.textPadding();
    }

    var availableSpace = this.DXRectFreeSpace(rect);

    var x2 = rect.x + rect.width;
    if (availableSpace < actor.allIcons().length * Window_Base._iconWidth) {
    return x2 - (actor.allIcons().length * Window_Base._iconWidth) - this.textPadding();
    } else {
    return rect.x + Window_Base._faceWidth;
    }
    };

    Window_BattleStatus.prototype.DXIconW = function (actor, rect) {
    if (actor.actor().meta.IsPlayer) {
    return rect.width - (this.textPadding() * 2);
    }

    var x2 = rect.x + rect.width;

    if (this.DXRectFreeSpace(rect) + Window_Base._iconWidth
    < actor.allIcons() * Window_Base._iconWidth) {
    return x2 - (x2 - (actor.allIcons() * Window_Base._iconWidth));
    } else {
    return this.DXRectFreeSpace(rect) + Window_Base._iconWidth;
    }
    };

    Window_BattleStatus.prototype.DXThreshold = function () {
    return 64;
    };

    Window_BattleStatus.prototype.DXGaugeNameX = function (actor, rect) {
    if (actor.actor().meta.IsPlayer) {
    return rect.x + this.textPadding();
    }

    var availableSpace = this.DXRectFreeSpace(rect);

    if (availableSpace > this.DXThreshold()) {
    return rect.x + rect.width - (this.DXRectFreeSpace(rect));
    } else {
    return rect.x + rect.width - (this.DXRectFreeSpace(rect)
    + Window_Base._iconWidth);
    }
    };

    Window_BattleStatus.prototype.DXGaugeNameWidth = function (actor, rect) {
    if (actor.actor().meta.IsPlayer) {
    return rect.width - (this.textPadding() * 2);
    }

    var availableSpace = this.DXRectFreeSpace(rect);

    if (availableSpace > this.DXThreshold()) {
    return this.DXRectFreeSpace(rect) - this.textPadding();
    } else {
    return (this.DXRectFreeSpace(rect) - this.textPadding())
    + Window_Base._iconWidth;
    }
    };


    Window_BattleStatus.prototype.DXRectFreeSpace = function (rect) {
    return rect.width - Window_Base._faceWidth;
    };




    For gauge/name x parameters:


    this.DXGaugeNameX(actor, rect)


    For gauge/name width parameters:


    this.DXGaugeNameWidth(actor, rect)


    For Hp Gauge Y:


    rect.y + this.lineHeight()


    For Mp Gauge Y:


    rect.y + this.lineHeight() * 2




    For name y:


    rect.y




    For icons x:


    this.DXIconX(actor, rect)


    For icons y:


    rect.y + rect.height - Window_Base._iconHeight - this.textPadding()


    In the screenshot I had also had adjust columns in YEP Battle Status Window turned on and I edited the gauge height/font size in YEP Core Engine.


    I didn't use TP so for that you'll have to decide what you put in. It's a good idea to learn a little programming to get things exactly the way you want.
     
    Last edited by a moderator: Jul 20, 2016
    #9
  10. MrPurpleDreadlocks

    MrPurpleDreadlocks Veteran Veteran

    Messages:
    159
    Likes Received:
    19
    First Language:
    English


    Oh I know a bit of Javascript. I've coded and translated a lot of scripts from Ruby to Javascript. (All on my own mind you) Just didn't know where to start!


    Thanks. :D
     
    #10
  11. Yanfly

    Yanfly Developer

    Messages:
    1,696
    Likes Received:
    2,321
    #11
    Nanaya, DreamX and Salium like this.
  12. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    Yes, of course :)
     
    #12
    Yanfly likes this.
  13. Neo Soul Gamer

    Neo Soul Gamer Veteran Veteran

    Messages:
    612
    Likes Received:
    329
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    N/A
    Not sure if you're still taking suggestions, but... The Battle Animations.


    Displaying them OVER the Battle Hud would be ideal for Frontview Battle Systems. By default, Yanfly has the priority of the battle animations lower than the Battle Status Window, so they're displayed behind it.
     
    #13
  14. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    1.1:


    Added parameter to get frontview animations displayed over battle status window


    Added parameter to help get hud looking like my example screenshot
    Added parameter to decide whether face image gets drawn for actor
    Fixed default parameter for MP Gauge Width
     
    #14
  15. Neo Soul Gamer

    Neo Soul Gamer Veteran Veteran

    Messages:
    612
    Likes Received:
    329
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    N/A
    Was NOT expecting an answer that fast. That's great work! Going to test it later on today. Thank you!
     
    #15
    DreamX likes this.
  16. Lnik3500

    Lnik3500 Master Troll Veteran

    Messages:
    299
    Likes Received:
    46
    Location:
    Somewhere you will less expect me to be.
    First Language:
    French
    Primarily Uses:
    RMMV
    Looks really nice :D  


    By the way, do you mind giving me a start on how to reposition the window and make it vertically?


    If it's not present, I would like to make it as a request then :p  


    Thank you for this plugin by the way!
     
    #16
  17. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    1.2


    Now requires Yanfly's Battle Engine Core
    Added Battle Status Window X, Y, Width, Height parameters
    Added Actor Command X, Y, Width, Height parameters
    "Frontview Animations On Top" parameter now displays damage popup above window as well
    Added parameter for animations/popups displaying near the center of the actor's face image
    in frontview
    Added compatibility with Yanfly's Visual HP Gauge


    Edit: Note: The damage popup x value for centering doesn't account for the text length without Victor Sant's Damage Popups plugin, which I really recommend. I wrote an extension for it to get it to work with Battle Engine Core here.

    It's possible now with the parameters I added. That said, it's probably better if you give me a mock-up or example of what you want it to look like and I can help you out from there.
     
    Last edited by a moderator: Jul 29, 2016
    #17
    Lnik3500 and RogdagoR like this.
  18. Lnik3500

    Lnik3500 Master Troll Veteran

    Messages:
    299
    Likes Received:
    46
    Location:
    Somewhere you will less expect me to be.
    First Language:
    French
    Primarily Uses:
    RMMV
    Wow! as you requested, i did some screenshots of my previous system and I thought I would like to reproduce it using this marvelous plugin :p  


    How the party command looked:

    [​IMG]



    How the actor command looked:

    [​IMG]





    The actor command window would change position to align with the corresponding actor:

    [​IMG]





    This was done using Mog_BattleHud, but I wanted to switch to yours since it's more friendly with other plugins (mainly VE_DamagePopup)


    So I request other things, but sure is optional since it derives from your plugin's goal:


    - Align Actor Command with Actor's faces (Optional)


    - Customize Party Command Width, Height, X and Y position


    - (Very optional) Customize other windows Width, Height, X and Y position (including Help Window, Skill Window, Target Window, Item Window, etc)


    Other than that, since you did a very good effort just for satisfying my request, I will customize my windows myself using your plugin. After all, it's my turn to work on it a little bit :p  


    Customizing other windows would be nice, but please do it only if you feel it will help others or if you want to do it anyway.


    With this, thank you for your plugin and sorry for my english :D
     
    #18
    DreamX likes this.
  19. ramza

    ramza Lunatic Coder Veteran

    Messages:
    541
    Likes Received:
    296
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I like the extra customization given by this extension, but it seems like there is a lot of wasted space in between the actor's name, and the HP/MP bars, at least in my usage case because I don't use TP or ATB. The empty space could be filled by more state icons, but for some reason, they only ever show one single row of them. Is it possible to use this to show more than one row of state icons?


    I don't have a widescreen resolution, so I can only get a maximum of four icons to show onscreen using this setup, without using the battle status plugin I was able to show six icons by decreasing the gauge and name areas.

    battlestatus.PNG
     
    #19
  20. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    All of this is customizable. How much space is left can be configured by changing the x, y, width and height values of the parameters. By default without changing any parameters, the battle status window should look exactly how it would if you only used Yanfly's plugin without this extension.

    The default without any plugins is to also show only one row.


    But showing more than one row is a good idea so I made a new parameter for icons height. If it is an integer multiple higher than 1 of the icon height, then more than one row will be shown. For example, with the default icon height, if you wanted to show 2 rows, you'd use 64. For 3 rows, 96, etc. I've made sure it's compatible with Yanfly's turn/counters/buff rate text on the icon from their Buff States Core plugin.


    Untitled.png

    Good idea! i'll try to implement what I can in future versions.
     
    #20
    ramza likes this.

Share This Page