The RPG Maker Resource Kit

RMRK RPG Maker Creation => MV => MV Scripts Database => Topic started by: DoubleX on February 09, 2016, 05:44:27 AM

Title: DoubleX RMMV Popularized ATB Charge
Post by: DoubleX on February 09, 2016, 05:44:27 AM
Changelog
Code: [Select]
*      v1.03a(GMT 1100 22-8-2017):                                           
 *      1. Lets users cancel all skills/items of the selected charging actor 
 *      v1.02a(GMT 0500 14-8-2016):                                           
 *      1. Added post_charge_common_event_id                                 
 *      2. In sync with the latest DoubleX RMMV Popularized ATB Core version 
 *      v1.01a(GMT 1000 20-2-2016):                                           
 *      1. Lets users set the charge bar description text via notetags       
 *      2. Lets users set skill/item to be charged before paying its costs   
 *      3. Fixed not refreshing the battler upon starting/ending charging bug 
 *      v1.00a(GMT 0500 9-2-2016):                                           
 *      1. 1st testing version of this plugin finished                       

Authors
DoubleX

Credits
DoubleX(Optional)

Purpose
Lets users set skills/items to need time to charge before using

Games using this plugin
None so far

Configurations
Code: [Select]
* @param charge_c1
 * @desc Sets the 1st atb charge bar color as text color charge_c1
 *       charge_c1 must return a valid text color code
 *       charge_c1 should return the same value during the same battle to
 *       ensure proper atb charge bar color displays
 * @default 30
 *
 * @param charge_c2
 * @desc Sets the 2nd atb charge bar color as text color charge_c2
 *       charge_c2 must return a valid text color code
 *       charge_c2 should return the same value during the same battle to
 *       ensure proper atb charge bar color displays
 * @default 31
 *
 * @param charge_bar_text
 * @desc Sets the code of the charge bar description text as charge_bar_text
 *       It'll only be used if no <patb charge text: text> notetag's used
 *       Available charge_bar_text code:
 *       item - The name of the currently charging skill/item will be the charge
 *              bar description text
 *       Setting charge_bar_text as an unavailable code means atb_bar_text
 *       will be the charge bar description text
 *       charge_bar_text should return the same code during the same battle to
 *       ensure proper charge bar text displays
 * @default item
 *
 * @param charge_prior_item_cost
 * @desc Sets the skill/item charging to take place before paying its costs if
 *       charge_prior_item_cost is true
 *       It'll only be used if no <patb charge prior item cost> notetag's used
 *       charge_prior_item_cost should return the same value for the same action
 * @default true
 *
 * @param post_charge_common_event_id
 * @desc Sets the common event with id ppost_charge_common_event_id to be
 *       called right after a battler has finished charging a skill/item
 *       post_charge_common_event_id must return a Number
 *       If post_charge_common_event_id doesn't return the id of an existing
 *       common event, no common event will be called with this timing
 * @default 0
Code: [Select]
DoubleX_RMMV.PATB_Charge = {

    /* Sets hotkeys cancelling the charging of the charging actor with the
     * specified party member index
     * The effects will be the same as calling the reset_patb() plugin call
     * None of these hotkeys are supposed to be changed during the same battle
     * Each hotkey will be referenced by $gameSystem.patb.charge_actor_index,
     * where index is the index of the hotkey
     * $gameSystem.patb.charge_actor_count must always be updated to maintain
     * the exact number of these hotkeys
     * The ith hotkey will try to select the charging actor with party member
     * index i - 1
     * Each of these hotkey must be a String
     * Using a keyboard mapping plugin, like Quasi Input, can be useful here
     */
    charging_actors: [
        // Setting these as the same as those in inputable_actors in the hotkey
        // addon would cause the buzzer sound to be played on valid cases too
        "#1", // Referenced by $gameSystem.patb.charge_actor_0
        "#2", // Referenced by $gameSystem.patb.charge_actor_1
        "#3", // Referenced by $gameSystem.patb.charge_actor_2
        "#4", // Referenced by $gameSystem.patb.charge_actor_3
        "#5", // Referenced by $gameSystem.patb.charge_actor_4
        "#6", // Referenced by $gameSystem.patb.charge_actor_5
        "#7", // Referenced by $gameSystem.patb.charge_actor_6
        "#8", // Referenced by $gameSystem.patb.charge_actor_7
        "#9", // Referenced by $gameSystem.patb.charge_actor_8
        "#0" // Referenced by $gameSystem.patb.charge_actor_9
        //
    ]

}; // DoubleX_RMMV.PATB_Charge

Notetags
Code: [Select]
*    # Skill/Item Notetags:                                                 
 *      1. <patb charge: scale, code>                                         
 *         - Sets the charge rate to use the skill/item's invocation speed,   
 *           which will be multiplied by scale                               
 *         - code can be either of the below:                                 
 *           set - The charge value per frame will be the skill/item's       
 *                 invocation speed * scale, which should be nonnegative     
 *           add - The charge value per frame will be the absolute value of   
 *                 the battler atb gain value per frame + the skill/item's   
 *                 invocation speed * scale                                   
 *           multiply - If the skill/item's invocation speed * scale is       
 *                      positive, the charge value per frame will be the     
 *                      battler atb gain value per frame * the skill/item's   
 *                      invocation speed * scale                             
 *                      If the skill/item's invocation speed * scale is       
 *                      negative, the charge value per frame will be the     
 *                      battler atb gain value per frame / (the skill/item's 
 *                      invocation speed * scale)                             
 *                      If the skill/item's invocation speed * scale is 0, the
 *                      skill/item will be fully charged in 1 frame           
 *      2. <patb charge colors: text color 1, text color 2>                   
 *         - Changes the atb charge bar color 1 and 2 to text color 1 and 2   
 *           respectively when this notetag's used                           
 *      3. <patb charge text: text>                                           
 *         - Changes the atb charge bar description text as text when this   
 *           notetag's used                                                   
 *      4. <patb charge prior item cost>                                     
 *         - Sets the skill/item charging to take place before paying its cost

Plugin Calls
Code: [Select]
*    # Data Skill/Item manipulations                                         
 *      1. meta.patb_charge                                                   
 *         - Returns the skill/item invocation speed scale and charge rate   
 *           code in the form of { scale: scale, code: code }                 
 *      2. meta.patb_charge = { scale: scale, code: code }                   
 *         - Sets the skill/item invocation speed scale and charge rate code 
 *           in the form of { scale: scale, code: code }                     
 *         - All meta.patb_charge changes can be saved if                     
 *           DoubleX RMMV Dynamic Data is used                               
 *      3. meta.patb_charge_colors                                           
 *         - Returns the text colors stored in                               
 *           <patb charge colors: text color 1, text color 2> in the form of 
 *           [text color 1, text color 2]                                     
 *      4. meta.patb_charge_colors = [text color 1, text color 2]             
 *         - Sets the text colors stored in                                   
 *           <patb charge colors: text color 1, text color 2> as text color 1
 *           and 2                                                           
 *         - All meta.patb_charge_colors changes can be saved if             
 *           DoubleX RMMV Dynamic Data is used                               
 *      5. meta.patb_charge_text                                             
 *         - Returns the text stored in <patb charge text: text>             
 *      6. meta.patb_charge_text = text                                       
 *         - Sets the text stored in <patb charge text: text> as text         
 *         - All meta.patb_charge_text changes can be saved if               
 *           DoubleX RMMV Dynamic Data is used                               
 *      7. meta.patb_charge_prior_item_cost                                   
 *         - Returns whether the skill/item charging will take place before   
 *           paying its costs                                                 
 *      8. meta.patb_charge_prior_item_cost = boolean                         
 *         - Sets whether the skill/item charging will take place before     
 *           paying its costs                                                 
 *         - All meta.patb_charge_prior_item_cost changes can be saved if     
 *           DoubleX RMMV Dynamic Data is used                               
 *    # Battler manipulations                                                 
 *      1. patb_val.charge                                                   
 *         - Returns the battler's charge value                               
 *      2. patb_val.charge = val                                             
 *         - Set the battler's charge value as val                           
 *      3. patb_rate.charge                                                   
 *         - Returns the battler's charge rate                               
 *      4. patb_rate.charge = rate                                           
 *         - Set the battler's charge rate as rate                           
 *         - It'll be reevaluated if it can be changed without plugin calls   
 *      5. patb_val_change.atb = true                                         
 *         - Notifies that the charge value's changed                         
 *         - It must be used right after the atb bar length changed           

Video
https://www.youtube.com/watch?v=2T6cnXh_r7c (https://www.youtube.com/watch?v=2T6cnXh_r7c)

Prerequisites
Plugins:
1. DoubleX RMMV Popularized ATB Core (http://rmrk.net/index.php?topic=50491.0)
Abilities:
1. Little Javascript coding proficiency to fully utilize this plugin

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

Instructions
Code: [Select]
* The default plugin file name is DoubleX RMMV Popularized ATB Charge v103a
 * If you want to change that, you must edit the value of
 * DoubleX_RMMV.PATB_Charge_File, which must be done via opening this plugin
 * js file directly
 * (v1.03a+)You're supposed to edit this js file directly to setup hotkeys
 * cancelling the charging of charging actors with specified party member index
Title: Re: DoubleX RMMV Popularized ATB Charge
Post by: DoubleX on February 20, 2016, 10:43:06 AM
Updates
Code: [Select]
*      v1.01a(GMT 1000 20-2-2016):                                           
 *      1. Lets users set the charge bar description text via notetags       
 *      2. Lets users set skill/item to be charged before paying its costs   
 *      3. Fixed not refreshing the battler upon starting/ending charging bug
Title: Re: DoubleX RMMV Popularized ATB Charge
Post by: DoubleX on August 14, 2016, 06:00:16 AM
Updates
Code: [Select]
*      v1.02a(GMT 0500 14-8-2016):                                           
 *      1. Added post_charge_common_event_id                                 
 *      2. In sync with the latest DoubleX RMMV Popularized ATB Core version 
Title: Re: DoubleX RMMV Popularized ATB Charge
Post by: DoubleX on August 22, 2017, 10:27:59 AM
Updates
Code: [Select]
*      v1.03a(GMT 1100 22-8-2017):                                           
 *      1. Lets users cancel all skills/items of the selected charging actor