Battle Formation[Beta]

Battle Formation 1.0
By Lecode​

Introduction
This plugin adds the possibility to create battle formations with defined positions and bonuses.

(Beta)

I know that currently the plugin isn't fully compatible with Yanfly's ones.

I plan to make a patch.

Screenshot

lnTlbud.png


Files

Plugin

BattleFormations.json

Dependencies

MVCommons

LeUtilities

How to Use

There are a lot of parameters so make sure to check them.

And see the detailed help:

Spoiler
Setup​
  • Download the plugin and save it as LeBattleFormation.js
  • Place it via the plugin manager under MVCommons and LeUtilities
  • Get the file BattleFormations.json and place it in your project Data folder
  • Make sure to set the default formation via the parameters

Create a formation​
The file BattleFormations.json purpose is to hold all created formations. So, to create a new formation you'll need

to modify this file.

Let's analyse the file with just one formation:

[{ "name": "Equilibred", "unlock": "true", "hide": "false", "size": 5, "positions": [ [525,310], [565,350], [610,275], [635,310], [660,345] ], "bonus": [ ["def 10%"], ["def 10%"], ["atk 10%"], ["mat 10%"], ["mcr -20%"] ], "partyBonus": ["atk 6%","def 6%","mdf 6%"]}]The file starts with [ and ends with ]. The whole file is an array. Do not remove them.

Creating a new formation consists of adding some code inside this array.

That code follows a special pattern as you can see below.

{ "name": NAME OF THE FORMATION, "unlock": CONDITION TO UNLOCK BY DEFAULT, "hide": CONDITION TO HIDE BY DEFAULT, "size": MAX PARTY MEMBERS IN BATTLE FOR THAT FORMATION, "positions": [ [X1,Y1], [X2,Y1], ... [XN,YN] <= WITHOUT COMMA HERE (last element) ], "bonus": [ [BONUS_A1,BONUS_A2,BONUS_A3...], [BONUS_B1,BONUS_B2...], ... [BONUS_Z1,...] <= NO COMMA HERE (last element) ], "partyBonus": [BONUS_1,BONUS_2,BONUS_3...] <= NO COMMA HERE} <= NO COMMA IF IT'S THE LAST FORMATIONStrings for "unlock" and "hide" are evaluated and must return a boolean ( true or false ). You can set for example:

"unlock": "$gameParty.members().length >= 2",to enable that formation only if there are 2 or more actors in the party.

"positions" and "bonus" returns an array.

In the case of "positions", this array must contains the coordinate of each member as an array ( [x,y] ).

Make sure that the number of coordinates is equals to the "size" of that formation. Obviously.

Same for "bonus". This array is also composed with arrays, which the number is equals to "size" value.

See below to see how to configure the bonuses.

I suggest you to examine the pre-made formations in the file to understand better the syntaxe.

Setup Bonuses​
Each array inside the "bonus" array contains one or more strings. See this example:

"bonus": [ ["mhp 15%"], <= BONUS FOR THE FIRST MEMBER ( +15% MAX HP) ["atk 20%","mat 20%"], <= BONUSES FOR THE SECOND MEMBER ( +20% ATK and 20% MAT ) ["def -15"], <= ... ( -15 flat DEF ) ["mmp 80"] <= ... ( +80 flat MAX MP )],The string pattern is: "key value" or "key value%".

Keys are simply used stats in the Game_Battler class:

mhp:     Max HP

mmp:    Max MP

atk:       Attack

def:       Defense

mat:      Magic attack power

mdf:      Magic attack power

agi:       Agility

luk:       Luck

hit:        Hit rate

eva:      Evasion rate

cri:        Critical rate

cev:      Critical evasion rate

mev:     Magic evasion rate

mrf:       Magic reflection rate

cnt:       Counter attack rate

hrg:       HP regeneration rate

mrg:      MP regeneration rate

trg:       TP regeneration rate

tgr:       Target rate ( I don't know exactly what is the purpose of that stat...)

grd:      Guard effect rate

rec:       Recovery effect rate

pha:      Pharmacology ability

mcr:      MP cost rate

tcr:       TP charge rate

pdr:      Received physical damage rate

mdr:     Received magical damage rate

fdr:       Received floor damage rate

exr:       Experience rate
Same process for "partyBonus".

"partyBonus": ["atk 6%","def 6%","mdf 6%"]Finnaly, make sure to add a comma to the } thing if it's not the last formation.

[{ "name": "Harmony", "unlock": "true", "hide": "false", "size": 4, "positions": [ [560,320], [630,275], [655,310], [680,345] ], "bonus": [ ["mhp 15%"], ["pdr 15%"], ["mdr 15%"], ["rec 15%"] ], "partyBonus": ["eva 10%"]}, <== COMMA{ "name": "Mentor & Apprentice", "unlock": "$gameParty.members().length >= 2", "hide": "false", "size": 2, "positions": [ [525,310], [635,310] ], "bonus": [ ["mhp 10%","pdr 400%","mdr 20%"], ["exr 100%"] ], "partyBonus": ["exr 20%"]} <=== NO COMMA]

Credit and Thanks
- Lecode

Author's Notes
I plan to add some features in the future, or maybe anothers plugins to give more sense to this,

like an AOE Manager plugin.
Three questions:

1) Would there be any way to apply the default battle formation to the enemy party as well?

2) Would there be any way to split the party into two 'rows', and make the battlers in the back row immune (not invincible but unselectable) to certain skills?

3) Would there be any way to make the 'Formation' command compatible with Bobstah's Battle Commands plugin? I'd like to make it a command exclusive to battler #1, which is contained within the 'Fight/Escape' menu (which is bypassed in my game).
This is really cool
Thanks soo much or that one!

Will test it later extensively!
Fine!!! thank you!!! I was expecting a lot from!!!

A demo???
Good job man! Very interesting plugin!
Great plugin! Been waiting for this since you announced it!  BD  Keep up the good work!
Great Plugin ! It's possible to have symbol and main bind for Yanfly MenuManager?
Lecode finally....

finally you finish it.. *big hug*

sankyu

edit:

may you or some one make a demo? :3
This is very amazing! though, I am having a few issues..

Bug & feedback report :

1. Pressing Formation, and cancelling the action will freeze the selection menu.

2. Is not fully compatible with Yanfly's Battle Engine Core.

3. How do I enable the battle formation Info bonus text? (It is not visible when I tested it.)

4. Is there a way to change/review the default formation on a non-battle menu?
Cool but I would ask if there is a way to use it without MVCommons or LeUtilities since its rather alot of plugins to add to get one thing working.

Also that it 

 Is not fully compatible with Yanfly's Battle Engine Core.
which would be a rather big problem for lots of people.
1) Would there be any way to apply the default battle formation to the enemy party as well?
No. You'll need to do that manually.

2) Would there be any way to split the party into two 'rows', and make the battlers in the back row immune (not invincible but unselectable) to certain skills?
Currently, no. You can't give immunity as bonuses. But you can use mdr and pdr.

3) Would there be any way to make the 'Formation' command compatible with Bobstah's Battle Commands plugin? I'd like to make it a command exclusive to battler #1, which is contained within the 'Fight/Escape' menu (which is bypassed in my game).
Don't know. I'll try.

Great Plugin ! It's possible to have symbol and main bind for Yanfly MenuManager?
I don't know how this plugin works but I'll try.

may you or some one make a demo? :3
Why ? The JSON file contains all pre-made formations.

You just need to download that file + the plugin and open the formation menu or test a battle.

1. Pressing Formation, and cancelling the action will freeze the selection menu.

2. Is not fully compatible with Yanfly's Battle Engine Core
Seems like the first one is related to yanfly battle engine.

I'll make a patch.

3. How do I enable the battle formation Info bonus text? (It is not visible when I tested it.)
There isn't any bonus text window in battle, for now.
Thank you !
Would you make a row system based on this?
Probably, but certainly during the holidays, only. :/
This looks excellent Lecode!

One suggestion for a future update, would it be possible to add state IDs to the list of possible bonuses (specifically I'm trying to make Cover/Substitute a formation-specific mechanic).
My question was confuse, i wanted to know if you created a script line to call "Formation Menu" ^^ like This.commandFormation.bind(this)
Another bug, ask character to attack, then cancel, then change formation.

After changing formation, characters are supposed to skip a turn, but instead, the character that are asked to attack before will still launch their attacks.
Changed the status of the plugin to Beta, the time to make a patch for yanfly's plugins and at least add

more bonuses. (immunity, states, skills)
Hey, this is neat!  Would you consider adding in things like unlocking certain skills/skill menus depending on what position you're in?  Like, someone in slot 1 could use the Magic command, someone in slot 2 could use Skills, etc.?

Original thread: https://forums.rpgmakerweb.com/threads/battle-formation-beta.51136/