Alright, I've figured out how to animate characters in system windows, but battlers...aye, they're a different lot. Here is the CBS I'm using, which you will recognize as ParaDog's front view battle system:
Under class Sprite_Battler near the bottom you'll see this: sx = @battler.pattern * cw
If I change it to look like this:
frame = (Graphics.frame_count / 8 ) % 4
sx = @battler.pattern * cw * frame
...I can get the battler to walk in place only while it is stepping forward to attack. However, I am at a loss trying to get the battler to walk in place while they're not acting. I tried to edit this:
cw = self.bitmap.width / 4 * frame
...but for some reason...well, how do I explain this...the battler constantly clones and unclones itself, so to speak (somehow when you edit the width it modifies the x value of a battler too? What the hell...;D).
So, the question is...how do I get the battlers to walk in place while they're inactive with Paradog's CBS? I know it might be a tad difficult to tackle, so I'd really appreciate the help. Thank you for your insight.
Code:
#==============================================================================
# ++ Side View Battle (Walking Graphic Edition) ver. 1.14 ++
#  Script by ParaDog
#  http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# Walking graphics are displayed as battlers on the battlefield.
#==============================================================================
module SDVA
X_LINE = 500 # Horizontal coordinates of actor battlers
Y_LINE = 200 # Vertical coordinates of actor battlers
X_SPACE = 15 # Horizontal spacing between actor battlers
Y_SPACE = 40 # Vertical spacing between actor battlers
# Formations:
X_POSITION = 25 # Extra horizontal spacing between frontrow/backrow battlers
Y_POSITION = 0 # Extra vertical spacing between frontrow/backrow battlers
ATTACK_MOVE = true # Move when attacking ( true / false )
SKILL_MOVE = true # Move when using skill ( true / false )
ITEM_MOVE = false # Move when using item ( true / false )
MOVE_STEP = 1 # Number of steps taken
MOVE_PIXEL = 10 # Number of pixels moved per step (see above)
PARTY_POS = 1 # Direction the characters are facing
# (0: Down / 1: To the left / 2: To the right / 3: Up )
WINDOWPOS_CHANGE = true # Command Window position changes according to the
# battler (appears under the battler) (true / false)
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get Battle Screen X-Coordinate
#--------------------------------------------------------------------------
def screen_x
if self.index != nil
# Acquiring the formation type
pos = $data_classes[self.class_id].position
x_pos = pos * SDVA::X_POSITION
scr_x = self.index * SDVA::X_SPACE + SDVA::X_LINE + x_pos
# If battler movement available
if self.current_action.move_action == true
# Move the battler
scr_x += @shift_x
end
return scr_x
else
return 0
end
end
#--------------------------------------------------------------------------
# * Get Battle Screen Y-Coordinate
#--------------------------------------------------------------------------
def screen_y
if self.index != nil
# Acquiring the formation type
pos = $data_classes[self.class_id].position
y_pos = pos * SDVA::Y_POSITION
scr_y = self.index * SDVA::Y_SPACE + SDVA::Y_LINE + y_pos
# If battler movement available
if self.current_action.move_action == true
# Move the battler
scr_y += @shift_y
end
return scr_y
else
return 0
end
end
#--------------------------------------------------------------------------
# * Get Battle Screen Z-Coordinate
#--------------------------------------------------------------------------
def screen_z
if self.index != nil
return self.index
else
return 0
end
end
end
#==============================================================================
# ** Game_Battler (part 1)
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :pattern # Pattern
attr_reader :trans_x # trans_X
attr_reader :moving # moving
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_sdva initialize
def initialize
initialize_sdva
move_reset
end
#--------------------------------------------------------------------------
# * Move
#--------------------------------------------------------------------------
def move
@moving = 1
if @step < SDVA::MOVE_STEP
# Move until steps completed
@pattern = (@pattern + 1) % 4
@step += 1
move_step
else
# End movement
@pattern = 1
@moving = 2
end
end
#--------------------------------------------------------------------------
# * Move Step
#--------------------------------------------------------------------------
def move_step
# Branch according to party direction
case SDVA::PARTY_POS
when 0
@shift_y = @step * SDVA::MOVE_PIXEL
when 1
@shift_x = -(@step * SDVA::MOVE_PIXEL)
when 2
@shift_x = @step * SDVA::MOVE_PIXEL
when 3
@shift_y = -(@step * SDVA::MOVE_PIXEL)
end
end
#--------------------------------------------------------------------------
# * Move Reset
#--------------------------------------------------------------------------
def move_reset
@moving = 0
@pattern = 0
@step = 0
@shift_x = 0
@shift_y = 0
end
end
#==============================================================================
# ** Game_BattleAction
#------------------------------------------------------------------------------
# This class handles actions in battle. It's used within the Game_Battler
# class.
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :move_action # move action
#--------------------------------------------------------------------------
# * Clear
#--------------------------------------------------------------------------
alias clear_sdva clear
def clear
clear_sdva
@move_action = false
end
end
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias update_sdva update
def update
# If actor which should be displayed
if @battler.is_a?(Game_Actor)
# If file name, hue or moving states are different than current ones
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue or
@battler.current_action.basic == 0 or
@battler.current_action.kind != 3
# Get and set bitmap
@character_name = @battler.character_name
@character_hue = @battler.character_hue
# Draw walking graphics
self.bitmap = RPG::Cache.character(@character_name, @character_hue)
cw = self.bitmap.width / 4
ch = self.bitmap.height / 4
@width = cw
@height = ch
if @battler.current_action.move_action == true
# Make it walk
@battler.move
else
@battler.move_reset
end
# Set rectangular transfer
sx = @battler.pattern * cw
sy = SDVA::PARTY_POS * ch
self.src_rect.set(sx, sy, cw, ch)
self.ox = @width / 2
self.oy = @height
# If hidden, set opacity to 0
if @battler.hidden
self.opacity = 0
end
end
end
update_sdva
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Actor Command Window Setup
#--------------------------------------------------------------------------
alias phase3_setup_command_window_sdva phase3_setup_command_window
def phase3_setup_command_window
phase3_setup_command_window_sdva
if SDVA::WINDOWPOS_CHANGE
# Branch and set position of the Actor Command Window
case SDVA::PARTY_POS
when 0
x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
y_pos = @active_battler.screen_y
when 1
x_pos = @active_battler.screen_x - @actor_command_window.width - 16
y_pos = @active_battler.screen_y - @actor_command_window.height
when 2
x_pos = @active_battler.screen_x + 16
y_pos = @active_battler.screen_y - @actor_command_window.height
when 3
x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
y_pos = @active_battler.screen_y - @actor_command_window.height - 48
end
@actor_command_window.x = x_pos >= 0 ? x_pos : 0
@actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width
@actor_command_window.y = y_pos >= 0 ? y_pos : 0
@actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height
# Ensure Actor Command Window is in front of BattleStatus window
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 3 : animation for action performer)
#--------------------------------------------------------------------------
alias update_phase4_step3_sdva update_phase4_step3
def update_phase4_step3
if SDVA::ATTACK_MOVE
if @active_battler.current_action.basic == 0
@active_battler.current_action.move_action = true
end
end
if SDVA::SKILL_MOVE
if @active_battler.current_action.kind == 1
@active_battler.current_action.move_action = true
end
end
if SDVA::ITEM_MOVE
if @active_battler.current_action.kind == 2
@active_battler.current_action.move_action = true
end
end
# If actor is in action
if @active_battler.is_a?(Game_Actor) and
@active_battler.current_action.move_action
# If the actor ends movement
if @active_battler.moving == 2
update_phase4_step3_sdva
end
elsif @active_battler.moving == 0
update_phase4_step3_sdva
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 6 : refresh)
#--------------------------------------------------------------------------
alias update_phase4_step6_sdva update_phase4_step6
def update_phase4_step6
@active_battler.current_action.move_action = false
@active_battler.move_reset
update_phase4_step6_sdva
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_sdva initialize
def initialize
initialize_sdva
@viewport2.z = 1
end
end
#==============================================================================
# ** Arrow_Actor
#------------------------------------------------------------------------------
# This arrow cursor is used to choose an actor. This class inherits from the
# Arrow_Base class.
#==============================================================================
class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias update_sdva update
def update
update_sdva
# If the down directional button was pressed
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.actors.size
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.actors.size
end
end
end
#==============================================================================
# ** Arrow_Enemy
#------------------------------------------------------------------------------
# This arrow cursor is used to choose enemies. This class inherits from the
# Arrow_Base class.
#==============================================================================
class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias update_sdva update
def update
update_sdva
# If the down directional button was pressed
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
end
end
Under class Sprite_Battler near the bottom you'll see this: sx = @battler.pattern * cw
If I change it to look like this:
frame = (Graphics.frame_count / 8 ) % 4
sx = @battler.pattern * cw * frame
...I can get the battler to walk in place only while it is stepping forward to attack. However, I am at a loss trying to get the battler to walk in place while they're not acting. I tried to edit this:
cw = self.bitmap.width / 4 * frame
...but for some reason...well, how do I explain this...the battler constantly clones and unclones itself, so to speak (somehow when you edit the width it modifies the x value of a battler too? What the hell...;D).
So, the question is...how do I get the battlers to walk in place while they're inactive with Paradog's CBS? I know it might be a tad difficult to tackle, so I'd really appreciate the help. Thank you for your insight.