- Joined
- Jan 2, 2014
- Messages
- 1,787
- Reaction score
- 939
- First Language
- Chinese
- Primarily Uses
- N/A
This post aims to share my understanding about unison skill/item scripts and explore some ways to write some of them designed for respective battle systems.
Unison skill/item scripts are generally heavily dependent on the action input and execution mechanisms of the battle systems they've to work with, so it's incredibly unrealistic, if even possible at all, to write an unison skill/item script that works on multiple battle systems that all have extremely different action input and execution mechanisms.
Therefore, you're assumed to have at least:
- Decent battle scripting proficiency(Experienced scripters having written dozens of useful scripts and solid understanding of the battle related parts of the exposed default RMVXA scripts)
- Solid understanding of the battle systems you want your unison skill/item scripts to work with(having written such battle systems will be a huge bonus here
)
Before discussing how they can be written, however, I've to clarify what unison skill/items are first.
Clarifications
Right now I'll only talk about the 1st type unison skill/item scripts that work with the default RMVXA battle system, and only non autobattle/confusion actor unison skills/items will be discussed. I might talk about working with other battle systems later, but for enemy unison skills/items, it's still just way too hard for me to figure out how to solve that(the hardest part for me is the enemy unison AI) XD
1st type non autobattle/confusion actor unison skills/items in the default battle system
2. Battle modification implementations
The original use_item will be called instead if it's not an unison skill/item, otherwise all unison battlers will pay that unison skill/item's costs.
For the 2nd change, when the log window displays the use of an unison skill/item, shows all unison battlers' names instead of just the unison invokee's. For instance(Upcoming version of DoubleX RMVXA Unison Item):
The original display_use_item will be called instead if it's not an unison skill/item, otherwise all unison battlers' names will be stored in unison_actor_list which is used in add_text.
Action Usability Changes
This one's a bit challenging, but if you've a solid understanding of how action usability checks in the default RMVXA battle system works, you should've little trouble implementing this change.
For instance(Upcoming version of DoubleX RMVXA Unison Item):
The original usable? will be called if it's not an unison skill/item.
It shouldn't be usable if:
- It's not picked by an unison battler
- Not all unison actors are in the battle
- Not all unison battlers are inputable
If it's a skill, then it shouldn't be usable as well if:
- Not all unison battlers have that unison skill/item
- Not all unison battlers meet its requirements
Action Input Changes
This one's the main dish in this post, as it's quite tough, and much harder than the other changes. If you don't have a solid understanding of how the action input phase of the default RMVXA battle system works, you'd likely be doomed here lol
Anyway, you've to know the below 2 facts to have a reasonable chance to implement the changes:
1. There are 3 action slot types that are of our interests here - Ordinary action slots(having ordinary skills/items or not inputted anything not due to being reserved), unison action slots(having unison skills/items; unison invoker only) and reserved action slots(for unison skills/items; unison invokees only).
2. Recall that all action slots of all inputable actors are linked by a doubly linked list or an analogous data structure, and the item part of any action slot can't be cleared but only replaced by new ones in the action input phase. Combining with all the needed action usability and input changes, it can be deduced that the unison invoker's index is always smaller than every other unison invokee's one(thus the 1st inputable actor will never be an unison invokee).
The above 2 facts are fundamental to the below Dual Stack Algorithm and Dual Variable Algorithm. They've to be used together in order to work.
For the Dual Stack Algorithm:
1. Uses 2 new stacks to trace the action slots - 1 for ordinary/unison ones(input stack), and another for reserved ones(reserved stack). They should be initially empty arrays.
2. Right after inputting an ordinary skill/item, pushes its action slot into the input stack, and an empty list into the reserved one.
3. Right after inputting an unison skill/item, pushes its action slot into the input stack, and its associated unison battler id list into the reserved one.
4. Right before pointing to a previously inputted action slot, pops both the input and reserved stack once.
5. Both stacks should be cleared after ending the action input phase.
For the Dual Variable Algorithm:
1. Uses 2 variables to trace the number of inputted(existing @action_input_index) and reserved action slots(new @reserve_act) respectively for each actor. The latter should be 0 when new action slots are made.
2. Right after an actor inputs a skill/item, increases @action_input_index of that actor by 1(default behavior).
3. Right after allocating a reserved action slot for an actor(3. of the Dual Stack Algorithm), increases @reserve_act of that actor by 1.
4. Right before pointing to a previously inputted action slot(for any actor), decreases @action_input_index of the actor owning that inputted action slot by 1(default behavior) and @reserve_act of all actors included by the associated unison battler id list, if any, by 1(or does nothing if it's an empty array instead).
5. An actor shouldn't be inputable if @action_input_index + @reserve_act = the number of action slots(so the sum of the formers should never be greater than the latter).
The below explains why Dual Stack Algorithm and Dual Variable Algorithm will work when used together(you'll have to have a solid understanding of how the actor inputable check of the default RMVXA battle system works to understand these explanations):
1. All the reserved action slots of an actor are always that actor's last action slots, and the 1st inputable actor will never have any reserved action slots.
2. For the 1st needed change, each unison invokee reserves 1 action slot by increasing @reserve_act by 1. As the number of action slots stays the same in the same action input phase and the maximum value of @action_input_index, which is the number of action slots - @reserve_act, indicates the maximum number of inputtable action slots(default behavior), each unison invokee now has 1 less inputable action slot.
3. For the 2nd needed change, when a previously inputted unison action slot's pointed to, the reserved stack will pop the associating unison battler id list, and all actors included by that list will decrease @reserve_act by 1, effectively increasing the maximum value of @action_input_index by 1 and thus freeing their reserved action slots.
4. For the 3rd needed change, when a reserved action slot would be pointed to, it'd mean all the next action slots are reserved and @action_input_index + @reserve_act = the number of action slots, making the actor not inputable. As the "next pointer"(except the tail one) always points to inputable actor's action slots, it'll point to the 1st action slot of the next inputable actor instead.
5. For the 4th needed change, when a reserved action slot would be pointed to, both the input and reserved stack will be popped.
If @action_input_index of the would be selected actor is 0, it'll be untouched as that actor has no inputted action slots at all, meaning that actor's not inputable. As the "previous pointer"(except the head one) always points to inputable actor's action slots,the last action of the prior actor would be pointed to instead and this check will be repeated until an inputable actor's found.
Otherwise @action_input_index of the would be selected actor will be decreased by 1, making that actor inputable. The last inputable action slot of that actor will be pointed to(default behavior).
The below is an example(Upcoming version of DoubleX RMVXA Unison Item) using the core strategies behind the Dual Stack Algorithm:
The below is an example(Upcoming version of DoubleX RMVXA Unison Item) using the core strategies behind the Dual Variable Algorithm:
That's all for now. I hope this topic can help you better grasp how unison skills/item scripts can be written. Again, later I might write how to write them for other battle systems(probably including Yanfly Engine Ace - Ace Battle Engine), and how to write enemy unison skills/items scripts when I can finally figure it out myself. For skilled unison skills/items script developers, feel free to point out any mistake I made
Unison skill/item scripts are generally heavily dependent on the action input and execution mechanisms of the battle systems they've to work with, so it's incredibly unrealistic, if even possible at all, to write an unison skill/item script that works on multiple battle systems that all have extremely different action input and execution mechanisms.
Therefore, you're assumed to have at least:
- Decent battle scripting proficiency(Experienced scripters having written dozens of useful scripts and solid understanding of the battle related parts of the exposed default RMVXA scripts)
- Solid understanding of the battle systems you want your unison skill/item scripts to work with(having written such battle systems will be a huge bonus here
Before discussing how they can be written, however, I've to clarify what unison skill/items are first.
Clarifications
The basic definition of an unison skill/item is one needing more than 1 battler to cast simultaneously and they all have to pay its costs. But afaik, there are at least 2 types of unison skill/items:
1. A battler picks an unison skill/item using x action slots for each unison battler, and all other unison battler reserves x action slots for that picked unison skill. They all pay the same unison skill/item costs.
Example: DoubleX RMVXA Unison Item
2. Each unison battler picks a skill/item, and if the combination of all those skills/items meets the requirement of triggering an unison skill/item, that unison skill/item will be triggered by one of those unison battlers instead. They either pay the same unison skill/item costs, or pay their own picked skill/item's costs.
Example: Basic Combo Attacks
As only 1 battler can execute an action at a time(unless you're gifted enough to break this limitation in Scene_Battle based battle systems), any unison skill/item has only 1 unison invoker and all the other unison battlers are unison invokees. Only the unison invoker will execute the unison skill/item.
In the 1st type, the unison invoker is always the one picking the unison skills; In the 2nd type, the unison invoker will be picked among all unison battlers according to rules set by the unison skill/item scripts.
1. A battler picks an unison skill/item using x action slots for each unison battler, and all other unison battler reserves x action slots for that picked unison skill. They all pay the same unison skill/item costs.
Example: DoubleX RMVXA Unison Item
2. Each unison battler picks a skill/item, and if the combination of all those skills/items meets the requirement of triggering an unison skill/item, that unison skill/item will be triggered by one of those unison battlers instead. They either pay the same unison skill/item costs, or pay their own picked skill/item's costs.
Example: Basic Combo Attacks
As only 1 battler can execute an action at a time(unless you're gifted enough to break this limitation in Scene_Battle based battle systems), any unison skill/item has only 1 unison invoker and all the other unison battlers are unison invokees. Only the unison invoker will execute the unison skill/item.
In the 1st type, the unison invoker is always the one picking the unison skills; In the 2nd type, the unison invoker will be picked among all unison battlers according to rules set by the unison skill/item scripts.
1st type non autobattle/confusion actor unison skills/items in the default battle system
You're assumed to have a solid understanding to the default RMVXA battle flow implementations when reading this part.
1. Battle modification requirements
Action Execution Changes
1. As only the unison invoker will execute the unison skill/item, all the other unison invokees only need to pay the unison skill/item costs after executing that unison skill/item.
2. To clearly show all the unison battlers of the unison skill/item when it's executing, the log window should show all their names.
Action Usability Changes
1. As all unison battlers need to be able to use the unison skill/item while only the unison invoker actually uses it, the action usability check of the unison invoker upon both inputting and executing that unison skill/item needs to check all unison battlers' usability of that unison skill/item.
Action Input Changes
1. Right after an unison invoker finished inputting the unison skill/item, all other unison invokees of that unison skill/item needs to reserve an action slot for that unison skill/item.
2. Right after an action slot of an unison invoker's been replaced the previous unison skill/item with a new skill/item(or right after an previously inputted action slot with an unison skill/item's pointed to), all other unison invokees' reserved action slots for that unison skill/item need to be "freed".
3. If proceeding to the next action slot would point to a reserved one for an unison skill/item, the next action slot of that reserved one, if any(or the 1st action slot of the next inputable actor if the last action slot's reached), should be pointed to instead. Repeat until there's no more next action slots(then the Action Input Phase should be ended) or the next one isn't reserved for unison skills/items.
4. If proceeding to the prior action slot would point to a reserved one for an unison skill/item, the prior action slot of that reserved one, if any(or the last action slot of the prior inputable actor if the 1st action slot's reached), should be pointed to instead. Repeat this until there's no more prior action slots(then the party command window should be shown) or the prior one isn't reserved for unison skills/items.
1. Battle modification requirements
Action Execution Changes
1. As only the unison invoker will execute the unison skill/item, all the other unison invokees only need to pay the unison skill/item costs after executing that unison skill/item.
2. To clearly show all the unison battlers of the unison skill/item when it's executing, the log window should show all their names.
Action Usability Changes
1. As all unison battlers need to be able to use the unison skill/item while only the unison invoker actually uses it, the action usability check of the unison invoker upon both inputting and executing that unison skill/item needs to check all unison battlers' usability of that unison skill/item.
Action Input Changes
1. Right after an unison invoker finished inputting the unison skill/item, all other unison invokees of that unison skill/item needs to reserve an action slot for that unison skill/item.
2. Right after an action slot of an unison invoker's been replaced the previous unison skill/item with a new skill/item(or right after an previously inputted action slot with an unison skill/item's pointed to), all other unison invokees' reserved action slots for that unison skill/item need to be "freed".
3. If proceeding to the next action slot would point to a reserved one for an unison skill/item, the next action slot of that reserved one, if any(or the 1st action slot of the next inputable actor if the last action slot's reached), should be pointed to instead. Repeat until there's no more next action slots(then the Action Input Phase should be ended) or the next one isn't reserved for unison skills/items.
4. If proceeding to the prior action slot would point to a reserved one for an unison skill/item, the prior action slot of that reserved one, if any(or the last action slot of the prior inputable actor if the 1st action slot's reached), should be pointed to instead. Repeat this until there's no more prior action slots(then the party command window should be shown) or the prior one isn't reserved for unison skills/items.
Action Execution Changes
Both are easy and simple.
For the 1st change, when the unison invoker pays the unison skill/item costs, asks all other unison invokees to do so too. For instance(Upcoming version of DoubleX RMVXA Unison Item):
#----------------------------------------------------------------------------| # Alias method: use_item | #----------------------------------------------------------------------------| alias unison_item_use_item use_item def use_item(item) # Rewritten to pay unison skill cost unless item.is_a?(RPG::Skill) && item.unison_item return unison_item_use_item(item) end item.unison_actor_id.each { |a_id| $game_actors[a_id].pay_skill_cost(item) } item.effects.each { |effect| item_global_effect_apply(effect) } # end # use_item
Both are easy and simple.
For the 1st change, when the unison invoker pays the unison skill/item costs, asks all other unison invokees to do so too. For instance(Upcoming version of DoubleX RMVXA Unison Item):
#----------------------------------------------------------------------------| # Alias method: use_item | #----------------------------------------------------------------------------| alias unison_item_use_item use_item def use_item(item) # Rewritten to pay unison skill cost unless item.is_a?(RPG::Skill) && item.unison_item return unison_item_use_item(item) end item.unison_actor_id.each { |a_id| $game_actors[a_id].pay_skill_cost(item) } item.effects.each { |effect| item_global_effect_apply(effect) } # end # use_item
For the 2nd change, when the log window displays the use of an unison skill/item, shows all unison battlers' names instead of just the unison invokee's. For instance(Upcoming version of DoubleX RMVXA Unison Item):
#----------------------------------------------------------------------------| # Alias method: display_use_item | #----------------------------------------------------------------------------| alias unison_item_display_use_item display_use_item def display_use_item(subject, item) # Rewritten to display unison actors while using unison skills or items if DoubleX_RMVXA::Unison_Item::SHOW_UNISON_ACTOR && item.unison_item unison_actor_list = "" unison_actor_counter = 0 item.unison_actor_id.each { |actor_id| unison_actor_counter += 1 if unison_actor_counter > 1 && unison_actor_counter < item.unison_actor_id.size unison_actor_list += ", " elsif item.unison_actor_id.size > 1 && unison_actor_counter == item.unison_actor_id.size unison_actor_list += " and " end unison_actor_list += $game_actors[actor_id].name } if item.is_a?(RPG::Skill) add_text(unison_actor_list + item.message1) unless item.message2.empty? wait add_text(item.message2) end else add_text(sprintf(Vocab::UseItem, unison_actor_list, item.name)) end else unison_item_display_use_item(subject, item) end # end # display_use_item
Action Usability Changes
This one's a bit challenging, but if you've a solid understanding of how action usability checks in the default RMVXA battle system works, you should've little trouble implementing this change.
For instance(Upcoming version of DoubleX RMVXA Unison Item):
#----------------------------------------------------------------------------| # Alias method: usable? | #----------------------------------------------------------------------------| alias unison_item_usable? usable? def usable?(item) # Added to check if unison skills or items are usable if actor? && item && (item.is_a?(RPG::UsableItem)) && item.unison_item return false unless item.unison_actor_id.any? { |a_id| a_id == id } if item.is_a?(RPG::Skill) item.unison_actor_id.each { |actor_id| return false unless (actor = $game_actors[actor_id]).battle_member? return false unless actor.inputable? && actor.skill_exist?(item.id) return false unless actor.skill_conditions_met?(item) } return true elsif item.is_a?(RPG::Item) && item_conditions_met?(item) item.unison_actor_id.each { |actor_id| return false unless (actor = $game_actors[actor_id]).battle_member? return false unless actor.inputable? } return true else return false end end # unison_item_usable?(item) end # usable?
It shouldn't be usable if:
- It's not picked by an unison battler
- Not all unison actors are in the battle
- Not all unison battlers are inputable
If it's a skill, then it shouldn't be usable as well if:
- Not all unison battlers have that unison skill/item
- Not all unison battlers meet its requirements
Action Input Changes
This one's the main dish in this post, as it's quite tough, and much harder than the other changes. If you don't have a solid understanding of how the action input phase of the default RMVXA battle system works, you'd likely be doomed here lol
Anyway, you've to know the below 2 facts to have a reasonable chance to implement the changes:
1. There are 3 action slot types that are of our interests here - Ordinary action slots(having ordinary skills/items or not inputted anything not due to being reserved), unison action slots(having unison skills/items; unison invoker only) and reserved action slots(for unison skills/items; unison invokees only).
2. Recall that all action slots of all inputable actors are linked by a doubly linked list or an analogous data structure, and the item part of any action slot can't be cleared but only replaced by new ones in the action input phase. Combining with all the needed action usability and input changes, it can be deduced that the unison invoker's index is always smaller than every other unison invokee's one(thus the 1st inputable actor will never be an unison invokee).
The above 2 facts are fundamental to the below Dual Stack Algorithm and Dual Variable Algorithm. They've to be used together in order to work.
For the Dual Stack Algorithm:
1. Uses 2 new stacks to trace the action slots - 1 for ordinary/unison ones(input stack), and another for reserved ones(reserved stack). They should be initially empty arrays.
2. Right after inputting an ordinary skill/item, pushes its action slot into the input stack, and an empty list into the reserved one.
3. Right after inputting an unison skill/item, pushes its action slot into the input stack, and its associated unison battler id list into the reserved one.
4. Right before pointing to a previously inputted action slot, pops both the input and reserved stack once.
5. Both stacks should be cleared after ending the action input phase.
For the Dual Variable Algorithm:
1. Uses 2 variables to trace the number of inputted(existing @action_input_index) and reserved action slots(new @reserve_act) respectively for each actor. The latter should be 0 when new action slots are made.
2. Right after an actor inputs a skill/item, increases @action_input_index of that actor by 1(default behavior).
3. Right after allocating a reserved action slot for an actor(3. of the Dual Stack Algorithm), increases @reserve_act of that actor by 1.
4. Right before pointing to a previously inputted action slot(for any actor), decreases @action_input_index of the actor owning that inputted action slot by 1(default behavior) and @reserve_act of all actors included by the associated unison battler id list, if any, by 1(or does nothing if it's an empty array instead).
5. An actor shouldn't be inputable if @action_input_index + @reserve_act = the number of action slots(so the sum of the formers should never be greater than the latter).
The below explains why Dual Stack Algorithm and Dual Variable Algorithm will work when used together(you'll have to have a solid understanding of how the actor inputable check of the default RMVXA battle system works to understand these explanations):
1. All the reserved action slots of an actor are always that actor's last action slots, and the 1st inputable actor will never have any reserved action slots.
2. For the 1st needed change, each unison invokee reserves 1 action slot by increasing @reserve_act by 1. As the number of action slots stays the same in the same action input phase and the maximum value of @action_input_index, which is the number of action slots - @reserve_act, indicates the maximum number of inputtable action slots(default behavior), each unison invokee now has 1 less inputable action slot.
3. For the 2nd needed change, when a previously inputted unison action slot's pointed to, the reserved stack will pop the associating unison battler id list, and all actors included by that list will decrease @reserve_act by 1, effectively increasing the maximum value of @action_input_index by 1 and thus freeing their reserved action slots.
4. For the 3rd needed change, when a reserved action slot would be pointed to, it'd mean all the next action slots are reserved and @action_input_index + @reserve_act = the number of action slots, making the actor not inputable. As the "next pointer"(except the tail one) always points to inputable actor's action slots, it'll point to the 1st action slot of the next inputable actor instead.
5. For the 4th needed change, when a reserved action slot would be pointed to, both the input and reserved stack will be popped.
If @action_input_index of the would be selected actor is 0, it'll be untouched as that actor has no inputted action slots at all, meaning that actor's not inputable. As the "previous pointer"(except the head one) always points to inputable actor's action slots,the last action of the prior actor would be pointed to instead and this check will be repeated until an inputable actor's found.
Otherwise @action_input_index of the would be selected actor will be decreased by 1, making that actor inputable. The last inputable action slot of that actor will be pointed to(default behavior).
The below is an example(Upcoming version of DoubleX RMVXA Unison Item) using the core strategies behind the Dual Stack Algorithm:
class Scene_Battle < Scene_Base #----------------------------------------------------------------------------| # Alias method: next_command | #----------------------------------------------------------------------------| alias unison_item_next_command next_command def next_command # Added to add the actor id and unison actor id list to non_inputable_actor # and unison_actor stacks respectively if BattleManager.actor && @unison_skill add_input_actor_id(BattleManager.actor.id) if @unison_skill.unison_item add_unison_actor_id_list(@unison_skill.unison_actor_id) else add_unison_actor_id_list([]) end end # unison_item_next_command end # next_command #----------------------------------------------------------------------------| # Alias method: prior_command | #----------------------------------------------------------------------------| alias unison_item_prior_command prior_command def prior_command # Rewritten to clear the last element of non_inputable_actor and # unison_actor stacks clear_input_actor_id unison_item_prior_command clear_unison_actor_id_list # end # prior_command #----------------------------------------------------------------------------| # Alias method: command_attack | #----------------------------------------------------------------------------| alias unison_item_command_attack command_attack def command_attack # Added to store the item selected by the actor @unison_skill = $data_skills[BattleManager.actor.attack_skill_id] # unison_item_command_attack end # command_attack #----------------------------------------------------------------------------| # Alias method: command_guard | #----------------------------------------------------------------------------| alias unison_item_command_guard command_guard def command_guard # Added to store the item selected by the actor @unison_skill = $data_skills[BattleManager.actor.guard_skill_id] # unison_item_command_guard end # command_guard #----------------------------------------------------------------------------| # Alias method: on_skill_ok | #----------------------------------------------------------------------------| alias unison_item_on_skill_ok on_skill_ok def on_skill_ok # Added to store the item selected by the actor @unison_skill = @skill_window.item # unison_item_on_skill_ok end # on_skill_ok #----------------------------------------------------------------------------| # Alias method: on_item_ok | #----------------------------------------------------------------------------| alias unison_item_on_item_ok on_item_ok def on_item_ok # Added to store the item selected by the actor @unison_skill = @item_window.item # unison_item_on_item_ok end # on_item_ok #----------------------------------------------------------------------------| # Alias method: turn_start | #----------------------------------------------------------------------------| alias unison_item_turn_start turn_start def turn_start # Added to reset non_inputable_actor and unison_actor stacks reset_input_actor_id reset_unison_actor_id_list # unison_item_turn_start end # turn_start #----------------------------------------------------------------------------| # New method: add_input_actor_id | #----------------------------------------------------------------------------| def add_input_actor_id(actor_id) @input_actor_id ||= [] @input_actor_id << actor_id (actor = $game_actors[actor_id]).input_actor -= 1 actor.unison_next_input end # add_input_actor_id #----------------------------------------------------------------------------| # New method: clear_input_actor_id | #----------------------------------------------------------------------------| def clear_input_actor_id if @input_actor_id && @input_actor_id.size > 0 $game_actors[@input_actor_id[-1]].unison_input.clear $game_actors[@input_actor_id[-1]].unison_prior_input $game_actors[@input_actor_id[-1]].input_actor += 1 @input_actor_id.delete_at(@input_actor_id.size - 1) end end # clear_input_actor_id #----------------------------------------------------------------------------| # New method: reset_input_actor_id | #----------------------------------------------------------------------------| def reset_input_actor_id if @input_actor_id && @input_actor_id.size > 0 @input_actor_id.each { |actor_id| (actor = $game_actors[actor_id]).input_actor = actor.unison_action_times } end @input_actor_id = [] end # reset_input_actor_id #----------------------------------------------------------------------------| # New method: add_unison_actor_id_list | #----------------------------------------------------------------------------| def add_unison_actor_id_list(actor_id_list) unison_actor_id_list = [] actor_id_list.each { |actor_id| unison_actor_id_list << actor_id if actor_id != BattleManager.actor.id } @unison_actor_id_list ||= [] @unison_actor_id_list.push(unison_actor_id_list) if unison_actor_id_list.size > 0 unison_actor_id_list.each { |actor_id| $game_actors[actor_id].unison_actor -= 1 if $game_actors[actor_id] } end end # add_unison_actor_id_list #----------------------------------------------------------------------------| # New method: clear_unison_actor_id_list | #----------------------------------------------------------------------------| def clear_unison_actor_id_list if @unison_actor_id_list && @unison_actor_id_list.size > 0 if @unison_actor_id_list[-1].size > 0 @unison_actor_id_list[-1].each { |actor_id| $game_actors[actor_id].unison_actor += 1 if $game_actors[actor_id] } end @unison_actor_id_list.delete_at(@unison_actor_id_list.size - 1) end end # clear_unison_actor_id_list #----------------------------------------------------------------------------| # New method: reset_unison_actor_id_list | #----------------------------------------------------------------------------| def reset_unison_actor_id_list if @unison_actor_id_list && @unison_actor_id_list.size > 0 @unison_actor_id_list.each { |actor_id_list| next if actor_id_list.size <= 0 actor_id_list.each { |actor_id| next unless actor = $game_actors[actor_id] actor.unison_actor = actor.unison_action_times } } end @unison_actor_id_list = [] end # reset_unison_actor_id_listend # Scene_Battle
#----------------------------------------------------------------------------| # Alias method: inputable? | #----------------------------------------------------------------------------| alias unison_item_inputable? inputable? def inputable? # Rewritten to set inputable as considering actors using skills or items or # being used in unison skills or items also (!SceneManager.scene_is?(Scene_Battle) || @input_actor + @unison_actor > @actions.size) && unison_item_inputable? # end # inputable?
Code:
#----------------------------------------------------------------------------| # (v1.00d+)Alias method: make_actions | #----------------------------------------------------------------------------| alias unison_item_make_actions make_actions def make_actions unison_item_make_actions # Added to set unison_actor and non_inputable @input_actor = @unison_actor = @actions.size # end # make_actions
Code:
#----------------------------------------------------------------------------| # (v1.00d+)New method: unison_action_times | #----------------------------------------------------------------------------| def unison_action_times @actions ? @actions.size : 0 end # unison_action_times
Code:
#----------------------------------------------------------------------------| # (v1.00d+)Alias method: clear_actions | #----------------------------------------------------------------------------| alias unison_item_clear_actions clear_actions def clear_actions unison_item_clear_actions # Added to initialize @unison_input_index @unison_input_index = 0 # end # clear_actions
Code:
#----------------------------------------------------------------------------| # (v1.00d+)New method: unison_next_input | #----------------------------------------------------------------------------| def unison_next_input @unison_input_index += 1 if @unison_input_index < @actions.size - 1 end # unison_next_input #----------------------------------------------------------------------------| # (v1.00d+)New method: unison_prior_input | #----------------------------------------------------------------------------| def unison_prior_input @unison_input_index -= 1 if @unison_input_index > 0 end # unison_prior_input
That's all for now. I hope this topic can help you better grasp how unison skills/item scripts can be written. Again, later I might write how to write them for other battle systems(probably including Yanfly Engine Ace - Ace Battle Engine), and how to write enemy unison skills/items scripts when I can finally figure it out myself. For skilled unison skills/items script developers, feel free to point out any mistake I made
Last edited by a moderator:

