# DOUBLEX RMVXA UNISON ADDON TO YANFLY ENGINE ACE - ACE BATTLE ENGINE

### Lets users make actor unison skills/items needing multiple actors to use

• DoubleX
• 07/22/2015 11:26 AM
• 2429 views
Notetags
```#  * Skill/Item Notetags:                                                      |
#    1. <unison actors: ids>                                                   |
#       - Sets the list of id of actors needed for the skill/item as ids.      |
#         For example:                                                         |
#         <unison actors: 1> means actor with id 1 is required to use it       |
#         <unison actors: 4, 2> means actors with id 4 and 2 are needed        |
#       - All actors in list ids needs to be in the battle, inputable, able to |
#         use it and pay its cost. They'll all pay the cost after using it.    |
#         Only actors in list x can select it.                                 |
#    2. <unison def rule: rule                                                 |
#       - Sets the rule of setting user's def in the skill/item's damage       |
#         formula as rule, whose symbol is one of those in UNISON_RULES.       |
#       - The symbol of def must be included in UNISON_DEFS                    |
#       - This notetag needs to be written below <unison item: ids> to work.   |
#    3. <unison def actors: ids>                                               |
#       - Sets user's method def in the skill/item's damage formula to use its |
#         unison rule to combine those of actors with id includedin the list   |
#         ids. def needs to be able to take no arguments and return a Numeric  |
#         to work.                                                             |
#         For example:                                                         |
#         <unison atk actors: 1> means the user's atk in its damage formula    |
#         uses thatof actor with id 1                                          |
#         <unison mat actors: 4, 2> means the user's mat in its damage formula |
#         uses mat of actors with id 4 and 2 under the skill/item's unison rule|
#       - The symbol of def must be included in UNISON_DEFS                    |
#       - This notetag needs to be written below <unison item: ids> to work.   |
```

Configurations
```# Sets if the battlelog will show all actors involved in the unison skills
# or items instead of only the one invoking them
# If SHOW_UNISON_ACTOR_SWITCH_ID is a natural number, the state of switch
# with id SHOW_UNISON_ACTOR_SWITCH_ID will be used instead
SHOW_UNISON_ACTOR = true
SHOW_UNISON_ACTOR_SWITCH_ID = 0

# Sets the symbol of the rule used for setting the user's methods in the
# damage formula by using those of the included unison actors
# or items instead of only the one invoking them
# It must return a symbol included in UNISON_RULES
# If UNISON_DEF_RULE_VAR_ID is a natural number, the value of variable
# with id UNISON_DEF_RULE_VAR_ID will be used instead
UNISON_DEF_RULE = :avg
UNISON_DEF_RULE_VAR_ID = 0

# Implements the unison method rules
# The unison method value of all unison battlers can be referneced by vals
# The unison method rule symbol can be referenced by rule
# It's a method under Game_BattlerBase
# It must return a real number
UNISON_RULES = %Q(
def unison_rules(vals, rule) # This line shalln't be changed
if rule == :min
vals.min
elsif rule == :avg
vals.inject(:+) / vals.size
elsif rule == :max
vals.max
else
0
end
end
)

# Sets the battler methods to use the unison method rules
# Its keys must be the battler method name symbols
# Methods with name method_name will be aliased to method_name_unison
UNISON_DEFS = {

# General Form:
# [:method_class, :super_class] => [
#   :method_name
# ]

[:Game_BattlerBase] => [
:hp,
:mp,
:tp,
:mhp,
:mmp,
:atk,
:def,
:mat,
:mdf,
:agi
# Adds new methods here

],

[:Game_Actor, :Game_Battler] => [
:level
# Adds new methods here

]

# Adds new classes here

}
```

Info
New Terms:
Unison skill/item - Skill/item needing more than 1 battler to be used
Unison actors - All actors needed for the same unison skill/item
Unison invoker - The unison actor actually selecting and executing the unison skill/item
Unison invokee - Unison actor that's not the unison invoker
Empty action slot - An action slot without a skill/item but can be inputted with a skill/item
Inputted action slot - An action slot with a skill/item inputted
Reserved action slot - An action slot that can't be inputted with a skill/item
Actor inputable check:
An actor's inputable if and only if that actor has at least 1 empty action slot. Only empty and inputted action slots can be selected.
Unison skill/item usability check
1. The actor trying to select an unison skill/item must be an unison actor of that skill/item
2. That actor must pass all the ordinary skill/item usability checks
3. For skills, all unison invokees must be movable, without autobattle nor confusion, meet the ordinary skill conditions, have learned that skill, and have at least 1 empty action slot or reserved action slot that is reserved by the currently inputted unison skill in the currently selected action slot
4. For items, all unison invokees must be movable and without autobattle nor confusion

Video

Games Using This Script
None so far

Prerequisites
Scripts:
1. Yanfly Engine Ace - Ace Battle Engine
2. DoubleX RMVXA Clear Addon to Yanfly Engine Ace - Ace Battle Engine
Abilities:
1. Some RGSS3 scripting proficiency to fully utilize this script

Terms Of Use
You shall:
1. Follow the terms of use of Yanfly Engine Ace - Ace Battle Engine
2. Keep this script's Script Info part's contents intact
You shalln't claim that this script's written by anyone other than DoubleX, his aliases, Yanfly, or his/her aliases
None of the above applies to Yanfly or his/her aliases

Instructions
1. Open the script editor and put this script into an open slot between DoubleX RMVXA Clear Addon to Yanfly Engine Ace - Ace Battle Engine and Main, save to take effect.

Authors
DoubleX:
1. This script
Yanfly:
1. Yanfly Engine Ace - Ace Battle Engine

Changelog
```#    v1.00c(GMT 0000 25-2-2016):                                               |
#    1. Fixed nil actor in unison_item_usable? due to missing code bug         |
#    2. Fixed not restroing the unison usable lock for the currently selected  |
#       unison skill/item right before processing the prior command            |
#    3. Fixed not clearing the unison usable lock for the currently selected   |
#       unison skill/item right after processing the next command              |
#    4. Fixed not clearing unison inputable/usable locks upon clearing unison  |
#       action slot                                                            |
#    v1.00b(GMT 1100 26-7-2015):                                               |
#    1. Fixed reserving nonempty action slots and selecting reserved ones bug  |
#    v1.00a(GMT 1200 22-7-2015):                                               |
#    1. 1st version of this script finished                                    |
```