This script will extend the default battle system.
The default system does not have any concept of "battle positions". For example, if there are 4 monsters on the screen, that's it: there are 4 monsters on the screen.
It makes no difference whether they're lined up horizontally, or lined up vertically, or they're scattered all over the field.
The grid based system is meant to add an imaginary grid to the battle so that you can actually say Slime B is behind Slime A.
Some things that should be provided by the script
1. the ability to define the dimensions of the grid. Width and height; pretty standard.
2. the ability to define restrictions on where actors/enemies can be placed.
3: a uniform way to access a battler's position. Try to keep this as encapsulated as possible since everything else will depend on these methods.
4: battle positions should be made obvious based on where the battler sprite is positioned. If one slime is behind another slime (or, in 2D, on top of another slime), that fact should be reflected in the position values (you can use x,y coords or index from 1 to n).
Visuals of the grid itself is not important. You don't need to know that you're on a specific square, but you should do some calculations on each troop's screen x and y to calculate their positions.
By providing such a positioning system, the following scripts can be easily written as extensions:
-"rows". In final fantasy for example, you had the option of being in the "back row" or the "front row". It is obvious that you need a way to specify "position" in order to actually say that someone is in the front or back.
-position-based targeting. You have a skill that hits every monster in a straight line. You have another skill that hits every monster within a certain radius from the target. You want to be able to target empty positions on the field in order to hit more monsters. Not possible without having such a grid.
-moving around the battle field. In some games, battlers don't just stay in one position. You can choose to move to another position on the field. Why should your actors stay on one side of the field and enemies on the other side? Why not have all battlers move wherever they wish?
-ranged attacks. If you're not beside the battler, you can't hit him with a knife unless you're throwing it. If the enemy is too close to you, how do you expect someone to shoot an arrow? Doesn't make sense. Positions provide a way to determine whether you're close (or far) enough to execute an action.
-3D positioning. Rather than just a 2D grid where you go from top to bottom, left to right, you add some depth to it. That means you can have slimes BEHIND a slime, or bats ABOVE a slime.
Keep these in mind as you're writing the script, since the script is pretty much absolutely useless on its own so if it is not flexible enough it won't do much good.
The targeting system does not need to be changed. The only thing that needs to be done is to write extra logic to actually give battlers some positions.
This post has been edited by Tsukihime: Jun 15 2012, 06:56 PM