DoubleX RMMV Unison Item

Discussion in 'JS Plugin Releases (RMMV)' started by DoubleX, Dec 25, 2015.

  1. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    Note
    This plugin's available for commercial use

    Purpose
    Lets you set some skills/items needing mutiple battlers to use

    Introduction
    * In the default RMMV battle system, no skill/item needs more than 1
    * battlers to use
    * With this plugin, you can set some skills/items to be unison ones
    * needing more than 1 battlers to use them
    * Unison battlers are those needed to use the unison skill/item
    * Unison invoker is the battler actually selecting and invoking the
    * unison skill/item
    * Unison invokees are all unison battlers besides the unison invoker
    * There can only be 1 unison invoker for each selected unison skill/item
    * - (v1.02a+)A synchronous unison skill/item is one without any
    * <async unison item> notetag
    * - (v1.02a+)An asynchronous unison skill/item is one with at least 1
    * <async unison item> notetags

    Compatibility Fix
    DoubleX RMMV Unison Item Compatibility

    Games using this plugin
    None so far

    Parameters
    * @param showAllUnisonBattlers
    * @desc Sets if the battlelog will show all unison battlers instead of only
    * the unison invoker
    * @Default true
    *
    * @param unisonFunctionRule
    * @desc Sets the string of the rule used for setting the user's functions in
    * the damage formula of the unison skill/item by using those of all
    * unison battlers
    * It'll only be used for those functions not having their unison rules
    * It must be implemented by function RULES, which must be edited by
    * opening this plugin js file directly
    * @Default avg

    Notetags
    * # Skill/Item Notetags:
    * 1. <unison item actors: ids>
    * - Sets the list of id of actors needed for the skill/item as ids
    * , is used to separate the actor id in ids
    * E.g.:
    * <unison item actors: 1> means actor with id 1 is needed to use it
    * <unison item actors: 4, 2> means actors with id 4 and 2 are
    * needed to use it
    * - All actors included in ids needs to be inputable, able to use the
    * skills/item and pay its cost
    * - All unison actors will pay the unison skill costs after using it
    * - Only actors included in ids can select the skill/item
    * - If ids only contains 1 actor id, this notetag will become only
    * letting the actor with that actor id to use the skill/item
    * 2. <unison item function rule: rule>
    * - Sets the rule of setting user's function in the skill/item's
    * damage formula as rule which is implemented by function
    * RULES, which must be edited by opening this plugin js file
    * directly
    * - function must be a battler function name included in
    * FUNCTIONS, which must be edited by opening this plugin js file
    * directly
    * 3. <unison item function actors: ids>
    * - Sets user's function in the skill/item's damage formula to use
    * its unison item rule to combine those of actors with id included
    * in ids
    * E.g.:
    * <unison item atk actors: 1> means the user's atk in its damage
    * formula uses that of actor with id 1 under the skill/item's
    * unison rule applied to atk
    * <unison item mat actors: 4, 2> means the user's mat in its damage
    * formula uses those of actors with id 4 and 2 under the
    * skill/item's unison rule applied to mat
    * - function must be a battler function name included in
    * FUNCTIONS, which must be edited by opening this plugin js file
    * directly
    * 4. (v1.01a+)<unison item actor mp cost: costs>
    * - Sets the list of mp costs needed for each of the corresponding id
    * of the unison actor in <unison item actors: ids>
    * , is used to separate the mp costs in ids
    * E.g.:
    * If <unison item actors: 1> is used, then
    * <unison item actor mp cost: 5> means actor with id 1 needs to pay
    * the 5 mp cost for using the unison skill/item
    * If <unison item actors: 4, 2> is used, then
    * <unison item actor mp cost: 5, 10> means actor with id 4 and 2
    * need to pay the 5 and 10 mp cost respectively for using the
    * unison skill/item
    * If <unison item actors: 4, 2> is used, then
    * <unison item actor mp cost: 5> means actor with id 4 needs to pay
    * the 5 mp cost while that with id 2 needs to pay the default
    * skill/item mp cost for using the unison skill/item
    * - MCR will be applied to the mp costs for all unison actors
    * 5. (v1.01a+)<unison item actor tp cost: costs>
    * - Sets the list of tp costs needed for each of the corresponding id
    * of the unison actor in <unison item actors: ids>
    * , is used to separate the tp costs in ids
    * E.g.:
    * If <unison item actors: 1> is used, then
    * <unison item actor tp cost: 5> means actor with id 1 needs to pay
    * the 5 tp cost for using the unison skill/item
    * If <unison item actors: 4, 2> is used, then
    * <unison item actor tp cost: 5, 10> means actor with id 4 and 2
    * need to pay the 5 and 10 tp cost respectively for using the
    * unison skill/item
    * If <unison item actors: 4, 2> is used, then
    * <unison item actor tp cost: 5> means actor with id 4 needs to pay
    * the 5 tp cost while that with id 2 needs to pay the default
    * skill/item tp cost for using the unison skill/item
    * 6. (v1.02a+)<unison item actor learn: flags>
    * - Sets the list of skill learn requirement flags for each of the
    * corresponding id of the unison actor in <unison item actors: ids>
    * , is used to separate the skill learn requirement flags
    * Flag can be either t or f, meaning true or false respectively
    * The default unison skill learn requirement is true
    * This notetag only works on skills and has no effects on items
    * E.g.:
    * If <unison item actors: 1> is used, then
    * <unison item actor skill learn: t> means actor with id 1 needs to
    * learn the skill in order to use it
    * If <unison item actors: 4, 2> is used, then
    * <unison item actor skill learn: t, f> means actor with id 4 needs
    * to learn the skill in order to use it while actor with id 2
    * doesn't need to
    * If <unison item actors: 4, 2> is used, then
    * <unison item actor skill learn: f> means actor with id 4 doesn't
    * need to learn the skill in order to use it while actor with id 2
    * needs to due to the default unison skill learn requirement
    * 7. (v1.02a+)<async unison item>
    * - Sets the unison skill/item to be inputable when any battler
    * needed for that skill/item is inputable
    * - That skill/item and all battlers inputted it will wait for all
    * battlers needed for that skill/item to input it in order for them
    * to execute it altogether
    * - This notetag will be ignored in the default RMMV battle system
    * and all unison skills/items will be synchronous ones
    * - This notetag will be ignored in ATB systems that will always wait
    * when there are inputable actors and all unison skills/items will
    * be asynchronous ones
    * 8. (v1.03a+)<unison item actor function drain: weights>
    * - Sets user's drained hp/mp/etc for skills/items draining hp/mp/etc
    * to use redistribute the drained hp/mp/etc to all those of actors
    * with id included in ids in <unison item actors: ids>
    * - function must be a battler getter name
    * - The redistribution amount to each actor is the minimum value of
    * the corresponding weight / sum of weights and the difference
    * between the hp and the mhp
    * - If the sum of weights is 0, then no actor will receive any amount
    * of the drained hp/mp/etc
    * - All the undistributed drained hp/mp/etc will be taken by the
    * unison invoker, and any amount left by the unison invoker will be
    * lost
    * E.g.:
    * If <unison item actors: 1> is used, then
    * <unison item actor hp drain: 0> means actor with id 1 won't
    * receive any drained hp from skills/items draining hp
    * If <unison item actors: 4, 2> is used, then
    * <unison item actor mp drain: 1, 2> means actor with id 4 and 2
    * will receive 1/3 and 2/3 of the drained mp from skills/items
    * draining mp respectively
    * If <unison item actors: 4, 2> is used, then
    * <unison item actor mp cost: 1> means actor with id 4 and 2 will
    * receive 100% and 0% of the drained mp from skills/items draining
    * mp respectively

    Plugin Calls
    * # Configuration manipulations
    * 1. DoubleX_RMMV.Unison_Item.prop
    * - Returns the property prop under DoubleX_RMMV.Unison_Item
    * 2. DoubleX_RMMV.Unison_Item.prop = val
    * - Sets the property prop under DoubleX_RMMV.Unison_Item as val
    * - No DoubleX_RMMV.Unison_Item.prop change will be saved
    * 3. $gameSystem.unisonItem.param
    * - Returns the value of param listed in the plugin manager
    * 4. $gameSystem.unisonItem.param = val
    * - Sets the value of param listed in the plugin manager as val
    * - All $gameSystem.unisonItem.param changes will be saved
    * # Skill/Item manipulations
    * 1. meta.unisonItemActors
    * - Returns the Array of ids of actors needed to use this skill/item
    * 2. meta.unisonItemActors = [id, id, ...]
    * - Sets the Array of ids of actors needed to use this skill/item
    * - All meta.unisonItemActors changes can be saved if
    * DoubleX RMMV Dynamic Data is used
    * 3. meta.unisonItemRules[functionName]
    * - Returns the unison item rule as String for function with name
    * functionName as a String
    * 4. meta.unisonItemRules[functionName] = rule
    * - Sets the unison item rule for function with name functionName as
    * String as String rule, which must be implemented by
    * RULES, which must be edited by opening this plugin js file
    * directly
    * - function with name functionName must be included in
    * FUNCTIONS, which must be edited by opening this plugin js file
    * directly
    * - All meta.unisonItemRules changes can be saved if
    * DoubleX RMMV Dynamic Data is used
    * 5. meta.unisonItemFunctionActors[functionName]
    * - Returns the Array of ids of actors included for combining their
    * function functionName as String using its unison item rule
    * 6. meta.unisonItemFunctionActors[functionName] = [id, id, ...]
    * - Sets the Array of ids of actors included for combining their
    * function functionName as String using its unison item rule
    * - function with name functionName must be included in
    * FUNCTIONS, which must be edited by opening this plugin js file
    * directly
    * - All meta.unisonItemFunctionActors changes can be saved if
    * DoubleX RMMV Dynamic Data is used
    * 7. (v1.01a+)meta.unisonItemActorMpCosts
    * - Returns the Array of mp costs each needed by its corresponding
    * actor with id in meta.unisonItemActors to use this skill/item
    * 8. (v1.01a+)meta.unisonItemActorMpCosts = [cost, cost, ...]
    * - Sets the Array of of mp costs each needed by its corresponding
    * actor with id in meta.unisonItemActors to use this skill/item
    * - All meta.unisonItemActorMpCosts changes can be saved if
    * DoubleX RMMV Dynamic Data is used
    * 9. (v1.01a+)meta.unisonItemActorTpCosts
    * - Returns the Array of tp costs each needed by its corresponding
    * actor with id in meta.unisonItemActors to use this skill/item
    * 10. (v1.01a+)meta.unisonItemActorTpCosts = [cost, cost, ...]
    * - Sets the Array of of tp costs each needed by its corresponding
    * actor with id in meta.unisonItemActors to use this skill/item
    * - All meta.unisonItemActorTpCosts changes can be saved if
    * DoubleX RMMV Dynamic Data is used
    * 11. (v1.02a+)meta.unisonItemActorLearn
    * - Returns the Array of skill learn requirement flags for each
    * corresponding actor with id in meta.unisonItemActors to use this
    * skill/item
    * 12. (v1.02a+)meta.unisonItemActorLearn = [cost, cost, ...]
    * - Sets the Array of skill requirement flags for each corresponding
    * actor with id in meta.unisonItemActors to use this skill/item
    * - All meta.unisonItemActorTpCosts changes can be saved if
    * DoubleX RMMV Dynamic Data is used
    * 13. (v1.02a+)meta.asyncUnisonItem
    * - Returns whether the unison skill/item is an asynchronous one
    * 14. (v1.02a+)meta.asyncUnisonItem = boolean
    * - Sets the unison skill/item to be an asynchronous one if boolean
    * is true and a synchronous one if otherwise
    * 15. (v1.03a+)meta.unisonItemActorFunctionDrain[functionName]
    * - Returns the Array of weights for actors included in the
    * corresponding meta.unisonItemActors for redistributing the
    * drained function functionName as String from skills/items
    * draining functionName to all those actors
    * 16. (v1.03a+)meta.unisonItemActorFunctionDrain[functionName] = [w, ..]
    * - Sets the Array of weights for actors included in the
    * corresponding meta.unisonItemActors for redistributing the
    * drained function functionName as String from skills/items
    * draining functionName to all those actors
    * - function with name functionName must be a battler getter name
    * - All meta.unisonItemActorFunctionDrain changes can be saved if
    * DoubleX RMMV Dynamic Data is used

    Configurations
    /* Implements the unison item function rules
    * The unison item function rule can be referenced by rule
    * The Array of unison item function value of all unison battlers can be
    * referneced by vals
    * RULES will be bound to the unison invoker upon use
    * It must return a Number
    */
    RULES: function(rule, vals) {
    if (rule === 'min') {
    return vals.sort(function(a, b) { return a - b; })[0];
    } else if (rule === 'avg') {
    return vals.reduce(function(a, b) { return a + b; }) / vals.length;
    } else if (rule === 'max') {
    return vals.sort(function(a, b) { return b - a; })[0];
    }
    console.log('The unison item rule ' + rule + " isn't implemented");
    return 0;
    },

    /* Sets the battler functions using the unison item rules
    * Its function names must be the class of the battler functions
    * Its values must be those battler functions as Strings
    * All the included battler functions will be extended
    */
    FUNCTIONS: {

    /* General form:
    * class: [
    * 'battler function name',
    * 'battler function name',
    * 'battler function name',
    * ...,
    * 'battler function name'
    * ]
    */

    Game_BattlerBase: [
    'param',
    'xparam',
    'sparam'
    // Adds new battler function names here

    ]

    // Adds new classes here


    }

    Instructions
    * 1. To use this plugin with the default battle system, place
    * DoubleX RMMV Unison Item Default below this plugin
    * 2. To use this plugin with YEP_X_BattleSysCTB, place
    * DoubleX RMMV Unison Item YEP_X_BattleSysCTB below
    * DoubleX RMMV Unison Item Default, which should be placed below this
    * plugin
    * 3. To use this plugin with YEP_X_BattleSysATB, place
    * DoubleX RMMV Unison Item YEP_X_BattleSysATB below
    * DoubleX RMMV Unison Item Default, which should be placed below this
    * plugin

    Video


    (Synchronous unison skills/items)


    (Asynchronous unison skills/items)



    Prerequisites
    1. Some 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

    Changelog
    * DoubleX RMMV Unison Item YEP_X_BattleSysATB:
    * v1.00a(GMT 0600 21-5-2016):
    * 1. 1st version of this plugin finished
    * DoubleX RMMV Unison Item YEP_X_BattleSysCTB:
    * v1.00b(GMT 1300 14-5-2016):
    * 1. In sync with the latest version of DoubleX RMMV Unison Item Config
    * v1.00a(GMT 1500 28-2-2016):
    * 1. 1st version of this plugin finished
    * 2. Unison skills/items needing charging might be executed immediately
    * and/or cause the action order queue to be incorrect and/or outdated
    * DoubleX RMMV Unison Item Default:
    * v1.00f(GMT 1300 14-5-2016):
    * 1. Fixed a bug where unison items can have unison invokees with no
    * empty action slots
    * 2. In sync with the latest version of this plugin
    * v1.00e(GMT 1500 30-1-2016):
    * 1. Fixed not passing this to canUseUnisonSkill and canUseUnisonItem
    * 2. Fixed not checking if item exist first in canUse bug
    * 3. Fixed unison invoker might not have the smallest party member index
    * v1.00d(GMT 1100 4-1-2016):
    * 1. Fixed all unison item being unusable due to typo bug
    * 2. Added plugin description and author name in the plugin manager
    * v1.00c(GMT 0100 1-1-2016):
    * 1. Fixed undefined SceneManager.scene by using $gameParty.inBattle()
    * v1.00b(GMT 0300 26-12-2015):
    * 1. Fixed unison skills/items not usable outside battles bug
    * 2. Simplified the unison skill usability checks
    * v1.00a(GMT 1400 25-12-2015):
    * 1. 1st version of this plugin finished
    * This plugin:
    * v1.03a(GMT 0500 23-7-2016):
    * 1. Added <unison item actor function drain: weights>
    * v1.02a(GMT 1300 14-5-2016):
    * 1. Added <unison item actor learn: flags> and <async unison item>
    * v1.01b(GMT 1300 17-3-2016):
    * 1. Fixed undefined uIFAs[RegExp.$1] in DM.loadItemNotes bug
    * 2. Fixed incorrect unison battler stat when using unison rules bug
    * v1.01a(GMT 1400 15-3-2016):
    * 1. Added <unison item actor mp cost: ids> and
    * <unison item actor tp cost: ids>
    * v1.00f(GMT 1000 28-2-2016):
    * 1. Fixed unison invokees not stepping forward when executing actions
    * v1.00e(GMT 1500 30-1-2016):
    * 1. Fixed not returning value in makeDamageValue bug
    * 2. Fixed not showing unison item names in the battle log window bug
    * 3. Fixed enemy using actor unison item showing unison actor names bug
    * v1.00d(GMT 0200 3-1-2016):
    * 1. FUNCTIONS now store all battler functions instead of merely getters
    * v1.00c(GMT 1300 31-12-2015):
    * 1. Fixed writing getter contents directly instead of using String bug
    * v1.00b(GMT 0900 30-12-2015):
    * 1. Fixed failed to extend battler property name descriptors bug
    * 2. Fixed using new Function and class instead of eval and prototype
    * 3. Fixed unintentionally declaring global variable in strict mode bug
    * 4. Fixed calling push for an Object instead of its Array values bug
    * 5. Fixed using 1 single variable to store all old getter functions bug
    * v1.00a(GMT 1400 25-12-2015):
    * 1. 1st version of this plugin finished

    View attachment DoubleX RMMV Unison Item v103a.rar
    DoubleX RMMV Unison Config
    DoubleX RMMV Unison Default
    DoubleX RMMV Unison Item YEP_X_BattleSysATB
    DoubleX RMMV Unison Item YEP_X_BattleSysCTB
     
    Last edited: Sep 9, 2019
    #1
  2. EastsideTrouble

    EastsideTrouble Veteran Veteran

    Messages:
    33
    Likes Received:
    8
    First Language:
    English
    Thanks for bringing this to MV.  I thought the VX Ace version was amazing and can't wait to work this into my game.  
     
    #2
    DreamX and DoubleX like this.
  3. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    Updates

    Code:
     *      DoubleX RMMV Unison Item Default:                                      *      v1.00b(GMT 0300 26-12-2015):                                           *      1. Fixed unison skills/items not usable outside battles bug            *      2. Simplified the unison skill usability checks                        *      This plugin:                                                           *      v1.00b(GMT 0900 30-12-2015):                                           *      1. Fixed failed to extend battler property name descriptors bug        *      2. Fixed using new Function and class instead of eval and prototype    *      3. Fixed unintentionally declaring global variable in strict mode bug *      4. Fixed calling push for an Object instead of its Array values bug    *      5. Fixed using 1 single variable to store all old getter functions bug
     
    Last edited by a moderator: Dec 30, 2015
    #3
    DreamX likes this.
  4. EastsideTrouble

    EastsideTrouble Veteran Veteran

    Messages:
    33
    Likes Received:
    8
    First Language:
    English
    As a suggestion, perhaps you may want to change the title of the thread to note the unison skills.  I knew it would be there because I used the VXA version, but it wouldn't be too clear to someone that isn't familiar with it.
     
    #4
  5. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    Emergency Fix

    Just reuploaded the previously problematic Unison Item Config v100b
     
    Last edited by a moderator: Dec 30, 2015
    #5
  6. moldy

    moldy Veteran Veteran

    Messages:
    190
    Likes Received:
    28
    First Language:
    English
    I'm getting this error upon battle: 

    TypeError: Cannot read property 'apply' of undefined
     
    #6
  7. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    May you please open the console and post the complete error log(preferably with a screenshot)? I need more info to know what really happened :)
     
    Last edited by a moderator: Dec 30, 2015
    #7
  8. moldy

    moldy Veteran Veteran

    Messages:
    190
    Likes Received:
    28
    First Language:
    English
    It's in the attachment :)

    Untitled.png
     
    #8
    DoubleX likes this.
  9. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    Updates

    Code:
     *      DoubleX RMMV Unison Item Default:                                      *      v1.00c(GMT 0100 1-1-2016):                                             *      1. Fixed undefined SceneManager.scene by using $gameParty.inBattle()  *      This plugin:                                                           *      v1.00c(GMT 1300 31-12-2015):                                           *      1. Fixed writing getter contents directly instead of using String bug
     
    Last edited by a moderator: Jan 1, 2016
    #9
  10. EastsideTrouble

    EastsideTrouble Veteran Veteran

    Messages:
    33
    Likes Received:
    8
    First Language:
    English
    I am getting a few issues.  First, I am not able to get the script to work.  When I go to Specials with my first actor (even though both actors meet the requirements to use the skill) it is greyed out.  When my second tries, I get a crash saying TypeError undefined is not a function.

    Secondly, my game will crash when an enemy attacks.  It says TypeError Failed to execute 'createLinearGradient ' on 'CanvasRenderingContext2D':float parameter 3 is non-finite.

    Happy to send an error log if you tell me how.

    Thanks!
     
    #10
    DoubleX likes this.
  11. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    Updates

    Code:
     *      DoubleX RMMV Unison Item Default:                                      *      v1.00d(GMT 1100 4-1-2016):                                             *      1. Fixed all unison item being unusable due to typo bug                *      2. Added plugin description and author name in the plugin manager      *      This plugin:                                                           *      v1.00d(GMT 0200 3-1-2016):                                             *      1. FUNCTIONS now store all battler functions instead of merely getters
     
    #11
  12. EastsideTrouble

    EastsideTrouble Veteran Veteran

    Messages:
    33
    Likes Received:
    8
    First Language:
    English
    Thanks, but I am still getting both of the same crashes. 
     
    #12
    DoubleX likes this.
  13. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    About all unison skills always being unusable bug, please place this diagnose snippet right below Unison Item Default:

    Game_BattlerBase.prototype.canInput = function() { // Rewritten to check if at least 1 action slot isn't reserved console.log("GBB.canInput.apply(this, arguments)", GBB.canInput.apply(this, arguments)); if (!GBB.canInput.apply(this, arguments)) { return false; } if (this.isActor() && $gameParty.inBattle()) { console.log("this._unisonItemNumInputs", this._unisonItemNumInputs, "this._actions.length", this._actions.length); return this._unisonItemNumInputs < this._actions.length; } return true; // }; // Game_BattlerBase.prototype.canInput Game_BattlerBase.prototype.canUse = function(item) { // Rewritten to check if all unison actors can use the unison skill/item if (!this.isActor() || item.meta.unisonItemActors.length <= 0) { return GBB.canUse.apply(this, arguments); } else if (item.meta.unisonItemActors.indexOf(this.actorId()) < 0) { console.log("item.meta.unisonItemActors", item.meta.unisonItemActors, "this.actorId()", this.actorId()); return false; } console.log("GBB.canUse.apply(this, arguments)", GBB.canUse.apply(this, arguments)); if (!GBB.canUse.apply(this, arguments)) { return false; } if (DataManager.isSkill(item)) { return GBB.canUseUnisonSkill(item); } return DataManager.isItem(item) && GBB.canUseUnisonItem(item); // }; // Game_BattlerBase.prototype.canUse GBB.canUseUnisonSkill = function(skill) { var inBattle = $gameParty.inBattle(); var actor, actorIds = skill.meta.unisonItemActors; // Checks if all needed actors can use the skill and have empty actions for (var index = 0, length = actorIds.length; index < length; index++) { if (actorIds[index] === this.actorId()) { continue; } actor = $gameParty.members().filter(function(mem) { return mem.actorId() === actorIds[index]; })[0]; if (!actor || inBattle && !actor.canInput()) { return false; } console.log("actor.meetsSkillConditions(skill)", actor.meetsSkillConditions(skill)); if (!actor.meetsSkillConditions(skill)) { return false; } if (actor.skills().every(function(s) { return s !== skill; })) { console.log("actor.skills().every(function(s) { return s !== skill; })"); return false; } } // return true; }; // GBB.canUseUnisonSkill
    Also, are all actors involved already learned that unison skill? The unison skill won't be usable if that's the case :D

    About the crashes, please ensure that you're not using any other custom plugin.

    If the crashes still persist, please try to only use Unison Item Config to see if the crashes are still there :)
     
    Last edited by a moderator: Jan 5, 2016
    #13
  14. EastsideTrouble

    EastsideTrouble Veteran Veteran

    Messages:
    33
    Likes Received:
    8
    First Language:
    English
    Sure.  Am I editing the .js file and putting this at the end or saving it as a new scrip?  After I do it, what do I do in order to show it to you?  Thanks again. 

    P.S. I tried disabling every other plugin and also tried just using config. Unfortunately, it didn't help.
     
    Last edited by a moderator: Jan 5, 2016
    #14
    DoubleX likes this.
  15. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    Save that snippet as a new script, then check what's logged on the console :)

    About the crash, try to replace FUNCTION in the user configuration region of Unison Item Config into this:

    /* Sets the battler functions using the unison item rules * Its property names must be the class of the battler functions * Its values must be those battler functions as Strings * All the included battler functions will be extended */ FUNCTIONS: { /* General form: * class: [ * "battler function name", * "battler function name", * "battler function name", * ..., * "battler function name" * ] */ // Adds new classes here }
    Then check if the crashes still happen with only Unison Item Config used :D
     
    #15
  16. EastsideTrouble

    EastsideTrouble Veteran Veteran

    Messages:
    33
    Likes Received:
    8
    First Language:
    English
    Ok.  I did the replacement and tried with just config enabled.  When I did, the game did not crash upon trying to go into the special attack window, but the script didn't really work either.  The first actor selected the unison skill and then the second actor still got to select an action even though he was supposed to be part of the unison skill.  Then, the unison attack executed, but hit for zero damage.

    After that, the enemy attacked me, and I got the CanvasRenderingContext crash that I mentioned before.  A screenshot of the error report from the console is attached. It's the first screenshot labelled Screenshot (2). 

    Also for the snippet you had me save as a new script, I get an immediate crash upon entering battle saying "Reference Error GBB is not defined"

    If you would also like a screenshot of the console report of the crash when Default and Config are enabled that occurs when I select a Special attack, see Screenshot (3) in the attached.

    Thanks again for your attention.

    Screenshot (2).png

    Screenshot (3).png
     
    #16
    DoubleX likes this.
  17. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    After more investigations, I suspect that the CanvasRenderingContext crash has nothing to do with neither Unison Item Config nor Default at all. Instead, it might be due to the default RMMV codebase.

    (On a side note: Yanfly Core Engine - Error during Side View Battle and Game always crashes in combat are what seems to be related to this issue.)

    The below 2 cases will lead to that crash:

    1. There's something wrong with the damage formula.

    If that's the case, then the error should occur whenever skills/items having such problematic formulae are used.

    So you may want to post the damage formula of the skill/item being used when the crash occurs.

    2. One of the targets having grd as 0% is guarding when hit.

    If that's the case, then the error should occur whenever one of the targets having grd as 0% is guarding when hit.

    So you may want to double check if the grd of any battler is 0%.

    If neither's your case, place this diagnose snippet above all custom plugins and check what's logged on the console:

    Game_Action.prototype.makeDamageValue = function(target, critical) { // Rewrite var item = this.item(); console.log("subject", this.subject().name, "item", item.name, "target", target.name, "critical", critical); // Added var baseValue = this.evalDamageFormula(target); console.log("baseValue = this.evalDamageFormula(target)", baseValue); // Added var value = baseValue * this.calcElementRate(target); console.log("value = baseValue * this.calcElementRate(target)", value); // Added if (this.isPhysical()) { value *= target.pdr; console.log("value *= target.pdr", value); // Added } if (this.isMagical()) { value *= target.mdr; console.log("value *= target.mdr", value); // Added } if (baseValue < 0) { value *= target.rec; console.log("value *= target.rec", value); // Added } if (critical) { value = this.applyCritical(value); console.log("value = this.applyCritical(value)", value); // Added } value = this.applyVariance(value, item.damage.variance); console.log("value = this.applyVariance(value, item.damage.variance)", value); // Added value = this.applyGuard(value, target); console.log("value = this.applyGuard(value, target)", value); // Added value = Math.round(value); console.log("value = Math.round(value)", value); // Added return value;}; // Game_Action.prototype.makeDamageValueGame_Action.prototype.executeHpDamage = function(target, value) { // Rewrite if (this.isDrain()) { value = Math.min(target.hp, value); console.log("value = Math.min(target.hp, value)", value); // Added } this.makeSuccess(target); target.gainHp(-value); if (value > 0) { target.onDamage(value); } this.gainDrainedHp(value);}; // Game_Action.prototype.executeHpDamageGame_Action.prototype.executeMpDamage = function(target, value) { // Rewrite if (!this.isMpRecover()) { value = Math.min(target.mp, value); console.log("value = Math.min(target.mp, value)", value); // Added } if (value !== 0) { this.makeSuccess(target); } target.gainMp(-value); this.gainDrainedMp(value);}; // Game_Action.prototype.executeMpDamageGame_Action.prototype.itemEffectRecoverHp = function(target, effect) { // Rewrite var value = (target.mhp * effect.value1 + effect.value2) * target.rec; console.log("value = (target.mhp * effect.value1 + effect.value2) * target.rec", value); // Added if (this.isItem()) { value *= this.subject().pha; console.log("value *= this.subject().pha", value); // Added } value = Math.floor(value); console.log("value = Math.floor(value)", value); // Added if (value !== 0) { target.gainHp(value); this.makeSuccess(target); }}; // Game_Action.prototype.itemEffectRecoverHpGame_Action.prototype.itemEffectRecoverMp = function(target, effect) { // Rewrite var value = (target.mmp * effect.value1 + effect.value2) * target.rec; console.log("value = (target.mmp * effect.value1 + effect.value2) * target.rec", value); // Added if (this.isItem()) { value *= this.subject().pha; console.log("value *= this.subject().pha", value); // Added } value = Math.floor(value); console.log("value = Math.floor(value)", value); // Added if (value !== 0) { target.gainMp(value); this.makeSuccess(target); }}; // Game_Action.prototype.itemEffectRecoverHp
    About the previous snippet, it's because I've made an extremely silly mistake. Replace that snippet with this one(still place it right below DoubleX RMMV Unison Item Default):

    (function(UI) { var GBB = UI.Game_BattlerBase; Game_BattlerBase.prototype.canInput = function() { // Rewritten to check if at least 1 action slot isn't reserved console.log("GBB.canInput.apply(this, arguments)", GBB.canInput.apply(this, arguments)); if (!GBB.canInput.apply(this, arguments)) { return false; } if (this.isActor() && $gameParty.inBattle()) { console.log("this._unisonItemNumInputs", this._unisonItemNumInputs, "this._actions.length", this._actions.length); return this._unisonItemNumInputs < this._actions.length; } return true; // }; // Game_BattlerBase.prototype.canInput Game_BattlerBase.prototype.canUse = function(item) { // Rewritten to check if all unison actors can use the unison skill/item if (!this.isActor() || item.meta.unisonItemActors.length <= 0) { return GBB.canUse.apply(this, arguments); } else if (item.meta.unisonItemActors.indexOf(this.actorId()) < 0) { console.log("item.meta.unisonItemActors", item.meta.unisonItemActors, "this.actorId()", this.actorId()); return false; } console.log("GBB.canUse.apply(this, arguments)", GBB.canUse.apply(this, arguments)); if (!GBB.canUse.apply(this, arguments)) { return false; } if (DataManager.isSkill(item)) { return GBB.canUseUnisonSkill(item); } return DataManager.isItem(item) && GBB.canUseUnisonItem(item); // }; // Game_BattlerBase.prototype.canUse GBB.canUseUnisonSkill = function(skill) { var inBattle = $gameParty.inBattle(); var actor, actorIds = skill.meta.unisonItemActors; // Checks if all needed actors can use the skill and have empty actions for (var index = 0, length = actorIds.length; index < length; index++) { if (actorIds[index] === this.actorId()) { continue; } actor = $gameParty.members().filter(function(mem) { return mem.actorId() === actorIds[index]; })[0]; if (!actor || inBattle && !actor.canInput()) { return false; } console.log("actor.meetsSkillConditions(skill)", actor.meetsSkillConditions(skill)); if (!actor.meetsSkillConditions(skill)) { return false; } if (actor.skills().every(function(s) { return s !== skill; })) { console.log("actor.skills().every(function(s) { return s !== skill; })"); return false; } } // return true; }; // GBB.canUseUnisonSkill})(DoubleX_RMMV.Unison_Item);
    Please enable both Unison Item Config and Default, and try to only test for 1 error(1st snippet for the CanvasRenderingContext crash and 2nd one for the unusable unison skill/item bug) at a time(and thus only enable 1 snippet at a time), otherwise there might be too many logged messages to be displayed :)
     
    Last edited by a moderator: Jan 7, 2016
    #17
  18. EastsideTrouble

    EastsideTrouble Veteran Veteran

    Messages:
    33
    Likes Received:
    8
    First Language:
    English
    Thanks.  Will test again tonight or tomorrow and will post results.
     
    #18
  19. DoubleX

    DoubleX Just a nameless weakling Veteran

    Messages:
    1,462
    Likes Received:
    542
    First Language:
    Chinese
    Primarily Uses:
    N/A
    Updates


    Added this video:







    Code:
     *      DoubleX RMMV Unison Item Default:                                     
     *      v1.00e(GMT 1500 30-1-2016):                                           
     *      1. Fixed not passing this to canUseUnisonSkill and canUseUnisonItem   
     *      2. Fixed not checking if item exist first in canUse bug               
     *      3. Fixed unison invoker might not have the smallest party member index
     *      This plugin:                                                          
     *      v1.00e(GMT 1500 30-1-2016):                                           
     *      1. Fixed not returning value in makeDamageValue bug                   
     *      2. Fixed not showing unison item names in the battle log window bug   
     *      3. Fixed enemy using actor unison item showing unison actor names bug 
    
     
    Last edited by a moderator: Apr 13, 2016
    #19
  20. Radis3D

    Radis3D Just a Devilz Veteran

    Messages:
    172
    Likes Received:
    33
    Location:
    Surabaya, East Java, Indonesia
    First Language:
    Indonesian
    Primarily Uses:
    RMVXA
    Let me bookmark it.. 


    I want try it later.. 


    :)  


    Thank you for making it..  ? 
     
    #20
    DoubleX likes this.

Share This Page