[DYNRPG] BATTLE: ATB OVERHAUL!

Formerly Advanced Faster ATB 2

========================================================================
ATB OVERHAUL (formerly Advanced Faster ATB 2) v1.7
For RPG Maker 2003 with DynRPG v0.20 or higher
By PepsiOtaku
========================================================================

This patch allows you to control the speed calculations of party members and monsters independently, in turn controlling the speed of ATB bar. It uses the formula:

************************************
(ActiveSpeed or WaitSpeed) + ((AddValue * Agility) * (HeroSpeed or MonsterSpeed))
************************************

The maximum value the ATB Speed can be is 30000, which will trigger the battler's next action. The AddValue is a hard-coded number you set within the DynRPG.ini file. 300 is the recommended value, but you can decrease/increase this value to your desired result. The SpeedVar is a multiplier that you can set via variable from within RPG Maker.

The formula gets calculated a few times a second, so if you set your AddValue to 125 & the SpeedVar to 12, while the agility is 20 (multiplying to 30000) you would get an instantaneous ATB bar (which also makes things a little easy) forcing each party member's action. The lower the AddValue, the higher your SpeedVar value needs to be.

While you can't technically "stop" the ATB bar using that formula, you can set the SpeedVar to a negative value in RPG maker, which would make the ATB bar go backwards in game until it hits 0 and remains there until the SpeedVar is changed again.


What's NEW:

* v1.7: Fixed a bug in condition_speed_check where speed wouldn't reset when condition wore off (like a Berserk condition where speed increases)

* v1.6: More bug-fixes, StartInWaitMode, OnlyShowCommandWhenFocused, FixSelectionBarHeight, new recommended AddValue & ActiveSpeed, improved this readme hopefully

* v1.5: More tweaks and bug-fixes!

* v1.4: More bug squashing. Prevented the ATB bars from moving while any selection windows are open, with the exception of command and party member selections

* v1.3: Squashed hopefully the last bug--added more checks in the onBattleStatusWindowDrawn code.

* v1.2: Squashed some bugs. Added the ability to halt & resume via comment command

* v1.0: Added "FreezeSwitch" which will freeze all actions when turned on. You MUST turn this off again when you are done.

* v1.0: Added "WaitSpeed" which will set the Wait speed to a value, similar to "ActiveSpeed."

Installation

To install the plugin, make sure that you have patched your project with cherry's DynRPG patch which can be found here:
http://share.cherrytree.at/showfile-24504/dynrpg_0_31_05_26_2016.rar (Link for 0.31 - latest)
http://www.rewking.com/dynrpg
http://cherrytree.at/dynrpg

1. Copy the "battle_atb_overhaul.dll"into the DynPlugins folder of your own project.

2. Add the following (between the asterisks) to your DynRPG.ini

**********************************************


[battle_atb_overhaul]
; Starts the game (or test play) in Wait Mode instead of Active mode (Active is 2k3's default)
StartInWaitMode=false
; In Alternative mode, only show the command window (Attack/Magic/etc) when a hero has been selected
OnlyShowCommandWhenFocused=false
; FixSelectionBarHeight makes the selection bar height 16px instead of 15px in Command, Item & Skill windows.
; It might look better depending on your SystemSet or preference
FixSelectionBarHeight=false
; Switch ON = Active, Switch OFF = Wait
ATBmodeSwitch=4004
; ...(ActiveSpeed or WaitSpeed) + ((AddValue * Agility) * SpeedVar)...
; Default = 300
AddValue=300
; Set MultiplyAgility to false to change the formula to ...Base ATB Speed + (AddValue * SpeedVar)...
MultiplyAgility=true
; Master Variables. The 12 variables starting with BattlerStartVar get set to these
HeroSpeedMasterVar=4001
MonsterSpeedMasterVar=4015
; Heroes Require 4 vars: BattlerStartVar+0,+1,+2,+3
; Monsters Requires 8 vars: BattlerStartVar+4,+5,+6,+7,+8,+9,+10,+11
BattlerStartVar=4041
; Default multiplier values
DefaultHeroSpeed=3
DefaultMonsterSpeed=3
; ActiveSpeed default = 50. 100 is RM2k3's default speed, so it's recommended to set less
; so that modifiers would be more precise. Setting to 0 would always force WAIT mode.
ActiveSpeed=50
; WaitSpeed default = 0. Set to the same value as ActiveSpeed to force ACTIVE mode.
WaitSpeed=0
; Switch that will freeze the ATB bars if turned on
FreezeSwitch=4048
; Add condition exceptions here, separated by commas (ex: CondtionException=7,8,12,13)
; This will prevent the ATB bar from moving while a condition has "No Action Allowed"
ConditionExceptions=

**********************************************


3. Set "StartInWaitMode" to true to start the game (or test play) in Wait Mode instead of Active mode (Active is 2k3's default)

4. Set "OnlyShowCommandWhenFocused" to true to only show the command window when a hero has been selected (special feature of this plugin)

5. Set "FixSelectionBarHeight" to true to make the selection bar height 16px instead of 15px in Command, Item & Skill windows. If you don't know what this means, leave it at false, but this might look better depending on your SystemSet or preference.

6. Set "ATBmodeSwitch" to the switch value of your choice to change the ATB mode by switch. Switch ON = Active, Switch OFF = Wait

7. "AddValue" is for speed calculations (See top paragraphs). This can be set to any value between 0 and 30000, but you must figure out how this would affect the ATB formula.

8. Set "MultiplyAgility" to false to remove Agility from the formula, making it:
(ActiveSpeed or WaitSpeed) + (AddValue * (HeroSpeed or MonsterSpeed))

9. Change "HeroSpeedMasterVar" to the Variable ID of your choice. This variable controls the Master Speed multiplier for party members. 4001 is the default.

10. "Change MonsterSpeedMasterVar" to the Variable ID of your choice. This variable controls the Master Speed multiplier for monsters. 4015 is the default

11. Change "BattlerStartVar" to the Variable ID of your choice. 12 variables starting from here will be used for the ATB speed multipliers of individual battlers. The first 4 will be for battlers (4041-4044) while the last 8 will be used for monsters (4045-4052)
Example naming scheme:
4041:DynRPG-Hero1Speed
4042:DynRPG-Hero2Speed
4043:DynRPG-Hero3Speed
4044:DynRPG-Hero4Speed
4045:DynRPG-Monster1Speed
4046:DynRPG-Monster2Speed
4047:DynRPG-Monster3Speed
4048:DynRPG-Monster4Speed
4049:DynRPG-Monster5Speed
4050:DynRPG-Monster6Speed
4051:DynRPG-Monster7Speed
4052:DynRPG-Monster8Speed

12. Change "DefaultHeroSpeed" & "DefaultMonsterSpeed" to the default multiplier value of your choice. I use "3" but you can change this to whichever multiplier works best for you.
NOTE: "0" would override the whole formula, and use RM2k3's default ATB speed if you wish to do so
EXAMPLE: Say you have a menu that has "Battle Speed" from 1-5 where 1 is slowest and 5 is fastest. Using this plugin, you can scale the battle speed to something that feels right to you for each of those settings, and use the DefaultHeroSpeed/DefaultMonsterSpeed variable in the menu itself.

13. Set "ActiveSpeed" to a value less than or equal to 100 (100 is rm23k's default speed). This will change the overall speed.

14. Set "WaitSpeed" to a value other than 0 if desired.

15. Set "FreezeSwitch" to a Switch ID of your choice. When turned on, this will freeze the battle until the switch has been turned off again.

16. Set "ConditionExceptions" to the condition IDs that are set to "No Action Allowed", separated by commas (example: CondtionException=7,8,12,13). When a party member becomes afflicted with one of these, their ATB bar will be reset to 0 (as it's frozen) and will not increment whatsoever.


Instructions

This plugin takes three commands:
@init_hero_speed:
Reinitializes the 4 hero variables to the value of the Master Hero Variable
(this is done automatically at the start of battle)

@init_monster_speed:
Reinitializes the 8 hero variables to the value of the Master Hero Variable
(regardless of how many monsters there are, since it doesn't matter)
(this is done automatically at the start of battle)

@condition_speed_check p1, p2, p3, optionalText
p1: Condition ID
p2: Altered hero speed value
p3: Altered monster speed value
optionalText: This can be anything and has no meaning other than to tell you what condition is being checked
Using the technique documented below, this will check for a specific condition (p1) and if a hero/monster has that condition, their speed will be altered to hero's value (p2) & monster's value (p3) respectively. You can add text after the 3rd parameter for easy reference to the condition you're checking for. (example: @condition_speed_check 5, 10, 10, BERSERK) would set the hero's SpeedVar & monster's SpeedVar to 10 if they have condition 5 (Berserk in my case).

@halt_atb:
If in Wait mode, sets ATB to value of WaitSpeed in DynRPG.ini. If in Active mode, sets ATB to ActiveSpeed. This allows you to pause the ATB for custom skill events.

@resume_atb:
If the ATB is halted via "halt_atb," this resumes it to its default of "100."

TO ADD EASY CONDITION SPEED MANAGEMENT (recommended):
1. Create 2 additional variables (from the 14 requires by this plugin), call them something like "CondSpeed-Hero" and "CondSpeed-Monster"

2. Create a new Common Event called BATTLE-CondSpeeds (can be anything) & add the following (in this order):
<>Comment: 

<>Comment: ***LOWER PRIORITY CONDITIONS FIRST***
------
<>Variable Oper: [CondSpeed-Hero] Set, Var [HeroSpeedMasterVar]'s Value
<>Variable Oper: [CondSpeed-Hero] * #
(This can be any operation. Multiply by a negative number to make the ATB bar go slower.)
<>Variable Oper: [CondSpeed-Monster] Set, Var [MonsterSpeedMasterVar]'s Value
<>Variable Oper: [CondSpeed-Monster] * #
<>Comment: @condition_speed_check 3, V###1, V###2, CONDITION
(Where V###1 = CondSpeed-Hero & V###2 = CondSpeed-Monster)
-------


Repeat the 5 lines above for each condition, with lower priorities first, and higher priorities 2nd. This technique is a tad more complex than the previous condition_speed_check example, but it basically does the same thing, only it ensures the modified condition is relative to the current SpeedVar value (again, if you have a "Battle Speed" option in a menu somewhere)

3. In your Monster Groups, create two new pages with the following:
TRIGGER: Turns Elapsed [0] (first turn)

<>Call Common Event: BATTLE-CondSpeeds


TRIGGER: Turns Elapsed [1x+1] (every turn after the first one)

<>Call Common Event: BATTLE-CondSpeeds


4. Copy & Paste those pages into all of your battle events. This will run that common event at the start of every turn (it's very frequent) and set speeds accordingly. If you need to make changes from there, you'll need to edit that common event or develop your own technique!

Details

  • 159.1 KB
  • 379
  • 05/20/2022 09:14 PM

Actions

Posts

Pages: first 123 next last
Is there a way (and I'm already doubtful there is) that this patch could address the Rm2k3 "Escape" bug? In Rm2k3 the "Escape" option is always grayed out unless the player's party has the initiative, and I was wondering if it was possible to make that a true/false option in the ini file.
I'm confused. I thought the old ATB formula used agility in some way, like comparing an actor's agility to the average agility of the opposing party. Yet here you say the old formula didn't use agility...

====

If you know the actual default ATB fill formula (and how it's based on agility by default), that will help immensely with rebalancing my characters' AGI and/or tweaking your new formula!

Is the "Base ATB Speed" in your formula here basically w/e the default RM2k3 ATB formula was?

Is this patch compatible with your first Advanced Faster ATB plug-in, or is it supposed to replace any other ATB plug-ins altogether?

Thanks!
author=Conmon
Is there a way (and I'm already doubtful there is) that this patch could address the Rm2k3 "Escape" bug? In Rm2k3 the "Escape" option is always grayed out unless the player's party has the initiative, and I was wondering if it was possible to make that a true/false option in the ini file.


That escape "bug" isn't actually a bug. That's just what appears on the autobattle window. If you start battle with no initiative, select "Fight" or w/e and scroll down through your actor's options, you should have Escape in there somewhere (as long as you set it as an option in the Battle Layout tab of the database). If you DO have initiative, then you have the option of using Run from the autobattle window because with initiative you have a 100% chance of escape!

If you don't like the autobattle menu window at all, PepsiOtaku has a plug-in to get rid of that!
@Common:
Yeah my workaround is to get rid of the auto-battle window and give every party member an Escape command. Grab Cherry's No-Autobattle patch here: http://rpgmaker.net/engines/rm2k3/utilities/34/
& Drop it into a folder called "DynPatches."

@ShoobL
The default ATB formula sucks, and agility is kind of useless and a pain in the ass to configure. This plugin makes it way easier. Correct about Base ATB Speed. Since you can't modify the original ATB formula without some hex editing (which like 3 people know how to do), I just basically modify it with my formula. It's the end result that's important after all (which is a more functional and visually pleasing ATB bar.

It's not compatible with my first Advanced Faster ATB plugin, so remove that first.
I'm having trouble just getting the bar to fill up as fast as possible (so ignoring comparative AGI for now), which variable would allow me to do that. I've tried increasing each value of that's part of that formula but no luck...

---

Setting ActiveSpeed and WaitSpeed to 800, for example, will super quickly fill the ATB bar only once somebody else's bar has filled slowly. I can't seem to just have them all fill up super fast.

---

Okay, I think I'm doing it right, but at the moment, the first round of every battle starts out slower.

I'm even calling the common event with the @init_hero_speed and @init_monster_speed comments inside it in an event page triggered by Turns Elapsed.

---

Oh wow, I was fiddling around with the conditions part of that new common event until I realized that I still planned on just using status conditions that doubled or halved AGI anyways. If my conditions weren't like this, then I would only be incrementing or decrementing each character's SpeedVar by one level (or enough to double or half it). However, these end up being the same thing if I include agility in the formula, so I didn't need any more additions to the common event after all!

---

Lemme say this is a really great plug-in. Well done! My biggest gripe at the moment is that ATB bars will resume before skill and attack animations are fully complete. There seems to be a flat waiting period before the ATB bar resumes, but if someone were to cast a spell with a super over-the-top animation, they will fall way behind in turn order. However, in Wait mode, this is slightly less of a problem because ATB bars will completely stop if anyone else's bar fills, meaning that the caster of the long animation spell will possibly have more time to catch up.

Actually, this problem only seems to occur if the caster of this spell is the only one currently with a full meter. Therefore, everyone else in the party will get a much faster meter until the spell has finished, or someone's meter gets full. In this scenario, the caster loses extra time to act (i.e. fill his own meter). Is there an easy way to resolve this?

---

Second buggy scenario: 3 party members (1 with full bar, 2 with low meter), 8 monsters. The monsters all attack kind of in sequence (they all have equal agility), and all of a sudden the ATB meter that WAS going really slow (setting of ActiveSpeed=50 in the .ini) starts to skyrocket up at full speed as if no one else's meter was already full! This was only in Active Mode, and is no problem in Wait mode.

Another observation for this bug is that it only occurs if the one party member with the full bar is selected and you are currently scrolling through his/her submenu options.
I'm trying to work on a fix for this plug-in regarding the things I mentioned above. Is 300000 the actual MAX_ATB_BAR value with RM2k3, or is that some constant that you just hard-coded yourself?
It's the actual max value.
author=PepsiOtaku
It's the actual max value.

Okay thanks, I'll see if I can figure out a fix. I know C++, but what is the easiest way to export it from a .cpp to a .dll (I'm using Microsoft Visual Studio), or otherwise get the source code as a useable .dll?

// this will reset RPG::BattleSpeed. NOTE: RPG::battleSpeed is only set to 100 (default), 0 (for Wait Mode), or 75 (for Active Mode)
// onFrame only makes alterations to individual battler's ATB bars
void resumeAtb(){
if (atbWait == true) {
RPG::battleSpeed = 100;
atbWait = false;
}
}

Shouldn't RPG::battleSpeed be set to confWaitSpeed, instead of 100?

---

I haven't actually tried generating my own new version of the plug-in (or actually modifying the source at this point), but I am pretty sure that you are missing a needed callback to onDrawBattleActionWindow so that the ATB doesn't go haywire (or you get an error like I described above) while you have a command selected.

You will need to modify your overridden onBattleStatusWindowDrawn(...) in some way, I think...
author=Shoobinator
// this will reset RPG::BattleSpeed. NOTE: RPG::battleSpeed is only set to 100 (default), 0 (for Wait Mode), or 75 (for Active Mode)

// onFrame only makes alterations to individual battler's ATB bars
void resumeAtb(){
if (atbWait == true) {
RPG::battleSpeed = 100;
atbWait = false;
}
}


Shouldn't RPG::battleSpeed be set to confWaitSpeed, instead of 100?


Sorry for not getting back to you sooner. I had to go back and decipher my source code. In short, NO. It should not be confWaitSpeed. resumeAtb only executes if atbWait is true, and atbWait is a boolean value that is meant to halt the ATB in special scenarios, like when a battle event command is running, when the battle status window is showing, and when you leave a battle (will set atbWait to false if it's true and reset the battleSpeed). Basically, when you set battleSpeed to 0. The battle flat-out stops, which stops animations, actions, everything. There needs to be logic to decide when to resume the ATB again.

It's a little convoluted, but I wanted to separate that kind of logic from the general active/wait mode logic because it was easier to code and think about. Changing 100 to confWaitSpeed would create several bugs if confWaitSpeed is 0.
Any ideas regarding the other issues I found? I couldn't get my own DLL to work, and I have explained my problem in the DynRPG main thread about that. I didn't try changing anything from your own plug-in, but I couldn't get any self-compiled plug-ins to work with the runtime exe, except the sample "are_you_sure" plug-in on Cherry's site, so I didn't go any further into thinking about what could be changed in yours.
Hi! Mind id you post an external download link? I can't download it here.
(External download link: like filefactory, 4shared etc instead of directly linking it to the website)
Hi there. I have a battle system that uses a lot of custom scripting, and this plugin is a huge step toward eliminating some pernicious bugs in it, so thank you very much! That said, I'm still struggling with something. X)

My basic problem is, if the ATB bars move during any part of anybody's action, there is a possibility that another actor's turn will start before the previous one's action is complete, causing variables to be altered and generally mucking up the system. I figured if I locked the ATB system into Wait mode using your plugin, that would avoid the issue, and for the most part it does seem to work. However, if a hero uses a skill or an item when they're the only one whose ATB bar is full, all the other ATB bars (including the monsters' invisible ones) will continue filling while the skill/item's name displays. In rare coincidences, a monster's turn will start during this period, causing one of the above-mentioned foul-ups.

I think I could avoid this problem too if I could manually freeze the ATB bars during the skill name display, which I thought would be possible using the confFreezeSwitch. Unfortunately, turning on that switch seems to have no effect in my game. I can even go to the RM2K3 debug menu while the ATB bars are filling normally and see that the switch is on. Am I misunderstanding what the switch is for, or doing something else wrong?

Just in case it would be helpful, here's my DynRPG.ini contents. I did alter the variable and switch references to conform with my project, though most of it seems to work as intended.

[QuickPatches]
; Paste quickpatches here

[battle_atb_overhaul]

; Switch ON = Active, Switch OFF = Wait

ATBmodeSwitch=864

; ...Base ATB Speed + ((AddValue * Agility) * SpeedVar)...

; Default = 150

AddValue=0

; Set MultiplyAgility to false to change the formula to ...Base ATB Speed + (AddValue * SpeedVar)...

MultiplyAgility=true

; Master Variaibles. The 12 variables starting with BattlerStartVar get set to these

HeroSpeedMasterVar=4617

MonsterSpeedMasterVar=4631

; Heroes Require 4 vars: BattlerStartVar+0,+1,+2,+3

; Monsters Requires 8 vars: BattlerStartVar+4,+5,+6,+7,+8,+9,+10,+11

BattlerStartVar=4657

; Default multiplier values

DefaultHeroSpeed=0

DefaultMonsterSpeed=0

; ActiveSpeed default=75. 100 is RM2k3's default speed, so it's recommended to set less

; Setting to 0 would always force WAIT mode.

; WaitSpeed default=0. Set to the same value as ActiveSpeed to force ACTIVE mode.

ActiveSpeed=75

WaitSpeed=0

; Switch that will freeze the ATB bars if turned on

confFreezeSwitch=908

; Add condition exceptions here, separated by commas (ex: CondtionException=7,8,12,13)

; This will prevent the atb bar from moving while a condition has "No Action Allowed"

; When a party member becomes afflicted with one of these, their ATB bar will be reset to 0 (as it's frozen)

; This was kind of a bug in Rm2k3. You could have a full ATB bar, but not be able to act, which didn't make sense

ConditionExceptions=7

I plan to release a prototype/demo of my game within the next few days, bug or no bug, so I could post a link to that here if you'd like to take a look through the system (though I'll warn you it's a complicated mess).
Update on my situation: I managed to get set up for making DynRPG plugins, and I tried modifying the ATB Overhaul to prevent the ATB bars from progressing during the popup window of hero skills or item usages. I succeeded, but it unfortunately didn't avoid the skill interruption bug like I'd been hoping for. I do think the freeze switch isn't working entirely as intended, but it probably wouldn't help either considering the results I had freezing the bars with checks to the hero action type. My next idea is to use the plugin to look ahead to the next couple iterations of the speed-up algorithm in onFrame() and actually prevent the monsters' ATB bars from filling entirely on their own, instead tracking which monsters are ready for a move and manually setting their bar to full when it's safe for them to do it (no chance of interrupting a hero action). This will likely meddle somewhat with the freqency of monster actions, but that's a worthwhile sacrifice if it'll prevent game-crashing bugs. Although if this works, maybe the next step could be to completely override RM2K3's internal ATB calculations...

In case anybody's interested, here's my modification of the ATB Overhaul source at this point. You can find the parts which I changed by searching for AubreyTheBard.

// ATB Overhaul
// by PepsiOtaku
// Version 1.0
// Modified by AubreyTheBard

#include <DynRPG/DynRPG.h>
#define NOT_MAIN_MODULE
#include <vector>
#include <sstream>

std::map<std::string, std::string> configuration;

int confAddValue;
int confHeroSpeedVarM;
int confBattlerStartVar;
int confMonsterSpeedVarM;
int confDefaultHeroSpeed;
int confDefaultMonsterSpeed;
int confAtbModeSwitch;
int confActiveSpeed;
int confWaitSpeed;
bool atbWait;
bool monsterAction = false;
bool longAction = false; // Added by AubreyTheBard
bool confAgilMult;
bool condCheckFail;
int confFreezeSwitch;
std::string condExceptionSet;

std::vector<int> exceptionVect;



unsigned char frameTimer = 0;

bool onStartup (char *pluginName) {
configuration = RPG::loadConfiguration(pluginName);
confAtbModeSwitch = atoi(configuration["ATBmodeSwitch"].c_str());
confAddValue = atoi(configuration["AddValue"].c_str());
confAgilMult = configuration["MultiplyAgility"] == "true";
confHeroSpeedVarM = atoi(configuration["HeroSpeedMasterVar"].c_str()); // Convert String to Int
confMonsterSpeedVarM = atoi(configuration["MonsterSpeedMasterVar"].c_str());
confBattlerStartVar = atoi(configuration["BattlerStartVar"].c_str());
confDefaultHeroSpeed = atoi(configuration["DefaultHeroSpeed"].c_str());
confDefaultMonsterSpeed = atoi(configuration["DefaultMonsterSpeed"].c_str());
confActiveSpeed = atoi(configuration["ActiveSpeed"].c_str());
confWaitSpeed = atoi(configuration["WaitSpeed"].c_str());
confFreezeSwitch = atoi(configuration["FreezeSwitch"].c_str());
// get the condition exceptions
condExceptionSet = configuration["ConditionExceptions"];
std::string delimiter = ",";
size_t pos = 0;
int token;
while ((pos = condExceptionSet.find(delimiter)) != std::string::npos) {
token = atoi(condExceptionSet.substr(0, pos).c_str());
exceptionVect.push_back(token);
condExceptionSet.erase(0, pos + delimiter.length());
}
token = atoi(condExceptionSet.c_str());
exceptionVect.push_back(token);

return true;
}

void initializeSpeedVars(){
if (RPG::variables[confHeroSpeedVarM] == 0) RPG::variables[confHeroSpeedVarM] = confDefaultHeroSpeed;
if (RPG::variables[confMonsterSpeedVarM] == 0) RPG::variables[confMonsterSpeedVarM] = confDefaultMonsterSpeed;
}

void onNewGame(){
// initialize the master speed variables based on what's in DynRPG.ini
initializeSpeedVars();
}

void onLoadGame(int id, char *data, int length) {
// initialize the master speed variables based on what's in DynRPG.ini
initializeSpeedVars();
// initialize the Active/Wait system based on what the ATB Mode Switch is in the save file
if (RPG::switches[confAtbModeSwitch] == true) RPG::system->atbMode = RPG::ATBM_ACTIVE;
else RPG::system->atbMode = RPG::ATBM_WAIT;
}

bool onSetSwitch(int id, bool value) {
// if ATBmodeSwitch is on, set it to active, otherwise if off, set to wait
if (id == confAtbModeSwitch){ // this was moved from ragnadyn since it was more appropriate here
if (value == true) RPG::system->atbMode = RPG::ATBM_ACTIVE;
else RPG::system->atbMode = RPG::ATBM_WAIT;
}
return true;
}

// this will reset RPG::BattleSpeed. NOTE: RPG::battleSpeed is only set to 100 (default), 0 (for Wait Mode), or 75 (for Active Mode)
// onFrame only makes alterations to individual battler's ATB bars
void resumeAtb(){
if (atbWait == true) {
RPG::battleSpeed = 100;
atbWait = false;
}
}

void onFrame (RPG::Scene scene){
if (scene == RPG::SCENE_BATTLE
&& !atbWait && !monsterAction && !longAction) // do not do the following if the ATB bar is set to 0 or a monster is performing an action or a hero is performing a long action (updated by AubreyTheBard)
{
frameTimer++;
if (frameTimer > 10)
{
frameTimer = 0;
for (int i=0; i<8; i++)
{
for (unsigned int j=0; j<exceptionVect.size(); j++)
{
if (RPG::Actor::partyMember(i) != NULL
&& RPG::Actor::partyMember(i)->conditions[exceptionVect[j]] != 0)
{
RPG::Actor::partyMember(i)->atbValue = 0;
condCheckFail = true;
break;
} else condCheckFail = false;
}
// Heroes
if (RPG::Actor::partyMember(i) != NULL && i<4 && condCheckFail == false
// The ATB bar shouldn't move in these situations...
&& ((RPG::Actor::partyMember(i)->conditions[1] == 0 // ... the hero is not dead
&& RPG::Actor::partyMember(i)->actionStatus == RPG::AS_IDLE // ... the hero is idle
&& RPG::Actor::partyMember(i)->animationId != 14) // ... the hero has won the battle
// 14 is the animation id for battle won for whatever reason-- should be 11
&& RPG::switches[confFreezeSwitch] == false // Other plugins need a means of freezing battle
))
{
if (RPG::Actor::partyMember(i)->atbValue < 300000)
if (confAgilMult == true)
RPG::Actor::partyMember(i)->atbValue = RPG::Actor::partyMember(i)->atbValue + ((confAddValue*RPG::Actor::partyMember(i)->getAgility())*RPG::variables[confBattlerStartVar+i]);
else RPG::Actor::partyMember(i)->atbValue = RPG::Actor::partyMember(i)->atbValue + (confAddValue*RPG::variables[confBattlerStartVar+i]);
else RPG::Actor::partyMember(i)->atbValue = 300000;
if (RPG::Actor::partyMember(i)->atbValue < 0)
RPG::Actor::partyMember(i)->atbValue = 0;
}
for (unsigned int j=0; j<exceptionVect.size(); j++)
{
if (RPG::monsters[i] != NULL
&& RPG::monsters[i]->conditions[exceptionVect[j]] != 0)
{
condCheckFail = true;
break;
} else condCheckFail = false;
}
// Monsters
if (RPG::monsters[i] != NULL && condCheckFail == false
&& ((RPG::monsters[i]->conditions[1] == 0 // the monster is dead
&& RPG::monsters[i]->actionStatus == RPG::AS_IDLE)
&& RPG::switches[confFreezeSwitch] == false // Other plugins need a means of freezing battle
))
{
if (RPG::monsters[i]->atbValue < 300000)
if (confAgilMult == true)
RPG::monsters[i]->atbValue = RPG::monsters[i]->atbValue + ((confAddValue* RPG::monsters[i]->getAgility())*RPG::variables[confBattlerStartVar+4+i]);
else RPG::monsters[i]->atbValue = RPG::monsters[i]->atbValue + (confAddValue*RPG::variables[confBattlerStartVar+4+i]);
else RPG::monsters[i]->atbValue = 300000;
if (RPG::monsters[i]->atbValue < 0)
RPG::monsters[i]->atbValue = 0;
}
}
}
} else if (scene != RPG::SCENE_BATTLE) {
resumeAtb();
}
}

// anytime the battle status window refreshes
bool onBattleStatusWindowDrawn(int x, int selection, bool selActive, bool isTargetSelection, bool isVisible) {
if (selActive == true) {
if (RPG::system->atbMode == RPG::ATBM_WAIT) RPG::battleSpeed = confWaitSpeed; // wait mode should stop the atb bar when heros are selecting actions
else RPG::battleSpeed = confActiveSpeed; // active mode should still move the atb bar by the % set in confActiveSpeed (100 is the default speed)
atbWait = true;
}

// if the party member dies (or has a condition with a status restriction) while the status window was open
for (unsigned int j=0; j<exceptionVect.size(); j++)
{
if ((RPG::Actor::partyMember(selection)->conditions[1]
&& RPG::Actor::partyMember(selection)->conditions[exceptionVect[j]]) != 0) {
RPG::Actor::partyMember(selection)->atbValue = 0;
resumeAtb(); // resume the ATB bar
//MessageBox(NULL, "what happen", "Debug", MB_ICONINFORMATION);
break;
}
}
return true;
}
// resume the ATB bar when the action is started
bool onDoBattlerAction(RPG::Battler* battler, bool firstTry) { // Current version of DynRPG adds a second parameter to onDoBattlerAction (modified by AubreyTheBard)
if(firstTry == true)
{
// however, make an exception if a monster is starting an action
if (battler->isMonster() == true) monsterAction = true;
// or if the battler is doing a long action (added by AubreyTheBard)
if (battler->action->kind == RPG::AK_SKILL || battler->action->kind == RPG::AK_ITEM)
{
RPG::battleSpeed = confWaitSpeed;
longAction = true;
}
}
return true;
}

bool onBattlerActionDone(RPG::Battler* battler, bool success) {
if(success == true)
{
resumeAtb();
if (monsterAction == true) monsterAction = false; // the monster has finished its action
if (longAction == true) longAction = false; // the hero has finished their long action (added by AubreyTheBard)
}
return true;
}

// do not move ATB bar when event commands are running
bool onEventCommand(RPG::EventScriptLine* scriptLine, RPG::EventScriptData* scriptData,
int eventId, int pageId, int lineId, int* nextLineId) {
if (eventId == 0) { // battle events
if (scriptData->currentLineId == 0) atbWait = true; // when an event page starts
else if (scriptLine->command == RPG::EVCMD_END_OF_EVENT) // when an event page ends
resumeAtb();
}
return true;
}

bool onComment ( const char* text,
const RPG::ParsedCommentData* parsedData,
RPG::EventScriptLine* nextScriptLine,
RPG::EventScriptData* scriptData,
int eventId,
int pageId,
int lineId,
int* nextLineId )
{
std::string cmd = parsedData->command;
if(!cmd.compare("init_hero_speed"))
{
for (int i=0; i<4; i++){
RPG::variables[confBattlerStartVar+i] = RPG::variables[confHeroSpeedVarM];
}
}
if(!cmd.compare("init_monster_speed"))
{
for (int i=0; i<8; i++){
RPG::variables[confBattlerStartVar+4+i] = RPG::variables[confMonsterSpeedVarM];
}
}
if(!cmd.compare("condition_speed_check"))
{
// parameter 1: condition ID
if (parsedData->parametersCount >= 3 && parsedData->parameters[0].type == RPG::PARAM_NUMBER
&& parsedData->parameters[1].type == RPG::PARAM_NUMBER
&& parsedData->parameters[2].type == RPG::PARAM_NUMBER) {
for (int i=0; i<8; i++){
if (i<4){
if (RPG::Actor::partyMember(i) != NULL
&& RPG::Actor::partyMember(i)->conditions[parsedData->parameters[0].number] != 0)
RPG::variables[confBattlerStartVar+i] = parsedData->parameters[1].number;
}
if (RPG::monsters[i] != NULL
&& RPG::monsters[i]->conditions[parsedData->parameters[0].number] != 0)
RPG::variables[confBattlerStartVar+4+i] = parsedData->parameters[2].number;
}
}
}
return true;
}

void onExit() {
exceptionVect.clear();
}
I think I made a couple tiny tweaks to this plugin at some point. Skill cancelling has always been a problem though, so I'm not sure if that's fixed completely.

I did fix a game-breaking freeze though, so I'll update this plugin at some point. I recently upgraded my PC, so I have to reinstall the Codeblocks stuff.
author=PepsiOtaku
I think I made a couple tiny tweaks to this plugin at some point. Skill cancelling has always been a problem though, so I'm not sure if that's fixed completely.

I did fix a game-breaking freeze though, so I'll update this plugin at some point. I recently upgraded my PC, so I have to reinstall the Codeblocks stuff.

Hi Pepsi, did you ever upload the newer version? Thanks!

I'm also still having trouble getting the ATB to work properly at the start of battle. The ATB is regular until the first action is made and then its speed is set according to the plug-in. I'm using the common event with @init_hero_speed and @init_monster_speed and calling it in a battle event page with the trigger of Turns Elapsed(0), but that doesn't seem to help.
I was taking another look at this and was finding that even if I set a condition in the ConditionsExceptions in the .ini, it seems to only want to reset the ATB bar a couple of turns later, which can also vary depending on what actions other actors take (attack, skill, defend, etc).
New version added (with bugfixes!)

Download above, or here: https://github.com/PepsiOtaku/battle_atb_overhaul
author=PepsiOtaku
New version added (with bugfixes!)

Download above, or here: https://github.com/PepsiOtaku/battle_atb_overhaul


Ooo goodie! I will have to test this soon and see how it makes a difference! :D
Millenin is still reporting a crash (which seems to appear after longer playthroughs), but I'll be looking into it tonight! I have a couple hunches.
Pages: first 123 next last