DOUBLEX RMVXA BASIC ATB

RPG Maker VX Ace

Aids other scripters to learn how a basic atb system script can be written

  • DoubleX
  • 06/10/2015 02:10 PM
  • 6660 views
Note
For scripters going to learn from this script, reading how to write an atb system script first can help quite a lot.

Script Calls
#  * Battler manipulations                                                     |
#    1. batb_val                                                               |
#       - Returns the battler's atb fill percentage                            |
#    2. reset_batb_val(reset)                                                  |
#       - Clears all battler's actions                                         |
#       - Empties the battler's atb bar as well if reset returns true          |

Configurations
# Sets the base atb fill time from empty to full as BASE_FILL_T seconds
    # If BASE_FILL_T_VAR_ID is a natural number, the value of variable with id
    # BASE_FILL_T_VAR_ID will be used instead of using BASE_FILL_T
    BASE_FILL_T = 5
    BASE_FILL_T_VAR_ID = 0

    # Sets the atb wait condition code as WAIT_COND_CODE
    # If WAIT_COND_CODE_VAR_ID is a natural number, the value of variable with
    # id WAIT_COND_CODE_VAR_ID will be used instead of using WAIT_COND_CODE
    # Available atb wait condition codes:
    # 0 - Wait only when an action's executing or a message's showing
    # 1 - Wait when an animation's playing as well
    # 2 - Wait when the target selection window's shown as well
    # 3 - Wait when the skill/item selection window's shown as well
    # 4 - Wait when players can input actions as well
    WAIT_COND_CODE = 0
    WAIT_COND_CODE_VAR_ID = 0

    # Sets the code of the unit of the turn clock as TURN_UNIT_CODE
    # If TURN_UNIT_CODE_VAR_ID is a natural number, the value of variable with
    # id TURN_UNIT_CODE_VAR_ID will be used instead of using TURN_UNIT_CODE
    # Available codes of the unit of the turn clock:
    # 0 - Seconds
    # 1 - Number of executed actions in the same turn
    TURN_UNIT_CODE = 0
    TURN_UNIT_CODE_VAR_ID = 0

    # Sets the maximum turn clock unit as MAX_TURN_UNIT
    # If MAX_TURN_UNIT_VAR_ID is a natural number, the value of variable with id
    # MAX_TURN_UNIT_VAR_ID will be used instead of using MAX_TURN_UNIT
    MAX_TURN_UNIT = 5
    MAX_TURN_UNIT_VAR_ID = 0

    # Sets the atb fill mode as ATB_FILL_MODE
    # If ATB_FILL_MODE_VAR_ID is a natural number, the value of variable with id
    # ATB_FILL_MODE_VAR_ID will be used instead of using ATB_FILL_MODE
    # Available atb fill modes:
    # 0 - Lets battlers input and execute actions when that battler's atb's full
    #     Empties and refills that battler's atb right after executing actions
    # 1 - Lets battlers input actions when that battler's atb's empty
    #     Refills that battler's atb right after inputting actions
    #     Let battlers execute actions when that battler's atb's full
    #     Empties that battler's atb right after executing actions
    # The value of variable with id ATB_FILL_MODE_VAR_ID should remain the same
    # during battles to ensure proper atb fillings and action executions
    ATB_FILL_MODE = 0
    ATB_FILL_MODE_VAR_ID = 0

    # (v1.01a+)Sets the starting atb value mode as ATB_START_MODE
    # If ATB_START_MODE_VAR_ID is a natural number, the value of variable with
    # id ATB_START_MODE_VAR_ID will be used instead of using ATB_START_MODE
    # The starting atb value is always 0.0 for:
    # - unmovable battlers
    # - atb fill mode as 1
    # - actors with start type surprise
    # - enemies with start type preemptive
    # The starting atb value is always 100.0 for:
    # - movable actors with atb fill mode as 0 and start type preemptive
    # - movable enemies with atb fill mode as 0 and start type surprise
    # Available starting atb value mode for normal start:
    # - agi is the battler's agi
    # - param_max(6) is the maximum value of any battler's agi
    # 0 - 0.0
    # 1 - 100.0 * agi / param_max(6)
    ATB_START_MODE = 0
    ATB_START_MODE_VAR_ID = 0

    # (v1.02a+)Sets the party escape invocation speed as PARTY_ESC_SPEED
    # It'll only be used with ATB_FILL_MODE being 1
    # With ATB_FILL_MODE being 1, if no actor would be able to act without the
    # party escape attempt, that attempt will fail immediately
    # If PARTY_ESC_SPEED_VAR_ID is a natural number, the value of variable with
    # id PARTY_ESC_SPEED_VAR_ID will be used instead of using PARTY_ESC_SPEED
    PARTY_ESC_SPEED = 0
    PARTY_ESC_SPEED_VAR_ID = 0

    # Sets the atb refill rate code as ATB_RATE_CODE
    # If ATB_RATE_CODE_VAR_ID is a natural number, the value of variable with id
    # ATB_RATE_CODE_VAR_ID will be used instead of using ATB_RATE_CODE
    # Available atb refill rate code:
    # - speed is
    #   Battler's agi for atb fill mode 0
    #   Battler's agi + batb_item_speed_sum for atb fill mode 1
    # - batb_item_speed_sum is the sum of invocation speeds(+ attack speed for 
    #   the attack skill) of all inputted skills/items
    # - DoubleX_RMVXA::BATB.base_batb_fill_t is the base atb fill time
    # - Graphics.frame_rate is the number of frames per second
    # - BattleManager.batb_avg_agi is the average of all battler's agi
    # 0 - speed * 100.0 / DoubleX_RMVXA::BATB.base_batb_fill_t / 
    #     Graphics.frame_rate
    # 1 - (formula in code 0) / BattleManager.batb_avg_agi
    # 2 - Same as 1, except BattleManager.batb_avg_agi will always be
    #     reevalauted per frame instead of just at the start of a battle
    ATB_RATE_CODE = 1
    ATB_RATE_CODE_VAR_ID = 0

    # Sets the code of the reset atb mechanism as ATB_RESET_CODE
    # If ATB_RESET_CODE_VAR_ID is a natural number, the value of variable with
    # id ATB_RESET_CODE_VAR_ID will be used instead of using ATB_RESET_CODE
    # Available codes of the atb reset mechanism:
    # 0 - Freezes the atb refill while not movable
    # 1 - Same as 0, except the atb will be emptied when becoming unmovable
    ATB_RESET_CODE = 1
    ATB_RESET_CODE_VAR_ID = 0

    # Sets the 1st atb bar color as text color ATB_BAR_COLOR1
    # If ATB_BAR_COLOR1_VAR_ID is a natural number, the value of variable with
    # id ATB_BAR_COLOR1_VAR_ID will be used instead of using ATB_BAR_COLOR1
    # The value of variable with id ATB_BAR_COLOR1_VAR_ID should remain the same
    # during battles to ensure proper atb bar color displays
    ATB_BAR_COLOR1 = 7
    ATB_BAR_COLOR1_VAR_ID = 0

    # Sets the 2nd atb bar color as text color ATB_BAR_COLOR2
    # If ATB_BAR_COLOR2_VAR_ID is a natural number, the value of variable with
    # id ATB_BAR_COLOR2_VAR_ID will be used instead of using ATB_BAR_COLOR2
    # The value of variable with id ATB_BAR_COLOR2_VAR_ID should remain the same
    # during battles to ensure proper atb bar color displays
    ATB_BAR_COLOR2 = 8
    ATB_BAR_COLOR2_VAR_ID = 0

    # Sets the atb bar description text as ATB_BAR_TEXT
    # If ATB_BAR_TEXT_VAR_ID is a natural number, the value of variable with id
    # ATB_BAR_TEXT_VAR_ID will be used instead of using ATB_BAR_TEXT
    # The value of variable with id ATB_BAR_TEXT_VAR_ID should remain the same
    # during battles to ensure proper atb bar text displays
    ATB_BAR_TEXT = "AP"
    ATB_BAR_TEXT_VAR_ID = 0


Games using this script
None so far

Video


Prerequisites
Scripts:
1. Little RGSS3 scripting proficiency to fully utilize this script

Terms Of Use
You shall keep this script's Script Info part's contents intact
You shalln't claim that this script is written by anyone other than DoubleX or his aliases
None of the above applies to DoubleX or his aliases

Instructions
1. Open the script editor and put this script into an open slot between Materials and Main, save to take effect.

Author's Notes
#    1. This script's meant to be easy and simple to comprehend and utilize,   |
#       meaning high level control nor freedom won't be given to users, and    |
#       advanced scripting proficiencies won't be applied to this script.      |
#    2. Readability's prioritized over almost everything else in this script to|
#       aid scripters to learn how a basic atb system can be written.          |
#    3. State's Auto-removal Timing as Action End becomes right after the state|
#       owner executed all his/her/its actions to conform with the defaults    |

FAQ
#    Q1. Will this script be compatible with Victor Engine - Basic Module or   |
#        Yanfly Engine Ace - Ace Battle Engine?                                |
#    A1. Probably no, as there's Victor Engine - Active Time Battle, and I've  |
#        been already supporting both CATB and ECATB scripts.                  |
#    Q2. Why this script only has global settings and has no notetag at all?   |
#    A2. To help scripters learn from this script, it's better to focus on the |
#        core concepts and structures when implementing this script, while     |
#        adding notetags as well might impede them from grapsing those basics. |
#    Q3. May you please teach me scripting so I can fully utilize this script? |
#    A3. You can ask me how to set specific settings to meet your specific     |
#        needs, but it seems to me that there are many good scripting teachers |
#        so you may want to ask them instead of me for learning scripting.     |

Authors
DoubleX

Changelog
#    v1.02c(GMT 1100 5-8-2015):                                                |
#    1. Fixed nil enemy selection and not executing all confirmed actions bug  |
#    2. Further improved this script's compactness, efficiency and readability |
#    v1.02b(GMT 1300 5-7-2015):                                                |
#    1. Fixed hidden battlers and updating atb while game messages' showing bug|
#    2. Improved this script's efficiency                                      |
#    v1.02a(GMT 1200 1-7-2015):                                                |
#    1. Lets users set the party escape speed in atb fill mode 1               |
#    2. On action end now triggers when a battler processed all the actions    |
#    v1.01a(GMT 1100 13-6-2015):                                               |
#    1. Lets users select the starting atb value formulae                      |
#    2. Fixed clearing empty log window upon turn start bug                    |
#    3. Fixed failed party escape not costing anything bug                     |
#       - This bug's still present in atb fill mode 1                          |
#    4. Fixed enemies not executing actions under some conditions bug          |
#    5. Simplified the actor input selection implementations                   |