Ellye's ATB (also includes CTB option)

Discussion in 'JS Plugin Releases (RMMV)' started by Mellye, Oct 24, 2015.

  1. clitvin

    clitvin Veteran Veteran

    Messages:
    91
    Likes Received:
    11
    When you get a chance I also have a feature request.

    Conditional atb mods for skills and items. <if state x self_atb: y>

    Basically exactly like the atb mods we have now except they only work if the actor is affected by the specific state. 
     
    SirTwilight likes this.
  2. a6p

    a6p Veteran Veteran

    Messages:
    30
    Likes Received:
    8
    Location:
    Canada
    First Language:
    English
    I'm really happy about the turn ticks. Now poisons and other DoT effects hit multiple times while the atb bar is loading.

    However, the action end option doesn't seem to work for states. Any time I use the action end option, the state just goes away. I'll guard and it'll be removed right away.

    I've been having to replace them with <atb_duration:1000> or something (I lowered the max atb to 1000). Additionally, the turns don't seem to work with Yanfly's Skill Cooldown system.
     
  3. -YS-

    -YS- Veteran Veteran

    Messages:
    118
    Likes Received:
    33
    Hi there, just wanna ask some question, is that possible if the future update is to add the <cast_time:25000> notetag into the armor or weapon tab? so if we equip heavy weapon like axe, the delay will of our normal attack will be more long than if we equip the dagger or sword. It's not a big deal because I can create a whole new attack skill for the axe weapon but that will be a problem if we want to make every weapon casting time is unique and different each.


    I hope it will be planned to the next feature ^^ Thanks.
     
  4. Maliki79

    Maliki79 Veteran Veteran

    Messages:
    636
    Likes Received:
    242
    Location:
    New Jersey
    First Language:
    English
    Primarily Uses:
    N/A
    I made a snippet to temporarily fix this issue and thought I'd share it.


    Since Mellye said they'd be doing a formal update, I didn't add too much.


    Currently, all this does is reduce all actor's atb to 10% for each failed escape attempt.


    No casting cancelling or anything else.


    Hope this helps.


    Link: http://pastebin.com/jp137h3R


    (Put the plugin under both Elle'y Atb and YanFly's battle core in the Plugin Manager.)
     
    Last edited by a moderator: Jan 29, 2016
    Aviziel likes this.
  5. Tohisu

    Tohisu Veteran Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    France
    First Language:
    French
    Primarily Uses:
    RMMV
    How do we have to name this plugin, Maliki79?
     
    Last edited by a moderator: Jan 30, 2016
  6. Maliki79

    Maliki79 Veteran Veteran

    Messages:
    636
    Likes Received:
    242
    Location:
    New Jersey
    First Language:
    English
    Primarily Uses:
    N/A
    There are no parameters, so you can name it what you want.
     
  7. Tohisu

    Tohisu Veteran Veteran

    Messages:
    48
    Likes Received:
    2
    Location:
    France
    First Language:
    French
    Primarily Uses:
    RMMV
    It's working btw, thx.
     
  8. Mellye

    Mellye Veteran Veteran

    Messages:
    347
    Likes Received:
    277
    First Language:
    Portuguese
    Hi! Just wanted to say sorry for the long hiatus - I've had a few personal issues those past months that I'm still dealing with, but things are slowly going back to normal now.


    I think I'll be able to resume working on my scripts soon.
     
    Dankovsky, Defacto1769 and clitvin like this.
  9. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    543
    First Language:
    Chinese
    Primarily Uses:
    N/A
    After reading the implementation of this plugin, right now I'm interested in these 2 parts:


    Possibility for repeated BattleManager.updateEvent

    Spoiler





    BattleManager.update is extended to the below in this plugin:


        //Changing the flow of battle
        _BattleManager_update = BattleManager.update;
        BattleManager.update = function() {
            if (!this.isBusy() && !this.updateEvent())
            {
                switch (this._phase)
                {
                    case 'atb':
                        this.increaseAtbGauges();
                        break;
                    default:
                        _BattleManager_update.call(this);
                        break;
                }
            }
        };


    Where the original BattleManager.update is this:


    BattleManager.update = function() {
        if (!this.isBusy() && !this.updateEvent()) {
            switch (this._phase) {
            case 'start':
                this.startInput();
                break;
            case 'turn':
                this.updateTurn();
                break;
            case 'action':
                this.updateAction();
                break;
            case 'turnEnd':
                this.updateTurnEnd();
                break;
            case 'battleEnd':
                this.updateBattleEnd();
                break;
            }
        }
    };


    When there are no active input window and BattleManager._phase isn't 'atb', BattleManager.updateEvent will be called twice per frame:


    BattleManager.updateEvent = function() {
        switch (this._phase) {
        case 'start':
        case 'turn':
        case 'turnEnd':
            if (this.isActionForced()) {
                this.processForcedAction();
                return true;
            } else {
                return this.updateEventMain();
            }
        }
        return this.checkAbort();
    };


    This can be somehow dangerous when BattleManager._phase is 'turn', as BattleManager.processForcedAction and BattleManager.updateEventMain are these:


    BattleManager.processForcedAction = function() {
        if (this._actionForcedBattler) {
            this._subject = this._actionForcedBattler;
            this._actionForcedBattler = null;
            this.startAction();
            this._subject.removeCurrentAction();
        }
    };


    BattleManager.updateEvent = function() {
        switch (this._phase) {
        case 'start':
        case 'turn':
        case 'turnEnd':
            if (this.isActionForced()) {
                this.processForcedAction();
                return true;
            } else {
                return this.updateEventMain();
            }
        }
        return this.checkAbort();
    };


    BattleManager.updateEventMain = function() {
        $gameTroop.updateInterpreter();
        $gameParty.requestMotionRefresh();
        if ($gameTroop.isEventRunning() || this.checkBattleEnd()) {
            return true;
        }
        $gameTroop.setupBattleEvent();
        if ($gameTroop.isEventRunning() || SceneManager.isSceneChanging()) {
            return true;
        }
        return false;
    };


    If it's so unfortunate that BattleManager.processForcedAction runs in this situation, both BattleManager.startAction and BattleManager._subject.removecurrentAction will be run twice in the same frame, which is at least playing with fire.


    If $gameTroop.updateInterpreter and $gameTroop.setupBattleEvent run twice in the same frame, the battle events can become quite erroneous.


    Luckily, the remedy can be as simple as this:


        //Changing the flow of battle
        _BattleManager_update = BattleManager.update;
        BattleManager.update = function() {
            switch (this._phase)
            {
                case 'atb':


                    if (!this.isBusy() && !this.updateEvent()) {


                        this.increaseAtbGauges();


                    }
                    break;
                default:
                    _BattleManager_update.call(this);
                    break;
            }
        };



    Always updating the whole status window per ATB update

    Spoiler





    BattleManager.increaseAtbGauges will be run per frame as long as the ATB can be updated:


        //Increases the ATB gauges when idle:
        BattleManager.increaseAtbGauges = function() {
            var loopForInstantATB = instant_atb;
            var oneATBFilledAlready = false;
            //================================================
            //ATB LOOP
            //We need to be in a loop here if we're using instant ATB option, but run only once in other cases.
            //================================================
            do
            {
                //==========================================
                //Turn Timer
                //==========================================
                turn_atb += CalculateATBRate(turn_timer);
                //Turn timer finished:
                if (turn_atb >= full_atb)
                {
                    turn_atb -= full_atb;
                    //We advance the troops page (for events and AI) depending on parameter:
                    if (battle_event_turn_mode === 0)
                    {
                        $gameTroop.increaseTurn();
                    }
                    //We apply onTurnEnd if paramaters are set so
                    if (battler_end_turn_effects !== 1)
                    {
                        this.allBattleMembers().forEach(function(battler)
                        {
                            battler.onTurnEnd();
                            this.refreshStatus();
                            this._logWindow.displayAutoAffectedStatus(battler);
                            this._logWindow.displayRegeneration(battler);
                        }, this);
                    }
                }
                //========================================
                //End of turn timer related stuff
                //========================================


                this.allBattleMembers().forEach(function(battler)
                {
                    //States with ATB duration:
                    battler._states_atb_duration.forEach(function(duration, stateID)
                    {
                        battler._states_atb_current[stateID] += CalculateATBRate(battler._states_atb_rate[stateID], 100);
                        if (battler._states_atb_current[stateID] >= duration)
                        {
                            battler.removeState(stateID);
                        }
                    }, this);


                    //Dead battler has no ATB nor cast:
                    if (battler.isDead())
                    {
                        battler.atb = 0;
                        battler.resetCast();
                    }
                    //====================
                    //Casting time logic:
                    //====================
                    //Cast finished:
                    else if (battler.finished_casting === true)
                    {
                        battler.resetCast();
                    }
                    //Currently casting:
                    else if (battler.target_cast_atb > 0)
                    {
                        //Got stunned or similar while casting, auto-interrupt for now:
                        if (!battler.canMove())
                        {
                            battler.BreakCurrentCast(true);
                        }
                        else
                        {
                            battler.current_cast_atb += battler._cast_rate * (battler.CastHaste() / 100);
                            if (battler.current_cast_atb >= battler.target_cast_atb && oneATBFilledAlready === false)
                            {
                                battler.finished_casting = true;
                                this.battlerHasFullAtb(battler, true);
                                oneATBFilledAlready = true;
                                loopForInstantATB = 0;
                            }
                        }
                    }
                    //===================
                    //Not casting, ATB INCREASE:
                    //===================
                    else
                    {
                        battler.atb += battler.calculateATBRate();
                    }
                    if (battler.atb >= full_atb && oneATBFilledAlready === false && battler.target_cast_atb <= 0)
                    {
                        this.battlerHasFullAtb(battler);
                        oneATBFilledAlready = true;
                        loopForInstantATB = 0;
                    }
                }, this);
            } while (loopForInstantATB === 1);
            //==============================
            //END OF THE ATB LOOP
            //=============================
            this.refreshStatus();
        };


    It's crystal clear and obvious that the whole status window's redrawn per BattleManager.increaseAtbGauges, which can be run per frame.


    Except for extremely powerful machines, redrawing the whole status window per frame is extremely likely to lead to at least significant, if not just outright severe, constant lag and FPS drop.


    In my machine(i7-3820 + 2 * 2GB DDR3-1333 + Asus GTX550Ti), redrawing the whole status window per frame led to about 12ms added load per frame even after I've updated the display card driver to the latest version leading to about 100% RMMV performance boost. For machines barely meeting the RMMV requirements, the added load can only be more.


    I've benchmarked the time performance of this plugin in my machine and the final load per frame is 15ms with status window being redrawn per frame, which is just 2ms away from the final load per frame leading to detectable FPS drop. It's because the targeted FPS in RMMV is 60, which is under 17ms load per frame. For machines barely meeting the RMMV requirements, the final load of this plugin without redrawing the status window per frame will likely reach or even far exceed 17ms, leading to at least noticeable FPS drop.


    Actually, just redrawing all actors' ATB bars will suffice. Even though it'll lead to the ATB bar description text being slightly ugly, it's still trivial compared to be much more serious performance issues.


    The other parts of the status window will only need to be redrawn when at least 1 actor's refreshed. If the existing entry points for redrawing the whole status window, including BattleManager.refreshStatus and Scene_Battle.prototype.refreshStatus might be not enough, Game_Battler.prototype.refresh can be used as well to ensure all reasons of redrawing the whole status window are completed covered.


    2 exceptions of this are that, when the maximum ATB bar length decreases and/or the ATB bar description text changes, the whole status window will have to be redrawn, otherwise the newly drawn ATB bars wouldn't completely cover the old one, and/or thenew text would just be drawn over the old ones, which would still remain drawn on the status window.


    While more can be done when optimizing time performance here(like only redrawing an actor ATB bar when its maximum length increases, its colors change and/or its fill percent changes, which can lead to only 1ms added load per frame per actor ATB bar to be redrawn in my machine), the above performance optimization alone should  make this plugin much more performant.
     
    Last edited by a moderator: Feb 10, 2016
  10. Zanryu99

    Zanryu99 Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    English
    Been looking around trying to find some helpful plugins and I have to say, this is my favourite so far!


    I was wondering though - I'm thinking of a system where my game runs off a fatigue system, so you can perform attacks so long as you have the STAMINA available to you; having the ability to specify changes to the ATB level in each skill is great, but what I'd need to do is allow actions to be taken provided you have ANY of your ATB available, but have a wait time in between each action; then if/when ATB hits '0', your character is fatigued and can not act until ATB has recharged some.


    my coding knowledge is very basic, and was self-taught about 6 years ago. If anyone could help me figure out how to do this in this plugin, that'd be wonderful!
     
  11. Pazuzu10

    Pazuzu10 Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    Good morning. I tried to get the plugin today, but the download doesn't have anything in it. It saves as a Javascript and it came right from the pastepin link on this post. Any idea what could be happening?


    Couple days later: Never mind, I figured it out. 
     
    Last edited by a moderator: Apr 24, 2016
  12. leap.campione

    leap.campione Villager Member

    Messages:
    6
    Likes Received:
    0
    Found out that the casting motion doesn't end well if Yanfly's Battle Engine Core is on.
     
     
  13. Megablackdragon31

    Megablackdragon31 Veteran Veteran

    Messages:
    215
    Likes Received:
    35
    Location:
    Argentina
    First Language:
    Spanish
    That is a compatibility problem... Patches seems to stop working when Yanfly update his battle engine.
     
  14. CoolWill1984

    CoolWill1984 Villager Member

    Messages:
    23
    Likes Received:
    2
    First Language:
    English
    Do you happen to have another download of this. When I try to download it from pastebin my antivirus says it has a virus and removes it.
     
  15. Forthright

    Forthright Veteran Veteran

    Messages:
    60
    Likes Received:
    10
    First Language:
    English
    Just click the link, copy and paste it all into Notepad + and save it as a .js
     
  16. atmanSeijo

    atmanSeijo Veteran Veteran

    Messages:
    30
    Likes Received:
    3
    Location:
    The Void Below
    First Language:
    English
    Primarily Uses:
    RMMV
    Hey, so, I've come across a bit of a problem. I wanted to get rid of the Fight/Escape window altogether and instead give my characters an Escape skill that they can all use, that way it shows up in the main battle window. But having Display Fight/Escape set to 0 and Allow Escape set to 1 still shows the Fight/Escape window. If I set Allow Escape to 0, then the characters escape and the game just gets stuck on the empty battle screen. Is there a fix to this?


    Ah, sorry. I tested it a bit more and I was able to get it to work, false alarm.
     
    Last edited by a moderator: Nov 14, 2016
  17. HasuHasi

    HasuHasi Learning every day Veteran

    Messages:
    48
    Likes Received:
    3
    Location:
    Switzerland
    First Language:
    English
    Hey guys, I really like how this ATB system seems to work. I use a lot of the yanfly plugins and also used his ATB until now, but apparently he is not supporting it anymore. I especially like, that you can see, what the name of the skill is, that the enemy is charging. I was never able to do that with yanfly's ATB. So I've been thinking to switch to a different ATB system, like this one or maybe like VE. I'd love to be able to stick to the rest of the yanfly plugins though - if at all possible...


    So my question is: Does this ATB work good in general? And is it compatible with the yanfly plugins? For exmaple: can I use the yanfly skill cooldown plugin together with this?
     
  18. Solis

    Solis Veteran Veteran

    Messages:
    366
    Likes Received:
    84
    First Language:
    English
     





    @HasuHasi I liked this one when it first came out.  I'm not sure if it is still supported to be honest. If it is, I'd recommend it, if it is not, I'd check out Victor's ATB. 
     
    Last edited by a moderator: Dec 23, 2016
  19. HasuHasi

    HasuHasi Learning every day Veteran

    Messages:
    48
    Likes Received:
    3
    Location:
    Switzerland
    First Language:
    English
    @Solis Thanks for your input. Today I tried VE ATB, but I couldn't get it to work with Yanfly library. When I install VE BasicModule it's still compatible. But as soon as I activate the VE_ATB it stops working (I get the error message that I cant use VE BasicModule with Yanfly BattleEngineCore). 


    So next I tried Ellye's ATB and until now it works just fine with Yanfly's things. I'll do some more testing the next days, but so far I'm optimistic. The only thing I'm missing is a ATB Charge Bar, but I guess I can live without it :)
     
  20. Solis

    Solis Veteran Veteran

    Messages:
    366
    Likes Received:
    84
    First Language:
    English
    I am using Yanfly's ATB and I have ran into zero issues so far. Hope that helps. 
     

Share This Page