Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.
You are using an out of date browser. It may not display this or other websites correctly. You should upgrade or use an alternative browser.
HBGames
Multi-View CBS Version: 1.0
Introduction
This CBS supports front and side view positions (possibly more if you work with the script), included with the CBS is my Animated Battlers script, and my Battle Formation System. This is still in a beta state, but almost all of the features I planned for the first version are done and the script is in a "presentable" state. This script is also SDK compliant. (was originally a Front View Battle System)
Copy all of the scripts from the demo above main but below the SDK, The Options can be configured in the script Master Options List The options are pretty self-explanatory since these lines are commented.
Code:
module Battler_Setup
#==============================================================================
# Graphical Settings
#==============================================================================
#set this to true for animated enemies (Do not set to false for now)
ANIMATED_ENEMIES = true
#default number of frames for each sprite
DEFAULT_FRAMES = 4
#Personalized number of frames
# {file => frames, file => frames, ...}
FRAMES = {
'guy_item' => 1, 'guy_defend' => 1, 'guy_damaged' => 1, 'guy_death' => 1,
'random_person_death' => 1, 'arshes_death' => 1, 'gloria_death' => 1
}
#default zoom level
DEFAULT_ZOOM_LEVEL = 2.0
#Individual zoom_level
# {file => frames, file => frames, ...}
ZOOM_LEVEL = {
'guy' => 1.0, 'ghost' => 1.0, 'troll' => 1.0, 'random_person_death' => 1.0,
'arshes_death' => 1.0, 'gloria_death' => 1.0
}
#Default Opacity
DEFAULT_OPACITY = 255
#Indiviual Battler Opacity
# {file => opacity, file => opacity, ...}
OPACITY = {'ghost' => 128}
#==============================================================================
# Movement Settings
#==============================================================================
#Movement Poses (for 8-directional movement/ 8 directional charactersets)
MOVEMENT_POSES = 4
#Moving actors/enemies
BATTLERS_MOVE = true
#==============================================================================
# System Settings (Positions Features Etc)
#==============================================================================
#Party command window enable
Party_Command_Window_Enable = false
#Battle Status Hidden?
Battle_Status_Hidden = true
#Battle Status Visible During Command Phase
Battle_Status_Command_Phase = false
#Battle Status Show Buttion (Input::BUTTON)
Battle_Status_Show = Input::SHIFT
#Battle Help Window Enable
Battle_Help_Enable = true
#Allow To Attack Backer Rows Before Rows in front are dealt with
#Attack_Rows_In_Back = false
end
#==============================================================================
# ** Game_BattleOptions
#------------------------------------------------------------------------------
# Controls all battle options that are able to be switched on and off at runtime
# and also is saved with save data
#==============================================================================
class Game_BattleOptions
attr_accessor :view_style
attr_accessor :command_window_x
attr_accessor :command_window_y
attr_accessor :moving_battlers
attr_accessor :move_into_battle
attr_accessor :move_into_formation
attr_accessor :actor_move_in_x_offset
attr_accessor :actor_move_in_y_offset
attr_accessor :enemy_move_in_x_offset
attr_accessor :enemy_move_in_y_offset
attr_accessor :move_out_battle
attr_accessor :actor_move_out_x_offset
attr_accessor :actor_move_out_y_offset
attr_accessor :enemy_move_out_x_offset
attr_accessor :enemy_move_out_y_offset
attr_accessor :move_out_escape
attr_accessor :actor_escape_x_offset
attr_accessor :actor_escape_y_offset
attr_accessor :enemy_escape_x_offset
attr_accessor :enemy_escape_y_offset
attr_accessor :formation_pose
attr_accessor :command_direction
attr_accessor :victory_direction
attr_accessor :other_direction
attr_accessor :battleback
attr_accessor :current_map
attr_accessor :show_events
attr_accessor :update_map
attr_accessor :map_id
def initialize
# The View Style Front or Side for now (for movement)
@view_style = 'front'
# The X Position of the Command Window (String)
@command_window_x = "0"
# The Y Position of the Command Window (String)
@command_window_y = "0"
# Moving Battlers
@moving_battlers = true
# Move into Battle
@move_into_battle = true
# In Scene_Formation Move into battle
@move_into_formation = true
# Actors Move into Battle X offset (Scene_Battle/Scene_Formation)
@actor_move_in_x_offset = "actor.screen_x"
# Actors Move into Battle Y offset (Scene_Battle/Scene_Formation)
# actor = Game_Battler object
@actor_move_in_y_offset = "actor.screen_y + 404"
# Enemies Move into Battle X offset (Scene_Battle)
@enemy_move_in_x_offset = "actor.screen_x"
# Enemies Move into Battle Y offset (Scene_Battle)
@enemy_move_in_y_offset = "actor.screen_y - 420"
# Move out of Battle when won (FF2 Style)
@move_out_battle = true
# Move out of Battle Position X
@actor_move_out_x_offset = "740"
# Move out of Battle Position Y (actor = Sprite_Battler)
@actor_move_out_y_offset = "actor.y"
# Move out of Battle Position X
@enemy_move_out_x_offset = "0"
# Move out of Battle Position Y (actor = Sprite_Battler)
@enemy_move_out_y_offset = "actor.y-420"
# Move out When Escaping
@move_out_escape = true
# Move out of Battle Position X
@actor_escape_x_offset = "actor.x"
# Move out of Battle Position Y (actor = Sprite_Battler)
@actor_escape_y_offset = "404 + actor.y"
# Move out of Battle Position X
@enemy_escape_x_offset = "0"
# Move out of Battle Position Y (actor = Sprite_Battler)
@enemy_escape_y_offset = "actor.y-420"
# Pose Used in Scene_Formation
@formation_pose = 'down'
# Command Pose Direction (Character sets)
@command_direction = 'down'
# Victory Pose Direction (Character sets)
@victory_direction = 'down'
# Other Poses Direction (Character sets)
@other_direction = {'Game_Actor' => 'up', 'Game_Enemy' => 'down'}
# Use Battle backs for battle background
@battleback = true
# Use The Current Map for battle background
@current_map = false
# If using Current Map show Events?
@show_events = false
# If using Map for battle back the map id used (0=disable)
@map_id = 0
# If using Map for battle back update map while battling
@update_map = false
end
end
Notes: Frames, Zoom level, and Opacity the format for their hashes are
{file => value, file => value, ...} (the ... means going on and on)
where file is the name of the battler to set a default for the whole sprite
or file_(pose) to the the value for that pose, yes this allows for multiple frames per battler, I'll talk about the different poses later (see template).
Battle Formations This is the probably the core of this script along with the animated battlers, since this sets the battlers position in battle I have came up with a few formations that I included in the demo, lets take a look at the data structure
#============================================================================
# Free Fight Formation
#----------------------------------------------------------------------------
# Description:
# Default Formation. Note: The First Formation must support 1 to the the maximum number
# of Actors in your party
#----------------------------------------------------------------------------
# Appearance:
#
# For One Actor Party
#
#
# 1
# For Two Actor Party
#
#
# 2 3
# For Three Actor Party
#
#
# 1 2 3
# For Four Actor Party
#
#
# 1 2 3 4
#============================================================================
Names << "Free Fight"
Number_Members << '1-4'
Front_Row << []
Middle_Row << []
Back_Row << [0,1,2,3]
Screen_X << "(4 - $game_party.actors.size) * 80 + index * 160 + 80"
Screen_Y << "452"
Effects << {}
Description << "The Default Formation"
Names
is a String and is the name of the formation
Number of Members
is a Special String (A Range String) which may be setup like so "n, a-b, ^n"' Entries are separated by commas (n, a, and b are Integers)
the first adds n to the range, the second adds a-b to the range, and the last deletes n from the range
"1-3" will result in numbers 1, 2 and 3
"4" will result in the number 4
"^7" will result in nothing (which will propably result in a bug later)
"1-5, 7" will result in the numbers 1,2,3,4,5, and 7
"4-7, ^6" will result in the numbers 4,5,7
"7, ^7" will result in nothing
"1-10, ^4, 16, 11-12" will result with 1,2,3,5,6,7,8,9,10,11,12, and 16
Number Members is the number of members allowable in the formation if the number of numbers is not included in the numbers formed a formation break occurs (The Formation is Broken and will go to the default formation) Note: The Default (First) Formation must support the 1 to the maximum number of people in the party or else you will receive an error
Front Row, Middle Row, and Back Row
These sets the row the actor is on, The classes Position variable was
replaced with this. Also influences who the enemy attacks. (use 0 for
the first member in the party 1 for the second and so on)
Screen_X and Screen_Y
This can either be a String (holds the formula) or a Hash (appoints the
positions by member index here are two pictures to help you with that
Here is a good example it places the four battlers in positions forming a square (Go on ahead scribble on the pictures to get a good look at this example)
Screen_X << {0 => 240, 1 => 320, 2 => 240, 3 => 320}
Screen_Y << {0 => 388, 1 => 388, 2 => 452, 3 => 452}
Effects
Here comes the fun part, you get to decide on stat bonuses and other effects of using this formation. It is a Special String (Increaser String) setup like so {<index, all, or row type>, <effects>}
where index is an index of a party member, all is for every party member
and row type is either front, middle, or back for their respective rows
effects is a string setup like so "<stat>:<*/-+><int><*/-+><int>..., ..."
<stat> is one of the stats (maxhp, maxsp, str, dex, agi, int, pdef, mdef, eva, atk) or damage for now, obviously <*/-+> is an operator and <int> and an integer
so {0 => "atk:*3+40,maxhp:+50,maxsp:+40", 'front' => 'damage:*2', 'back' => 'damage:/2'} will..
Raise Party members 1's 3 times and adds 40, Raises Maximum Hp by 50, and Maximum Sp by 40
Anyone in Front Row Damage is increased by twice as much
Anyone in Back Row Damage is reduced by Half
But really if you don't get any of these then check the demo for examples
Using Formations By Default Every Formation is Disabled and will not appear in Scene_Formation (I did this to prevent formations that give uber bonuses to be gained later in the game), To enable a formation do this
and it will appear in the Formation list in Scene_Formation, provided if the correct number of party members are in the party.
Templates
There are two templates for this CBS but only one of them is required (movement template for enemies) (you'll get better results if you use both), The First Template is the movement template, just look at any characterset for the template (Down Facing, Left Facing, Right Facing, Up Facing).
You may remove down and up facing (leaving a blank space for the poses) if you plan to use this as a side-view battle system, if you edit the options correctly you can allow for eight movement poses (or you can wait for an update), If the movement template is not found (for actors loads their characterset, for enemies you will recieve an error) the movement template file must be named (battler_name) + _movement (ex. name_movement)
where battler_name is in lowercase and all spaces replaced with underscores "_"
The second template is the one with all of the poses shown here
Now the black sections on the picture tells how many frames are in that pose, there isn't a death pose if this file is not found (there is an exception, though) and when this battler dies the collapse effect will be shown, this file must be named (battler_name) + _default
Exceptions If you name a file (battler_name) + one of the pose names (see template) then that file will be loaded and the one from the template (if found) will be removed, this is similiar to how ccoa's CBS loads battlers
Conversions You can use the other templates in this battle system (Minkoff's and Cybersams (You just have rename the battlers used from ccoa's), and you may configure a custom template (not completed)), but they must be named specially. For Minkoff its (battler_name) + _default + _m, for Cybersam its (battler_name) + _default + _c, and for custom templates (Supports 3 Custom Templates) its (battler_name) + _default + _c(1 2 or 3). This Also loads the movement poses from the templates (loading from cybersam's requires flipping the move to enemy pose).
Last Feature
If the Upper Left Pixel on a Pose is Black (0,0,0) then it will load the default for that pose (see Second Template Not Found), you shouldn't use black as a transparent color. since the script will get confused and load the default when you didn't want it to. (If anything I've added a debug method called test, call it in a call script to see each pose for the battler), here it is just add it in a new script above main and do test(<Game_Battler>) where <Game_Battler> is a Game_Battler object ($game_party.actors[0], $game_actors[4])
Code:
def test(battler)
array = ['down','left','right','up','command','ready','attack','skill','defend','item',
'damaged','status','death','victory']
sprite = Sprite.new
poses = RPG::Poses.new(battler)
for i in 0...14
sprite.bitmap = poses[array[i]].bitmap
p array[i]
end
end
FAQ
Ctrl+Shift+F is your Friend
Code:
# The View Style Front or Side for now (for movement)
@view_style = 'side'
Code:
# Command Pose Direction (Character sets)
@command_direction = 'left'
# Victory Pose Direction (Character sets)
@victory_direction = 'left'
# Other Poses Direction (Character sets)
@other_direction = {'Game_Actor' => 'left', 'Game_Enemy' => 'right'}
Code:
#============================================================================
# Free Fight Formation
#----------------------------------------------------------------------------
# Description:
# Default Formation. The Same as the position setup if formations are disabled
#----------------------------------------------------------------------------
# Appearance:
#
# For One Actor Party
#
#
#
# 1
#
#
#
# For Two Actor Party
#
#
# 1
#
# 2
#
#
# For Three Actor Party
#
# 1
#
# 2
#
# 3
#
# For Four Actor Party
# 1
#
# 2
#
# 3
#
# 4
#============================================================================
Names << "Free Fight"
Number_Members << '1-4'
Front_Row << []
Middle_Row << []
Back_Row << [0,1,2,3]
Screen_X << "576"
Screen_Y << "(4 - $game_party.actors.size) * 60 + index * 120 + 120"
Effects << {}
Description << "The Default Formation"
#============================================================================
# Diamond Dust Formation
#----------------------------------------------------------------------------
# Description:
# A Formation shaped like a diamond requires a four actor party
# All Actors Defense is increased by 1.5x when in this formation
#----------------------------------------------------------------------------
# Appearance:
#
# 2
#
# 1 4
#
# 3
#
#============================================================================
Names << "Diamond Dust"
Number_Members << '4'
Front_Row << [0]
Middle_Row << [1,2]
Back_Row << [3]
Screen_X << {0 => 448, 1 => 512, 2 => 512, 3 => 576}
Screen_Y << {0 => 320, 1 => 240, 2 => 400, 3 => 320}
Effects << {'all' => 'pdef:*2'}
Description << "All Members Physical Defense is 200% when in this formation"
#============================================================================
# Power Triangle Formation
#----------------------------------------------------------------------------
# Description:
# A Formation shaped like a triangle requires a three or four actor party
#----------------------------------------------------------------------------
# Appearance:
#
# 2
#
# 1 4
#
# 3
#
#============================================================================
Names << "Power Triangle"
Number_Members << '3-4'
Front_Row << [0]
Middle_Row << []
Back_Row << [1,3,2]
Screen_X << {0 => 512, 1 => 576, 2 => 576, 3 => 576}
Screen_Y << {0 => 320, 1 => 160, 2 => 480, 3 => 320}
Effects << {0 => 'atk:*3'}
Description << "Front Rows Attack is Greatly increased"
#============================================================================
# Magic Square Formation
#----------------------------------------------------------------------------
# Description:
# A Formation shaped like a square requires a four actor party
#----------------------------------------------------------------------------
# Appearance:
#
#
# 1 3
#
# 2 4
#
#
#============================================================================
Names << "Magic Square"
Number_Members << '4'
Front_Row << [0,1]
Middle_Row << []
Back_Row << [2,3]
Screen_X << {0 => 512, 1 => 512, 2 => 576, 3 => 576}
Screen_Y << {0 => 280, 1 => 360, 2 => 280, 3 => 360}
Effects << {'all' => 'int:+50'}
Description << "All Members Intellience is increased"
Compatibility
Incompatible with RTAB, but you already knew that (would defeat the purpose if it was, since I'm creating my own)
I wouldn't try this with any of my other scripts just yet as this system is still in beta form
Raziel, Zuzzu, Chaosg1, and others for betatesting
RPG for his animated sprites class (which I modified alot)
People @ rmxpu.net for being my "guinea pigs"
J-Street for saying that I can't explain anything to "normal" people :P
kayin33 for requesting the base script for the Animated Battlers (changing the Battler Graphic to the Character set graphic)
Rmdude333 for requesting a front view battle system
MaxXx for requesting no Battlebacks (included as an option)
Romancing Saga 3 for the formation scene style (almost a complete copy), and parts of the battle scene_style (the default options)
Author's Notes
Do not post this on another forum without my permission (since I do tend update very frequently)
If you are planning on editing this script (for someone) try to alias my code and send me the code (to prevent incompatibility issues when I update this script).
Some of the code is commented, the harder methods I wrote (movement routines) should be commented
When posting bugs and errors, please be detailed, provide a screenshot of the bug, tell me the error type, and the line (in the script editor) where the bug occurs or the whole method the error appears on, since 99% of the time my version of the script is different from yours and telling that <so-and-so> error appears on line <#> of the script <name> doesn't really tell me much.
My To-Do List
Change Battlers move routine (DONE!)
Battle Formations (PARTIALLY DONE)
positions of the characters on the field (DONE)
formation effects ex. attack *2 to front row, all regen, half damage, speed up, move first, player in position X gets hit more, weapon power up, etc (PARTIALLY DONE)
change targeting (you can only attack people in the backer rows if all people in rows that are more to the front are disposed of)
Advanced Moving
Define the movement for an attack or skill and enemy movement instead of just standing there or move to the enemy
Sprite Setup (DONE!)
Setup the number of frames and other stuff for each sprite (DONE)
Poses
Attacking poses
Attack with weapon
Basic Attack (DONE)
Skill poses
Attack with skill id N
Basic Skill using (DONE)
Defending poses (DONE)
Defending pose (DONE)
Attack Defended pose (DONE)
Use Item Pose (DONE)
Ready Pose (DONE!)
Victory Pose (DONE)
Hp NN% Pose
State NN Pose
Level Up Pose
Commands
Change Equipment and Party Switch in Battle
Change Formation in battle?
Battle Commands
Windows
Status Window
Skill/Item Window
Help Window
Improved Gradient Bars
Battle System Type
CTB-style
ATB-style
RTAB-style
while maintaining Compatibility with many other scripts