[RMMV] HELP: DOUBLEX UNISON ITEM DOESN'T WORK!

Posts

Pages: 1
Hello to everyone. I have downloaded DoubleX Unison Item plugin for mv and i have written "<unison item actors: 1, 2, 3, 4>" on the skill note box, but if i attack with the first character, the next characters can perform an attack or action. Where did i go wrong? Thanks.
Jeroen_Sol
Nothing reveals Humanity so well as the games it plays. A game of betrayal, where the most suspicious person is brutally murdered? How savage.
3885
This sounds like a topic that should be in Help me.
pianotm
The TM is for Totally Magical.
32388
Okay, first of all, this is painfully lacking in information. Double X Unison Item suggests you're using two items at once or one item twice. But context, please. What is this supposed to do? What do the directions say in the script?

EDIT: Also, don't fret about it being in the wrong section. Sooner or later, a moderator will see it and move it to the proper section. Just don't make a habit of putting topics in the wrong sections.
Sorry if i wrong section, my mistake. With this plugin, you can set some skills/items to be unison ones needing more than 1 battlers to use them, but in my project doesn't work. Yesterday i forgot to post the script:

/*============================================================================
* ## Plugin Info
*----------------------------------------------------------------------------
* # Plugin Name
* DoubleX RMMV Unison Item Config
*----------------------------------------------------------------------------
* # 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
*----------------------------------------------------------------------------
* # 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 aliases
*----------------------------------------------------------------------------
* # Prerequisites
* Abilities:
* 1. Some Javascript coding proficiency to fully utilize this plugin
*----------------------------------------------------------------------------
* # Links
* This plugin:
* 1. http://pastebin.com/igFhrKja
*----------------------------------------------------------------------------
* # Instructions
* 1. To use this plugin with the default battle system, place
* DoubleX RMMV Unison Item Default below this plugin
*----------------------------------------------------------------------------
* # Author
* DoubleX
*----------------------------------------------------------------------------
* # Changelog
* DoubleX RMMV Unison Item Default:
* 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.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
*============================================================================*/
/*:
* @plugindesc Lets you set some skills/items needing mutiple battlers to use
* @author DoubleX
*
* @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 the plugin js file directly
* @default avg
*
* @help
* The plugin file name must be the same as
* DoubleX_RMMV.Unison_Item_Config_File, which must be edited by editing the
* plugin js file directly
* The default value of DoubleX_RMMV.Unison_Item_Config_File is
* DoubleX RMMV Unison Item Config v100c
*============================================================================
* ## Notetag Info
*----------------------------------------------------------------------------
* # 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 the plugin js file
* directly
* - function must be a battler function name included in
* FUNCTIONS, which must be edited by opening the 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 the plugin js file
* directly
*============================================================================
* ## Plugin Call Info
*----------------------------------------------------------------------------
* # 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 =
* - 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
* - Returns the unison item rule as String for function with name
* functionName as a String
* 4. meta.unisonItemRules = 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 the plugin js file
* directly
* - function with name functionName must be included in
* FUNCTIONS, which must be edited by opening the plugin js file
* directly
* - All meta.unisonItemRules changes can be saved if
* DoubleX RMMV Dynamic Data is used
* 5. meta.unisonItemFunctionActors
* - Returns the Array of ids of actors included for combining their
* function functionName as String using its unison item rule
* 6. meta.unisonItemFunctionActors =
* - 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 the plugin js file
* directly
* - All meta.unisonItemFunctionActors changes can be saved if
* DoubleX RMMV Dynamic Data is used
*============================================================================
*/

"use strict";
var DoubleX_RMMV = DoubleX_RMMV || {};
DoubleX_RMMV = "v1.00c";

// The plugin file name must be the same as DoubleX_RMMV.Unison_Item_Config_File
DoubleX_RMMV.Unison_Item_Config_File = "DoubleX RMMV Unison Item Config v100c";

/*============================================================================
* ## Plugin Configurations
* You only need to edit this part as it's about what this plugin does
*----------------------------------------------------------------------------*/

DoubleX_RMMV.Unison_Item = {

/* 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; });
} 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; });
}
console.log("The unison item rule " + rule + " isn't implemented");
return 0;
},

/* Sets the battler functions using the unison item rules
* Its property names must be the class of the battler property descriptors
* Its values must be those property descriptor names as Strings
* All the included battler property descriptors must have the get function
* defined via Object.defineProperty/Object.defineProperties
* All the included battler property descriptors will be extended
*/
FUNCTIONS: {

/* General form:
* class:
*/

Game_BattlerBase: ,

Game_Actor:

// Adds new classes here


}

}; // DoubleX_RMMV.Unison_Item

/*============================================================================
* ## Plugin Implementations
* You need not edit this part as it's about how this plugin works
*----------------------------------------------------------------------------
* # Plugin Support Info:
* 1. Prerequisites
* - Solid understanding to the implementation parts independent from
* any action input nor execution flows in battles
* - Decent Javascript coding proficiency to fully comprehend this
* plugin
* 2. Function documentation
* - The 1st part describes why this function's rewritten/extended for
* rewritten/extended functions or what the function does for new
* functions
* - The 2nd part describes what the arguments of the function are
* - The 3rd part informs which version rewritten, extended or created
* this function
* - The 4th part informs whether the function's rewritten or new
* - The 5th part informs whether the function's a real or potential
* hotspot
* - The 6th part describes how this function works for new functions
* only, and describes the parts added, removed or rewritten for
* rewritten or extended functions only
* Example:
* /*----------------------------------------------------------------------
* * Why rewrite/extended/What this function does
* *----------------------------------------------------------------------*/
/* // arguments: What these arguments are
* functionName = function(arguments) { // Version X+; Hotspot
* // Added/Removed/Rewritten to do something/How this function works
* functionContents
* //
* } // functionName
*----------------------------------------------------------------------------*/

(function(UI) {

UI.DataManager = {};
var DM = UI.DataManager;

DM.isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
// Rewritten
return DM.isDatabaseLoaded.apply(this, arguments) && DM.loadAllNotes();
//
}; // DataManager.isDatabaseLoaded

DM.loadAllNotes = function() {
.forEach(function(type) {
type.forEach(function(data) {
if (data) { DM.loadItemNotes(data); }
});
});
return true;
}; // DM.loadAllNotes

// data: The data to have its notetags read
DM.loadItemNotes = function(data) {
data.meta.unisonItemActors = ;
data.meta.unisonItemRules = {};
data.meta.unisonItemFunctionActors = {};
var uIAs = data.meta.unisonItemActors;
var uIRs = data.meta.unisonItemRules;
var uIFAs = data.meta.unisonItemFunctionActors;
var actors = /< *unison +item +actors *: *(\d+(?: *, *\d+)*) *>/i;
var rule = /< *unison +item +(\w+) +rule*: *(\w+) *>/i;
var fAs = /< *unison +item +(\w+) +actors *: *(\d+(?: *, *\d+)*) *>/i;
data.note.split(/+/).forEach(function(line) {
if (line.match(rule)) {
uIRs = RegExp.$2;
return;
} else if (line.match(actors)) {
RegExp.$1.trim().split(/,/).forEach(function(id) {
uIAs.push(+id);
});
} else if (!line.match(fAs)) { return; }
uIFAs = uIFAs || ;
RegExp.$2.trim().split(/,/).forEach(function(id) {
uIFAs.push(+id);
});
});
}; // DM.loadItemNotes

UI.Game_System = {};
var GS = UI.Game_System;

/*------------------------------------------------------------------------
* New public instance variable
*------------------------------------------------------------------------*/
// The storage of all configuration values
Object.defineProperty(Game_System.prototype, "unisonItem", {
get: function() { return this._unisonItem; },
configurable: true
});

GS.initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
GS.initialize.apply(this, arguments);
GS.initUnisonItemParams.call(this); // Added
}; // Game_System.prototype.initialize

GS.initUnisonItemParams = function() {
var params;
this._unisonItem = {};
params = PluginManager.parameters(DoubleX_RMMV.Unison_Item_Config_File);
Object.keys(params).forEach(function(param) {
this._unisonItem = params === "true";
}, this);
this._unisonItem.unisonFunctionRule = params.unisonFunctionRule;
}; // GS.initUnisonItemParams

UI.Game_Action = {};
var GA = UI.Game_Action;

GA.makeDamageValue = Game_Action.prototype.makeDamageValue;
Game_Action.prototype.makeDamageValue = function(target, critical) {
// Added to set all user functions to use their unison item rules
var item = this.item(), subject = this.subject();
if (subject.isActor() && item.meta.unisonItemActors.length > 1) {
subject.unisonItem = item;
}
//
GA.makeDamageValue.apply(this, arguments);
subject.unisonItem = null; // Added to set all user functions to normal
}; // Game_Action.prototype.makeDamageValue

UI.Game_Battler = {};
var GB = UI.Game_Battler;

/*------------------------------------------------------------------------
* New public instance variables
*------------------------------------------------------------------------*/
Object.defineProperties(Game_Battler.prototype, {
// Read by Game_BattlerBase to get the other battlers' action slot list
"actions": {
get: function() { return this._actions; },
configurable: true
},
// The cached unison skill/item when executing its damage formula
"unisonItem": {
set: function(item) { this._unisonItem = item; },
configurable: true
}
});

GB.useItem = Game_Battler.prototype.useItem;
Game_Battler.prototype.useItem = function(item) {
// Rewritten to ask all unison invokees to pay the skill/item cost only
if (!DataManager.isSkill(item)) {
return GB.useItem.apply(this, arguments);
} else if (item.meta.unisonItemActors.length <= 1) {
return GB.useItem.apply(this, arguments);
}
item.meta.unisonItemActors.forEach(function(actorId) {
$gameActors.actor(actorId).paySkillCost(item);
});
//
}; // Game_Battler.prototype.useItem

UI.Window_ItemList = {};
var WIL = UI.Window_ItemList;

WIL.isEnabled = Window_ItemList.prototype.isEnabled;
Window_ItemList.prototype.isEnabled = function(item) {
// Rewritten to disable unison items when unison conditions aren't met
if (!DataManager.isItem(item)) {
return WIL.isEnabled.apply(this, arguments);
} else if (item.meta.unisonItemActors.length <= 1) {
return WIL.isEnabled.apply(this, arguments);
} else if (SceneManager.scene.constructor !== Scene_Battle) {
return WIL.isEnabled.apply(this, arguments);
}
return BattleManager.actor() && BattleManager.actor().canUse(item);
//
}; // Window_ItemList.prototype.isEnabled

UI.Window_BattleLog = {};
var WBL = UI.Window_BattleLog;

WBL.displayAction = Window_BattleLog.prototype.displayAction;
Window_BattleLog.prototype.displayAction = function(subject, item) {
// Rewritten to display all unison actor names if users set so
if (!$gameSystem.unisonItem.showAllUnisonBattlers) {
return WBL.displayAction.apply(this, arguments);
} else if (item.meta.unisonItemActors.length <= 1) {
return WBL.displayAction.apply(this, arguments);
}
WBL.displayUnisonAct.call(this, item);
//
}; // Window_BattleLog.prototype.displayAction

WBL.displayUnisonAct = function(item) {
var names = WBL.unisonActorNames(item.meta.unisonItemActors);
var numMethods = this._methods.length;
if (DataManager.isSkill(item)) {
if (item.message1) { this.push('addText', names); }
if (item.message2) {
this.push('addText', item.message2.format(item.name));
}
} else {
var text = TextManager.useItem.format(names, item.name);
this.push('addText', text);
}
if (this._methods.length === numMethods) { this.push('wait'); }
}; // WBL.displayUnisonAct

WBL.unisonActorNames = function(actorIds) {
var names = "";
for (var index = 0, length = actorIds.length; index < length; index++) {
if (index > 0 && index < length - 1) {
names += ", ";
} else if (index === length - 1) {
names += " and ";
}
names += $gameActors.actor(actorIds).name();
}
return names;
}; // WBL.unisonActorNames

var Proto;
for (var K in UI.FUNCTIONS) {
if (!UI.FUNCTIONS.hasOwnProperty(K)) { continue; }
UI = UI || {}; // Ensures container GB won't be rewritten
Proto = eval(K + ".prototype"); // Actual class prototype
UI.FUNCTIONS.forEach(function(pD) {

/*------------------------------------------------------------
* Extends all battler functions using unison item rules
*------------------------------------------------------------*/
UI = Object.getOwnPropertyDescriptor(Proto, pD).get;
Object.defineProperty(Proto, pD, { get: new Function(;",
"if (!actorIds) {",
" return UI." + K + "." + pD + ".apply(this, arguments);",
"}",
"var vals = actorIds.map(function(actorId) {",
" var actor = $gameActors.actor(actorId);",
" return UI." + K + "." + pD + ".apply(actor, arguments);",
"});",
"var rule = item.meta.unisonItemRules;",
"rule = rule || $gameSystem.unisonItem.unisonFunctionRule;",
"return UI.RULES.call(this, rule, vals);",
].join("\n")), configurable: true
});

});
}

})(DoubleX_RMMV.Unison_Item);

/*============================================================================*/


DoubleX RMMV Unison Item Default
/*============================================================================
* ## Plugin Info
*----------------------------------------------------------------------------
* # Plugin Name
* DoubleX RMMV Unison Item Default
*----------------------------------------------------------------------------
* # 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 aliases
*----------------------------------------------------------------------------
* # Prerequisites
* Plugins:
* 1. DoubleX RMMV Unison Item Config
*----------------------------------------------------------------------------
* # Links
* This plugin:
* 1. http://pastebin.com/kV33uWeU
*----------------------------------------------------------------------------
* # Instructions
* 1. Place this plugin below DoubleX RMMV Unison Item Config
*----------------------------------------------------------------------------
* # Author
* DoubleX
*----------------------------------------------------------------------------
* # Changelog
* 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
*============================================================================*/

"use strict";
var DoubleX_RMMV = DoubleX_RMMV || {};
DoubleX_RMMV = "v1.00a";

/*============================================================================
* ## Plugin Implementations
* You need not edit this part as it's about how this plugin works
*----------------------------------------------------------------------------
* # Plugin Support Info:
* 1. Prerequisites
* - Solid understanding to the default RMMV actor action input flows
* - Decent Javascript coding proficiency to fully comprehend this
* plugin
* 2. Function documentation
* - The 1st part describes why this function's rewritten/extended for
* rewritten/extended functions or what the function does for new
* functions
* - The 2nd part describes what the arguments of the function are
* - The 3rd part informs which version rewritten, extended or created
* this function
* - The 4th part informs whether the function's rewritten or new
* - The 5th part informs whether the function's a real or potential
* hotspot
* - The 6th part describes how this function works for new functions
* only, and describes the parts added, removed or rewritten for
* rewritten or extended functions only
* Example:
* /*----------------------------------------------------------------------
* * Why rewrite/extended/What this function does
* *----------------------------------------------------------------------*/
/* // arguments: What these arguments are
* functionName = function(arguments) { // Version X+; Hotspot
* // Added/Removed/Rewritten to do something/How this function works
* functionContents
* //
* } // functionName
*----------------------------------------------------------------------------*/

if (DoubleX_RMMV) {

(function(UI) {

UI.BattleManager = UI.BattleManager || {};
var BM = UI.BattleManager;

/*------------------------------------------------------------------------
* New public instance variable
*------------------------------------------------------------------------*/
// BM.unisonActors: The mapping between unison actions and unison invokees

BM.initMembers = BattleManager.initMembers;
BattleManager.initMembers = function() {
BM.unisonActors = {}; // Added
BM.initMembers.apply(this, arguments);
}; // BattleManager.initMembers

BM.selectNextCommand = BattleManager.selectNextCommand;
BattleManager.selectNextCommand = function() {
BM.addUnisonActors.call(this); // Added to set the action-invokee pair
BM.selectNextCommand.apply(this, arguments);
}; // BattleManager.selectNextCommand

BM.selectPreviousCommand = BattleManager.selectPreviousCommand;
BattleManager.selectPreviousCommand = function() {
// Added to ensure this cancelled action can be reserved for unison ones
var act = this.actor().inputtingAction();
if (act) { act.clear(); }
//
BM.selectPreviousCommand.apply(this, arguments);
// Added to clear the action-invokee pair
if (this.actor()) { BM.eraseUnisonActors(this.actor()); }
//
}; // BattleManager.selectPreviousCommand

BM.startTurn = BattleManager.startTurn;
BattleManager.startTurn = function() {
// Added to clears all action-invokee mappings and reserved action slots
BM.clearUnisonActors();
//
BM.startTurn.apply(this, arguments);
}; // BattleManager.startTurn

BM.addUnisonActors = function() {
var actor = this.actor(), act, item;
if (actor) { act = actor.inputtingAction(); }
if (act) { item = act.item(); }
if (!item || item.meta.unisonItemActors.length <= 1) { return; }
var actorIds = item.meta.unisonItemActors.filter(function(actorId) {
return actorId !== actor.actorId();
});
// Stores the action-invokee pair and reserves 1 action for each of them
BM.unisonActors[] = actorIds;
actorIds.forEach(function(actorId) {
$gameActors.actor(actorId).unisonItemNumInputs += 1;
});
//
}; // BM.addUnisonActors

// actor: The currently selected actor
BM.eraseUnisonActors = function(actor) {
var actorIds = BM.unisonActors[];
if (!actorIds) { return; }
// Voids the action-invokee pair and frees 1 action for each of them
BM.unisonActors[] = null;
actorIds.forEach(function(actorId) {
$gameActors.actor(actorId).unisonItemNumInputs -= 1;
});
//
}; // BM.eraseUnisonActors

BM.clearUnisonActors = function() {
BM.unisonActors = {};
// Ensures the unison action usability check will pass upon using it
$gameParty.movableMembers().forEach(function(mem) {
mem.unisonItemNumInputs = -1;
});
//
}; // BM.clearUnisonActors

UI.Game_BattlerBase = UI.Game_BattlerBase || {};
var GBB = UI.Game_BattlerBase;

GBB.canInput = Game_BattlerBase.prototype.canInput;
Game_BattlerBase.prototype.canInput = function() {
// Rewritten to check if at least 1 action slot isn't reserved
if (!GBB.canInput.apply(this, arguments)) { return false; }
if (this.isActor() && $gameParty.inBattle()) {
return this._unisonItemNumInputs < this._actions.length;
}
return true;
//
}; // Game_BattlerBase.prototype.canInput

GBB.canUse = Game_BattlerBase.prototype.canUse;
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) {
return false;
}
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 === this.actorId()) { continue; }
actor = $gameParty.members().filter(function(mem) {
return mem.actorId() === actorIds;
});
if (!actor || inBattle && !actor.canInput()) { return false; }
if (!actor.meetsSkillConditions(skill)) { return false; }
if (actor.skills().every(function(s) { return s !== skill; })) {
return false;
}
}
//
return true;
}; // GBB.canUseUnisonSkill

GBB.canUseUnisonItem = function(item) {
if (!this.meetsItemConditions(item)) { return false; }
var inBattle = $gameParty.inBattle();
var actor, actorIds = item.meta.unisonItemActors;
for (var index = 0, length = actorIds.length; index < length; index++) {
if (actorIds === this.actorId()) { continue; }
actor = $gameParty.members().filter(function(mem) {
return mem.actorId() === actorIds;
});
if (!actor || inBattle && !actor.canInput()) { return false; }
}
return true;
}; // GBB.canUseUnisonItem

UI.Game_Actor = UI.Game_Actor || {};
var GA = UI.Game_Actor;

/*------------------------------------------------------------------------
* New public instance variables
*------------------------------------------------------------------------*/
Object.defineProperties(Game_Actor.prototype, {
// Read by BattleManager to store the unison action-invokees pairs
"actionInputIndex": {
get: function() { return this._actionInputIndex; },
configurable: true
},
// The number of empty actions reserved for using unison skills/items
"unisonItemNumInputs": {
get: function() { return this._unisonItemNumInputs; },
set: function(num) { this._unisonItemNumInputs = num; },
configurable: true
}
});

GA.initMembers = Game_Actor.prototype.initMembers;
Game_Actor.prototype.initMembers = function() {
GA.initMembers.apply(this, arguments);
this._unisonItemNumInputs = 0; // Added
}; // Game_Actor.prototype.initMembers

GA.clearActions = Game_Actor.prototype.clearActions;
Game_Actor.prototype.clearActions = function() {
GA.clearActions.apply(this, arguments);
this._unisonItemNumInputs = 0; // Added
}; // Game_Actor.prototype.clearActions

GA.selectNextCommand = Game_Actor.prototype.selectNextCommand;
Game_Actor.prototype.selectNextCommand = function() {
// Added to return false if the next slot's reserved for unison act also
var maxIndex = this._actions.length - 1;
if (this._actionInputIndex + this._unisonItemNumInputs >= maxIndex) {
return false;
}
//
return GA.selectNextCommand.apply(this, arguments);
}; // Game_Actor.prototype.selectNextCommand

})(DoubleX_RMMV.Unison_Item);

(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 === this.actorId()) { continue; }
actor = $gameParty.members().filter(function(mem) {
return mem.actorId() === actorIds;
});
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);

} else {
alert("To use Unison Item Default, place it below Unison Item Config.");
}

/*============================================================================*/
Moved to the Programming and Plug-in board... where script stuff is supposed to go.
First, please make sure you've placed Unison Item Default below Unison Item Config.
If that's the case, then please place this diagnose right below Unison Item Default and check what's logged on the console:
(function(UI) {

    var BM = UI.BattleManager;

    BM.addUnisonActors = function() {
        console.log("BM.addUnisonActors");
        var actor = this.actor(), act, item;
        if (actor) { act = actor.inputtingAction(); }
        if (act) { item = act.item(); }
        if (item) { console.log("item.meta.unisonItemActors", item.meta.unisonItemActors, "actor.actorId()", actor.actorId()); }
        if (!item || item.meta.unisonItemActors.length <= 1) { return; }
        var actorIds = item.meta.unisonItemActors.filter(function(actorId) {
            return actorId !== actor.actorId();
        });
        console.log("actorIds", actorIds, "actor.index()", actor.index(), "actor.actionInputIndex", actor.actionInputIndex);
        // Stores the action-invokee pair and reserves 1 action for each of them
        BM.unisonActors[[actor.index(), actor.actionInputIndex]] = actorIds;
        actorIds.forEach(function(actorId) {
            $gameActors.actor(actorId).unisonItemNumInputs += 1;
            console.log("actorId", actorId, "$gameActors.actor(actorId).unisonItemNumInputs", $gameActors.actor(actorId).unisonItemNumInputs);
        });
        //
    }; // BM.addUnisonActors

    // actor: The currently selected actor
    BM.eraseUnisonActors = function(actor) {
        console.log("BM.eraseUnisonActors");
        var actorIds = BM.unisonActors[[actor.index(), actor.actionInputIndex]];
        console.log("actor.actorId()", actor.actorId(), "actorIds", actorIds, "actor.index()", actor.index(), "actor.actionInputIndex", actor.actionInputIndex);
        if (!actorIds) { return; }
        // Voids the action-invokee pair and frees 1 action for each of them
        BM.unisonActors[[actor.index(), actor.actionInputIndex]] = null;
        actorIds.forEach(function(actorId) {
            $gameActors.actor(actorId).unisonItemNumInputs -= 1;
            console.log("actorId", actorId, "$gameActors.actor(actorId).unisonItemNumInputs", $gameActors.actor(actorId).unisonItemNumInputs);
        });
        //
    }; // BM.eraseUnisonActors

    BM.clearUnisonActors = function() {
        console.log("BM.clearUnisonActors");
        BM.unisonActors = {};
        // Ensures the unison action usability check will pass upon using it
        $gameParty.movableMembers().forEach(function(mem) {
            mem.unisonItemNumInputs = -1;
            console.log("mem.name()", mem.name(), "mem.unisonItemNumInputs", mem.unisonItemNumInputs);
        });
        //
    }; // BM.clearUnisonActors

    var GBB = UI.Game_BattlerBase;

    Game_BattlerBase.prototype.canInput = function() {
        console.log("Game_BattlerBase.prototype.canInput");
        // 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) {
        console.log("Game_BattlerBase.prototype.canUse");
        // Rewritten to check if all unison actors can use the unison skill/item
        console.log("item.meta.unisonItemActors", item.meta.unisonItemActors, "this.actorId()", this.actorId());
        if (!this.isActor() || item.meta.unisonItemActors.length <= 0) {
            return GBB.canUse.apply(this, arguments);
        } else if (item.meta.unisonItemActors.indexOf(this.actorId()) < 0) {
            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) {
        console.log("GBB.canUseUnisonSkill");
        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);
Thank you for your reply. I have placed "Unison Item Default" below "Unison Item Config" (in the same plug in, right?) and i have added your code in the end of plugin, but it doesn't work: the character use the unison skill individually, and the next characters can attack as the plugin is turned off...
author=Kyusef
Thank you for your reply. I have placed "Unison Item Default" below "Unison Item Config" (in the same plug in, right?) and i have added your code in the end of plugin, but it doesn't work: the character use the unison skill individually, and the next characters can attack as the plugin is turned off...

I've just updated both the config and default to v1.00e. Both of them should work now:
Perfect, thank you very much! ;)
I can combine it with yanfly ctb system?
author=Kyusef
Perfect, thank you very much! ;)
I can combine it with yanfly ctb system?

Probably not, as unison item default only works with the default RMMV battle system, while unison item config won't work on its own.
Later I'll try to write something like unison item yanfly ctb :)
author=Kyusef
Perfect, thank you very much! ;)
I can combine it with yanfly ctb system?
It now supports Yanfly CTB although unison skills/items needing to be charged might be buggy sometimes:
You may want to check the Unison Item plugins now, as they've been updated :)
Wow, amazing!! Thank you very much! ;)
Pages: 1