Jump to content
Reedo

RSSBSACE: Reedo's Simple Side Battle System Ace Edition

Recommended Posts

Reedo's Simple Side Battle System Ace Edition (RSSBSACE)
Version 1.7b
September 30, 2013
By Reedo

 
References
None. This is an original script by Reedo.
 
Description

This script is a recreation of the original RSSBS created for VX back at the end of 2009.  The script has been completely reworked for ACE.

 

RSSBSACE offers a simple, plug-and-play, side-view-battle-system with no additional resource requirements.  This script is only a visual modification to the battle system and does not add any game-play mechanics.  RSSBSACE is designed for a high-degree of compatibility with other scripts.
 
Features
This simple SBS provides a classic "FF"-style side-battle experience.
 
This script will:

  • Draw the party on the right side of the screen, facing left, using the actor graphic specified in the database and in a formation fitting the Ace battle background layout.
  • Place a shadow on the ground beneath living actors.
  • Show the actor's stepping animation on their turn and when acting, if able to take actions.
  • Make the actor step toward the enemy when taking an action other than guarding.
  • Show animations for all actor actions as defined in the database for the particular action being performed.
  • Show animations for all enemy actions as defined in the database, or a default animation if none is defined (e.g. normal attack)
  • Flash the actor red when they successfully receive a hostile action.
  • Show dead actors as faded, whitened, and rotated to lay on their back.
  • Make living actors perform a "victory dance" when the battle ends (they jump and spin).
  • Optionally "mirror" enemy images to make them face to the right.

       Version 1.2

  • Make actors step back when guarding.
  • Make actors start facing backward and jump when surprised.
  • Make actors start facing down and flashing white on preemptive strike

      Version 1.6

  • Show weapon or skill icon as moving (swinging, punching, or pulsing) graphic during actions.
    (by popular demand!)
  • Now compatible with "battle test" from within the database.

     Version 1.7

  • Additional options for weapon motion by weapon type.
  • Ensures all animations play on RSSBSACE on-screen actors.         

 

As an additional feature, the script will force the game to attempt to load a tile-based battle background for any map type, not just maps using the field tile set.  Some of the floor tiles in the other tile sets will work to generate a battle background, so this allows you to use tile-based backgrounds in more of your maps.
 
Options
There are a few options at the top of the script which can be modified to change the positioning and movement of the actors, specify the mirrored enemies, and disable the forced tile-based battle backgrounds.  In most cases there will be no need to modify any of these options, other than the list of enemies to mirror.  This option looks like:

 FLIP_ENEMY = [
3, 4, 6, 7, 8, 10, 14, 16, 17,
18, 19, 21, 22, 24, 25, 27

]

And each number is simply the ID of the enemy to flip.  This is the number preceding the enemy name in the Enemies tab of the database.
 
Screen Shots
 

(battle begins)
post-34162-0-78708200-1379132684_thumb.jpg
 

(player attacks)
post-34162-0-28396700-1379132707_thumb.jpg
 

(player is hit)
post-34162-0-94524200-1379132722_thumb.jpg
 

(victory dance)
post-34162-0-43366200-1379132740_thumb.jpg
 
Known Bugs
None at this time.  Please report any found.
 
Requirements
None.  This is a stand-alone script.
 
Installation
Plug-and-Play
 
Just insert a new script directly under Materials, name it RSSBSACE, and paste in the script code.

 

For compatibility purposes it is typically best to insert RSSBSACE above all other scripts*.

* If using Yanfly YEA Battle Engine, this script must be installed below the Yanfly script.
 
Configuration
The only configuration necessary will be to arrange the troops such that the enemies are on the left-hand side of the screen.
 
Go into the Troops tab of the database, select each troop used in your game and drag the enemy images to arrange them to your liking on the left side of the screen.
 
All other configuration is optional via the "User Options" section at the top of the script.
 
Compatibility
Should be compatible with most other scripts.
 
Obviously any other script which also modifies the battle scene may not be compatible, but this should mostly relate to visuals such as the placement of animations.  Any battle-addon which affect mechanics and not visuals should be compatible.
 
The original RSSBS for VX was highly compatible with other scripts.  This version follows a similar design pattern so I expect it to also be highly compatible with other scripts.  
 
A Note About YanFly Scripts
I have not yet tried any of Miss YanFly's scripts for Ace, but I expect there may be some contention between our two scripts.  Although I suppose it is equally likely that her script will simply overwrite mine and everything will occur with her settings while my actors appear on screen.
 
We had a good deal of success between our scripts in the past so if this one turns out to have any issues I will do my best to set some time aside to correct my script and ensure as much compatibility with Miss YanFly's as possible.

 

Update

This script is now confirmed compatible with the Yanfly YEA Battle Engine.
 
Script
Here is the complete RSSBSACE script:
 

 

###############################################################################
##  RSSBSACE - Reedo's Simple Side Battle System (for VX ACE)
##  Version 1.7b
##  September 30, 2013
##  By Reedo
###############################################################################
##  REFERENCES
##
##  None.  This is an original script by Reedo.
###############################################################################
##  FEATURES
##
##  + Draw the party on the right side of the screen, facing left, using the actor graphic specified in the database and in a formation fitting the Ace battle background layout.
##  + Place a shadow on the ground beneath living actors.
##  + Show the actor's stepping animation on their turn and when acting if able to take actions.
##  + Make the actor step toward the enemy when taking an action other than guarding.
##  + Show animations for all actor actions as defined in the database for the particular action being performed.
##  + Show animations for all enemy actions as defined in the database, or a default animation if none is defined (e.g. normal attack)
##  + Flash the actor red when they successfully receive a hostile action.
##  + Show dead actors as faded, whitened, and rotated to lay on their back.
##  + Make living actors perform a "victory dance" when the battle ends (they jump and spin).
##  + Optionally "mirror" enemy images to make them face to the right.
##    = Version 1.2 =
##  + Actors step back when guarding.
##  + Actors start facing backward and jump when surprised.
##  + Actors start facing down and flashing white on preemptive strike.
##   = Version 1.4 =
##  + Actors turn and move half a step to the right when attempting to flee.
##    = Version 1.6 =
##  + Show weapon or skill icon as moving (swinging, punching or pulsing) graphic during actions.
##    (by popular demand!)
##  + Now compatible with "battle test" from within the database.
##    = Version 1.7 =
##  + Additional options for weapon icon movement by weapon type.
##  + Corrected animations to only play on RSSBS visual battlers.
##  + Corrected bug on escape (caught by Macatlas - thanks!).
##  + Corrected bug on no weapon equipped (caught by comprisedpuma).
##
###############################################################################
##  COMPATIBILITY
##
##  Should be compatible with most other scripts.
##
##  OVERWRITES (1)
##    Spriteset_Battle.update_actors
##
##  STATE CHANGES (1)
##    Map scroll position (display_x, display_y) is stored and set to 0,0 when
##    battle begins, and then is restored when battle ends.
###############################################################################
##  REQUIREMENTS
##
##  None for installation and operation.
##
##  However, enemy troops will need to be repositioned manually in the database
##  editor. This script may work best with all custom enemy images designed for
##  side-battle view.
###############################################################################
##  INSTALLATION
##
##  Plug-and-play.
##
##  Insert below Materials, above other add-on scripts.
###############################################################################
##  RIGHTS & RESTRICTIONS
##
##  As with most Reedo scripts, this script is free to re-use, as-is, 
##  in personal, educational, and commercial RPGVX Ace development projects, 
##  providing that:  this script is credited in writing displayed readily 
##  to the user of the final compiled code assembly.
##
##  Reedo retains all rights of intellect and ownership.
##  You forego all rights of warranty by utilizing this script.
###############################################################################

###############################################################################
##  USER OPTIONS
###############################################################################
module REEDO_SBS
  ACTOR_START_TOP = 6.2     # Top position (in tiles) for first actor in party
  ACTOR_START_LEFT = 12.5   # Left position (in tiles) for first actor in party
  ACTOR_STAGGER = false      # Enables staggered layout. Set false and chance start left to 12 for angled line.
  ACTOR_STAGGER_HORZ = 1.0  # The amount to recess each actor to the right (in tiles)
  ACTOR_STAGGER_VERT = 0.5  # The vertical spacing between characters (in tiles)
  ACTOR_STEPS_IN_OUT = 10   # The number of steps to take when moving to attack
  ACTOR_STEP_DISTANCE = 0.1 # The distance to move with each step (in tiles)
  
  ACTOR_DEATH_OPACITY = 125   # Transparency of dead actors
  ACTOR_DEATH_TONE = Tone.new(128, 128, 128, 0)  # Overlay color of dead actors
  ACTOR_DEATH_ANGLE = 270     # Rotation angle of dead actor sprite
  ACTOR_DEATH_OFFSET_X = -0.6 # Offset in tiles for dead actors
  ACTOR_DEATH_OFFSET_Y = -0.2 # Offset in tiles for dead actors
  
  VICTORY_DANCE_ENABLED = true      # Actors spin and jump on victory if alive and movable
  VICTORY_DANCE_JUMP_HEIGHT = 1.3   # The number of tiles an actor moves upward
  VICTORY_DANCE_JUMP_HOVER = 4      # The number of frames to wait in the air
  VICTORY_DANCE_JUMP_WAIT = 70      # The number of frames before jumping again
  
  ACTOR_SHADOW_IMAGE = "Shadow"       # The name of the system image to use
  ACTOR_SHADOW_CUSTOM_PICTURE = nil   # The name of a resource picture to use instead; nil to use system image
  
  PREEMPTIVE_TIME = 120   # The number of frames to flash white on preemptive strike
  SURPRISE_TIME = 90      # The number of frames to jump facing backward on surprise
  DAMAGE_RED_TIME = 15    # Number of frames actor turns red when damaged
 
  ATTACK_SKILL_ID = 1     # The Id in the database for the skill used as the default attack
  ENEMY_DEFAULT_ATTACK = 7    # AnimationId for enemy actions with no animation
  ACTION_SPRITE_INCREMENT = 5 # The amount of movement for swinging or pulsing action icons
  
  UNARMED_ICON = 175    # The icon to use if the actor has no weapon equipped.
  UNARMED_STYLE = 2     # The style to use when there is no weapon equipped.
  PUNCH_SPEED = 0.4
  PUNCH_DISTANCE = 32
  PULSE_WEAPON_TYPES = []         # Weapons with these weapon type ids will pulse like items or skills
  NO_MOVE_WEAPON_TYPES = []       # Weapons with these weapon type ids will show without moving
  PUNCH_WEAPON_TYPES = [2, 6, 10] # Weapons with these weapon type ids will move toward the enemy and back
                                  # All other weapon type ids will swing
  
  # Specify the ID of enemies who should have their image flipped in battle
  FLIP_ENEMY = [
                2, 3, 4, 5, 8, 10, 12, 13, 14, 16, 17, 
                18, 19, 21, 22, 23, 25, 28, 29,
                
               ]
  
  FORCE_AUTOTILE_BACKGROUND = true # attempt to use tile-based background on all maps

end
###############################################################################
##  MAIN SCRIPT
###############################################################################
##  EDITS BEYOND THIS POINT ARE AT YOUR OWN RISK!!!
###############################################################################
module BattleManager
  class << self
    alias reedo_sbs_bm_process_victory process_victory
    alias reedo_sbs_bm_process_escape process_escape
    alias reedo_sbs_bm_gain_exp gain_exp
  end
  
  def self.gain_exp
    if $imported && $imported["YEA-VictoryAftermath"] 
      tmp_gc = []
      $game_party.all_members.each do |actor|
        tmp_gc.push(actor.reedo_sbs_gc)
        actor.reedo_sbs_gc = nil if actor.reedo_sbs_gc
      end
      reedo_sbs_bm_gain_exp
      $game_party.all_members.each_with_index do |actor, i|
        actor.reedo_sbs_gc = tmp_gc[i] 
      end
    else
      reedo_sbs_bm_gain_exp
    end
  end
  
  def self.process_victory
    SceneManager.scene.reedo_victory_dance = true if REEDO_SBS::VICTORY_DANCE_ENABLED
    reedo_sbs_bm_process_victory
  end
  
  def self.process_escape
    SceneManager.scene.reedo_turn_and_run
    SceneManager.scene.reedo_cancel_run if !reedo_sbs_bm_process_escape
  end
  
  def self.reedo_preemptive?
    @preemptive
  end
  
  def self.reedo_surprise?
    @surprise
  end
  
  def self.reedo_get_actor_index
    return @actor_index
  end
end

class Game_Action
  def reedo_guard?
    return item == $data_skills[subject.guard_skill_id]
  end
end

class Game_Actor
  attr_accessor :reedo_sbs_gc
  attr_accessor :reedo_damage_time
  attr_accessor :reedo_is_acting
  
  alias reedo_sbs_ga_initialize initialize
  def initialize(actor_id)
    reedo_sbs_ga_initialize(actor_id)
    @reedo_damage_time = 0
    @reedo_is_acting = false
  end
  
  alias reedo_sbs_ga_perform_damage_effect perform_damage_effect
  def perform_damage_effect
    @reedo_damage_time = REEDO_SBS::DAMAGE_RED_TIME
    reedo_sbs_ga_perform_damage_effect
  end
end

class Game_Character
  attr_accessor :opacity
  attr_accessor :priority_type
  attr_accessor :reedo_start_top
  attr_accessor :reedo_jump_delta
  attr_accessor :reedo_shadow_sprite
  attr_accessor :reedo_is_dead
  attr_accessor :reedo_action_sprite
  attr_accessor :reedo_action_sprite_increment
  attr_accessor :reedo_action_style
  
  def reedo_step_on
    cmd = RPG::MoveCommand.new(Game_Character::ROUTE_STEP_ANIME_ON)
    process_move_command(cmd)
  end
  
  def reedo_step_off
    cmd = RPG::MoveCommand.new(Game_Character::ROUTE_STEP_ANIME_OFF)
    process_move_command(cmd)
  end
  
  def reedo_create_action_sprite(view)
    @reedo_action_style = 1
    @reedo_action_sprite_increment = REEDO_SBS::ACTION_SPRITE_INCREMENT
    @reedo_action_sprite = Sprite_Base.new(view)
    @reedo_action_sprite.bitmap = Bitmap.new(24, 24)
    @reedo_action_sprite.src_rect = Rect.new(0, 0, 24, 24)
    @reedo_action_sprite.ox = 24
    @reedo_action_sprite.oy = 24
    @reedo_action_sprite.x = (self.x * 32) - 28
    @reedo_action_sprite.y = (self.y * 32) + 18
    @reedo_action_sprite.z = (self.priority_type * 100) + 1
    @reedo_action_sprite.visible = false
  end
  
  def reedo_create_shadow_sprite(view)
    @reedo_shadow_sprite = Sprite_Base.new(view)
    bmp = Cache.picture(REEDO_SBS::ACTOR_SHADOW_CUSTOM_PICTURE) if REEDO_SBS::ACTOR_SHADOW_CUSTOM_PICTURE != nil
    bmp = Cache.system(REEDO_SBS::ACTOR_SHADOW_IMAGE) if bmp == nil
    @reedo_shadow_sprite.bitmap = bmp
    @reedo_shadow_sprite.src_rect = Rect.new(0, 0, bmp.width, bmp.height)
    @reedo_shadow_sprite.x = (self.x * 32) 
    @reedo_shadow_sprite.y = (self.y * 32) 
    @reedo_shadow_sprite.z = (self.priority_type * 100) - 1
  end
  
  alias reedo_sbs_gc_update update
  def update
    reedo_sbs_gc_update
    @shadow_sprite.update if @shadow_sprite != nil
  end
  
  def reedo_draw_icon(icon_index)
    @reedo_action_sprite.bitmap.clear
    @reedo_action_sprite.visible = (icon_index > 0)
    return if icon_index < 0
    bitmap = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    @reedo_action_sprite.bitmap.blt(0, 0, bitmap, rect, 255)
  end
end

class Spriteset_Battle
  alias reedo_sbs_ssb_initialize initialize
  def initialize
    @reedo_dance_wait = 0
    reedo_sbs_ssb_initialize
  end
  
  alias reedo_sbs_ssb_dispose dispose
  def dispose
    for actor in $game_party.battle_members
      actor.reedo_sbs_gc.reedo_action_sprite.dispose
      actor.reedo_sbs_gc.reedo_shadow_sprite.dispose
      actor.reedo_sbs_gc = nil
    end
    @reedo_sprite_chars.each {|sprite| sprite.dispose }
    reedo_sbs_ssb_dispose
  end
  
  alias reedo_sbs_ssb_create_actors create_actors
  def create_actors
    dispose_actors if @actor_sprites != nil
    reedo_sbs_ssb_create_actors

    @reedo_game_chars = []
    @reedo_sprite_chars = []
    @actor_sprites = []
    @reedo_surprise_time = 0
    @reedo_preemptive_time = 0
    
    i = 1
    for actor in $game_party.battle_members
      gc = Game_Character.new
      gc.set_graphic(actor.character_name, actor.character_index)
      if BattleManager.reedo_surprise?
        gc.set_direction(6)
        @reedo_surprise_time = REEDO_SBS::SURPRISE_TIME
      elsif BattleManager.reedo_preemptive?
        @reedo_preemptive_time = REEDO_SBS::PREEMPTIVE_TIME
        @reedo_preemptive_tone = 0
        @reedo_preemptive_delta = 10
        gc.set_direction(2)
      else
        gc.set_direction(4)
      end
      gc.priority_type = i
      bc = Sprite_Character.new(@viewport1, gc)
      sb = Sprite_Battler.new(@viewport1, actor)
      top = REEDO_SBS::ACTOR_START_TOP + (i * REEDO_SBS::ACTOR_STAGGER_VERT)
      left = REEDO_SBS::ACTOR_START_LEFT
      if REEDO_SBS::ACTOR_STAGGER
        left += REEDO_SBS::ACTOR_STAGGER_HORZ if i % 2 == 0
      else
        left += REEDO_SBS::ACTOR_STAGGER_HORZ * i
      end
      gc.reedo_is_dead = false
      gc.reedo_start_top = top
      gc.reedo_jump_delta = -0.1
      gc.moveto(left, top)
      gc.reedo_create_shadow_sprite(@viewport1)
      gc.reedo_create_action_sprite(@viewport1)
      bc.update
      @actor_sprites.push(sb)   
      @reedo_sprite_chars.push(bc)
      @reedo_game_chars.push(gc)
      actor.reedo_sbs_gc = gc
      i += 1
    end
  end
  
  alias reedo_sbs_ssb_create_enemies create_enemies
  def create_enemies
    reedo_sbs_ssb_create_enemies
    for sprite in @enemy_sprites
      sprite.mirror = true if REEDO_SBS::FLIP_ENEMY.include?(sprite.battler.enemy_id)
    end
  end
  
  alias reedo_sbs_ssb_create_blurry_background_bitmap create_blurry_background_bitmap
  def create_blurry_background_bitmap
    if REEDO_SBS::FORCE_AUTOTILE_BACKGROUND && !$BTEST
      tryName1 = battleback1_name
      return reedo_sbs_ssb_create_blurry_background_bitmap if tryName1 == nil
      wall = Cache.battleback1(tryName1)
      tryName2 = battleback2_name
      bitmap = Bitmap.new(640, 480)
      bitmap.blt(0, 0, wall, wall.rect)
      if tryName2 != nil
        floor = Cache.battleback2(tryName2)
        bitmap.blt(0, 320, floor, floor.rect)
      end
      bitmap
    else
      reedo_sbs_ssb_create_blurry_background_bitmap
    end
  end
  
  def reedo_update_victory_dance
    if @reedo_dance_wait == 0
      @actor_sprites.each_with_index do |sprite, i|
        if sprite.battler.alive? && sprite.battler.movable?
          gc = @reedo_game_chars[i]
          gc.moveto(gc.x, gc.y + gc.reedo_jump_delta)
          if gc.y < gc.reedo_start_top - REEDO_SBS::VICTORY_DANCE_JUMP_HEIGHT
            gc.reedo_jump_delta = 0.1
            @reedo_dance_wait = REEDO_SBS::VICTORY_DANCE_JUMP_HOVER
          end
          if gc.y > gc.reedo_start_top
            gc.reedo_jump_delta = -0.1
            gc.set_direction(4)
            @reedo_dance_wait = REEDO_SBS::VICTORY_DANCE_JUMP_WAIT
          end
          if ((gc.y - REEDO_SBS::VICTORY_DANCE_JUMP_HEIGHT) * 10).to_int % (REEDO_SBS::VICTORY_DANCE_JUMP_HEIGHT / 4 * 10).to_int == 0
            if @reedo_dance_wait == 0
              case gc.direction
                when 4; gc.set_direction(2)
                when 2; gc.set_direction(6)
                when 6; gc.set_direction(8)
                when 8; gc.set_direction(4)
              end
            end
          end
        end
      end
    else
      @reedo_dance_wait -= 1
    end
  end
  
  def reedo_update_surprise
    @actor_sprites.each_with_index do |sprite, i|
      if sprite.battler.alive? && sprite.battler.movable?
        gc = @reedo_game_chars[i]
        if @reedo_surprise_time > 1
          gc.moveto(gc.x, gc.y + gc.reedo_jump_delta)
          if gc.y < gc.reedo_start_top - REEDO_SBS::VICTORY_DANCE_JUMP_HEIGHT
            gc.reedo_jump_delta = 0.1
          end
          if gc.y > gc.reedo_start_top
            gc.reedo_jump_delta = -0.1
          end
        else
          gc.moveto(gc.x, gc.reedo_start_top)
          gc.set_direction(4)  
        end
      end
    end
    @reedo_surprise_time -= 1
  end
  
  def reedo_update_preemptive
    @actor_sprites.each_with_index do |sprite, i|
      if sprite.battler.alive? && sprite.battler.movable?
        sc = @reedo_sprite_chars[i]
        if @reedo_preemptive_time > 1
          sc.tone.set(@reedo_preemptive_tone,@reedo_preemptive_tone,@reedo_preemptive_tone)
          @reedo_preemptive_tone += @reedo_preemptive_delta
          @reedo_preemptive_delta *= -1 if @reedo_preemptive_tone >= 255
          @reedo_preemptive_delta *= -1 if @reedo_preemptive_tone <= 0
        else
          sc.tone.set(0,0,0)
          @reedo_game_chars[i].set_direction(4)
        end
      end
    end
    @reedo_preemptive_time -= 1
  end
  
  def update_actors
    dance = false
    run = false
    if SceneManager.scene.is_a?(Scene_Battle)
      run = SceneManager.scene.reedo_run_away
      dance = SceneManager.scene.reedo_victory_dance
      reedo_update_victory_dance if dance
    end
    reedo_update_surprise if @reedo_surprise_time > 0
    reedo_update_preemptive if @reedo_preemptive_time > 0

    @actor_sprites.each_with_index do |sprite, i|
      gc = @reedo_game_chars[i]
      sc = @reedo_sprite_chars[i]
      if sprite.battler.movable?  && (BattleManager.reedo_get_actor_index == i || sprite.battler.reedo_is_acting || dance || run)
        gc.reedo_step_on
      else
        gc.reedo_step_off
      end
      
      if gc.reedo_action_sprite.visible then
        if gc.reedo_action_style == 0 # swing
          gc.reedo_action_sprite.angle += gc.reedo_action_sprite_increment
          gc.reedo_action_sprite_increment *= -1 if (gc.reedo_action_sprite.angle > 90) || (gc.reedo_action_sprite.angle < 0)
        elsif gc.reedo_action_style == 1 # pulse
          gc.reedo_action_sprite.zoom_x += (gc.reedo_action_sprite_increment * 0.01)
          gc.reedo_action_sprite.zoom_y += (gc.reedo_action_sprite_increment * 0.01)
          gc.reedo_action_sprite_increment *= -1 if (gc.reedo_action_sprite.zoom_x > 2.0) || (gc.reedo_action_sprite.zoom_x < 1.0)
        elsif gc.reedo_action_style == 2 # punch
          gc.reedo_action_sprite.x += (gc.reedo_action_sprite_increment * REEDO_SBS::PUNCH_SPEED)
          gc.reedo_action_sprite_increment *= -1 if (gc.reedo_action_sprite.x < gc.reedo_shadow_sprite.x - REEDO_SBS::PUNCH_DISTANCE) || (gc.reedo_action_sprite.x > gc.reedo_shadow_sprite.x)
        end
        gc.reedo_action_sprite.update
      else
        gc.reedo_action_sprite.angle = 0
        gc.reedo_action_sprite.zoom_x = 1.0
        gc.reedo_action_sprite.zoom_y = 1.0
        gc.reedo_action_sprite.x = gc.reedo_shadow_sprite.x
      end
      
      if sprite.battler.dead?
        if gc.reedo_is_dead == false
          gc.moveto(gc.x + REEDO_SBS::ACTOR_DEATH_OFFSET_X, gc.y + REEDO_SBS::ACTOR_DEATH_OFFSET_Y)
          gc.reedo_shadow_sprite.visible = false
          gc.opacity = REEDO_SBS::ACTOR_DEATH_OPACITY
          sc.angle = REEDO_SBS::ACTOR_DEATH_ANGLE
          sc.tone.set(REEDO_SBS::ACTOR_DEATH_TONE)
          gc.reedo_is_dead = true
        end
      else
        if gc.reedo_is_dead == true
          gc.moveto(gc.x - REEDO_SBS::ACTOR_DEATH_OFFSET_X, gc.y - REEDO_SBS::ACTOR_DEATH_OFFSET_Y)
          gc.reedo_shadow_sprite.visible = true
          gc.opacity = 255
          sc.angle = 0
          sc.tone.set(0,0,0)
          gc.reedo_is_dead = false
        end
        if sprite.battler.reedo_damage_time > 0
          sc.tone.set(255,0,0) if sc.tone.red == 0
          sprite.battler.reedo_damage_time -= 1
        else
          sc.tone.set(0,0,0) if sc.tone.red == 255
        end
      end
      sc.update
      gc.update
      sprite.update
    end
  end
  
  def reedo_game_char(index)
    @reedo_game_chars[index]
  end
  
  def reedo_sprite_char(index)
    @reedo_sprite_chars[index]
  end
  
  def reedo_actor_sprites
    @actor_sprites
  end
end

class Scene_Battle
  attr_accessor :reedo_victory_dance
  attr_accessor :reedo_run_away
  attr_reader :subject
    
  alias reedo_sbs_sb_start start
  def start
    @reedo_victory_dance = false
    @reedo_run_away = false
    if !$BTEST
      @reedo_map_x = $game_map.display_x
      @reedo_map_y = $game_map.display_y
      $game_map.set_display_pos(0, 0)
    else
      $game_map = Game_Map.new
      $game_map.setup(1)
    end
    reedo_sbs_sb_start
  end
  
  alias reedo_sbs_sb_terminate terminate
  def terminate
    if !$BTEST
      $game_map.set_display_pos(@reedo_map_x, @reedo_map_y)
    end
    reedo_sbs_sb_terminate
  end
  
  alias reedo_sbs_sb_execute_action execute_action
  def execute_action
    if @subject.is_a?(Game_Actor)
      @subject.reedo_is_acting = true
      @spriteset.update_actors
      wait(15)
      if !@subject.current_action.reedo_guard?
        reedo_move_inout(-REEDO_SBS::ACTOR_STEP_DISTANCE)
        gc = @subject.reedo_sbs_gc
        iconidx = -1
        if @subject.current_action.item.is_a?(RPG::Skill)
          if @subject.current_action.item.id == REEDO_SBS::ATTACK_SKILL_ID
            iconidx = @subject.weapons[0].icon_index if @subject.weapons[0]
            iconidx = REEDO_SBS::UNARMED_ICON if iconidx < 0
            if iconidx == REEDO_SBS::UNARMED_ICON 
              gc.reedo_action_style = REEDO_SBS::UNARMED_STYLE
            elsif REEDO_SBS::NO_MOVE_WEAPON_TYPES.include?(@subject.weapons[0].wtype_id)
              gc.reedo_action_style = 3 #none
            elsif REEDO_SBS::PUNCH_WEAPON_TYPES.include?(@subject.weapons[0].wtype_id)
              gc.reedo_action_style = 2 #punch
            elsif REEDO_SBS::PULSE_WEAPON_TYPES.include?(@subject.weapons[0].wtype_id)
              gc.reedo_action_style = 1 #pulse
            else
              gc.reedo_action_style = 0 #swing
            end
          else
            iconidx = @subject.current_action.item.icon_index
            gc.reedo_action_style = 1 #pulse
          end
        elsif @subject.current_action.item.is_a?(RPG::Item)
          iconidx = @subject.current_action.item.icon_index
          gc.reedo_action_style = 1
        end
        gc.reedo_draw_icon(iconidx) 
      else
        reedo_move_inout(REEDO_SBS::ACTOR_STEP_DISTANCE / 2)
      end
    end
    reedo_sbs_sb_execute_action
    if @subject.is_a?(Game_Actor)
      if !@subject.current_action.reedo_guard?
        gc = @subject.reedo_sbs_gc
        gc.reedo_draw_icon(-1)
        reedo_move_inout(REEDO_SBS::ACTOR_STEP_DISTANCE)
      else
        reedo_move_inout(-(REEDO_SBS::ACTOR_STEP_DISTANCE / 2))
      end
      @subject.reedo_is_acting = false
    end
  end
  
  alias reedo_sbs_sb_show_animation show_animation
  def show_animation(targets, animation_id)
    oktargets = []
    targets.each do |sprite|
      if sprite.is_a?(Game_Actor)
        if animation_id == -1
          sprite.reedo_sbs_gc.animation_id = REEDO_SBS::ENEMY_DEFAULT_ATTACK
        else
          sprite.reedo_sbs_gc.animation_id = animation_id
        end
      else
        oktargets.push(sprite)
      end
    end
     reedo_sbs_sb_show_animation(oktargets, animation_id)
  end
  
  def reedo_move_inout(dist)
    i = 0
    while i < REEDO_SBS::ACTOR_STEPS_IN_OUT
      gc = @subject.reedo_sbs_gc
      gc.moveto(gc.x + dist, gc.y)
      gc.reedo_shadow_sprite.x = (gc.x * 32)
      update_for_wait
      i += 1
    end    
  end
  
  def reedo_turn_and_run
    @reedo_run_away = true
    @spriteset.update_actors
    wait(15)
    @spriteset.reedo_actor_sprites.each_with_index do |sprite, i|
      gc = @spriteset.reedo_game_char(i)
      gc.set_direction(6)
      gc.moveto(gc.x + 0.5, gc.y)
      gc.reedo_shadow_sprite.x = (gc.x * 32)
    end
  end
  
  def reedo_cancel_run
    @reedo_run_away = false
    @spriteset.reedo_actor_sprites.each_with_index do |sprite, i|
      gc = @spriteset.reedo_game_char(i)
      gc.set_direction(4)
      gc.moveto(gc.x - 0.5, gc.y)
      gc.reedo_shadow_sprite.x = (gc.x * 32)
    end
    return false
  end
end

 

 

 

Summary

With this script you can quickly and easily show your party on screen during battle with animations and effects and no special configuration beyond rearranging the enemy layout in your troops.

 

Comments and suggestions are welcome.

Edited by Reedo

Share this post


Link to post
Share on other sites

plug and play, eh?

got a scroll_type error. crashed immediately.

 

edit:

ah, nevermind. i was using battle test from the database, naturally there was no scroll_type detected.

it works as desired. nice little script.

Edited by Calintz

Share this post


Link to post
Share on other sites

I'm getting this error: 

3S0kwxg.png

 

That is the goofy forum trying to interpret !@subject as part of an email address.  I've edited the code in the post so you can copy it into your game again or just go to that line (and another one beneath it) and get rid of the "mailto:" that the forum inserted.

 

You'd think the forum would be smart enough to not attempt to resolve any smileys or URLs in a code block... but it might be because of that custom [ruby] tag... that implementation probably needs to be modified to remove the auto conversions.

Edited by Reedo

Share this post


Link to post
Share on other sites

Oh, haha, yup, all fixed now. And quite a nice little plug-and-play sideview battle script. This is definitely going to be a big help to those who find Victor Battle Engine cumbersome, Yami's Symphony Battle too difficult to modify, and Tankentai too... in Japanese. :D 

 

My only suggestions are:

1) It's tricky to tell which character is "active" visually. I've seen other scripts "light them up" by causing their battler to lighten or to have them take a step forward or something; something like either of those things would be preferable. 

2) I'm not really understanding the "tiles" organization for where the battlers are positioned; I think most of us are much more familiar with adjusting the X and Y.

3) The common arrangement for the battlers on the side is something like a diagonal line, but your arrangement has them in a straight line which is a lot less visually appealing, and I couldn't quite figure out how to adjust that to stagger them in a diagonal.

 

Those are just very nitpicky things; I really think you did a fantastic job on the script and it will definitely be of help to a lot of people I bet.

Share this post


Link to post
Share on other sites

Oh, haha, yup, all fixed now. And quite a nice little plug-and-play sideview battle script. This is definitely going to be a big help to those who find Victor Battle Engine cumbersome, Yami's Symphony Battle too difficult to modify, and Tankentai too... in Japanese. :D

 

My only suggestions are:

1) It's tricky to tell which character is "active" visually. I've seen other scripts "light them up" by causing their battler to lighten or to have them take a step forward or something; something like either of those things would be preferable. 

2) I'm not really understanding the "tiles" organization for where the battlers are positioned; I think most of us are much more familiar with adjusting the X and Y.

3) The common arrangement for the battlers on the side is something like a diagonal line, but your arrangement has them in a straight line which is a lot less visually appealing, and I couldn't quite figure out how to adjust that to stagger them in a diagonal.

 

Those are just very nitpicky things; I really think you did a fantastic job on the script and it will definitely be of help to a lot of people I bet.

 

Hi Bastian, thanks for this :)

 

I'm looking at the "active character" thing... perhaps making it so that the actor is only stepping when it is their turn (and they can take an action on the turn).  I'll probably try to work in a couple options and let the designer decide which to use.  This ties in with a comment made in the other forum so I'm definitely looking into it.

 

I try to use as much existing functionality as possible; in this case the script is reusing the map actors.  The existing methods for moving actors around the map take arguments in the form of number of tiles to move, not number of pixels to move.  Since I'm reusing the existing movement code, those methods are thinking in terms of "map tiles" (32x32 pixel squares, or the grid that appears on the map designer) even though the battle scene doesn't actually utilize a grid.  So while this could be changed to take pixel dimensions, I think it is acceptable to keep the grid coordinates.  It may actually be easier for a non-scripter to think of moving "1.0" as the distance of 1 tile on the map (versus thinking of pixels and display resolutions).

 

Due to the way that Ace generates its battle back images, there is only a very small  area of space where actor can be placed to still appear "on the ground" and not be covered by the battle menu windows.  To accommodate this, I had to squish all of the actors into a tight formation.  So while it would still be easy enough to rearrange them into an angled line, that angle would be long and shallow because the area they have to stand in is not very high.  The first actor would have to be moved to the left quite a bit to make enough room for everyone.  I didn't think it would look good.  :P  But, since this is a pretty subjective thing, I'll see about adding an option so that the designer can choose either formation.  To be honest I kinda skimped on the formation part compared to the old VX script... so maybe I should make it a little more feature-rich. 

 

Features are great so long as I can maintain the simplicity.  That's always been the top benefit of RSSBS.  :)

Share this post


Link to post
Share on other sites

I like the idea of them standing still but then doing the step animation on their turn, that would definitely help make it obvious whose turn it was.

I support this, still super simple yet super effective... (like a Pikachu attack on Squirtle)

Share this post


Link to post
Share on other sites

The script has been updated to version 1.5 which now has the actors stepping as discussed.  Initially the actors will be standing still.  During command selection, the current actor will step if they are able to move.  Also, an actor will step when they are executing their action or doing the victory dance.

 

This was a little more involved to work into the script than I initially suspected so it is a permanent feature; the old way is not available via an option.

Share this post


Link to post
Share on other sites

I've encountered a bug when testing battles from the game editor:

 

 

 

Script 'Game_Map' line 214: NoMethodError occured.

 

undefined method 'scroll_type' for nil:NilClass

 

 

(there are no other scripts installed)

 

For some reason, I've been having trouble with various scripts conflicting with Ace's default methods and programs. I may need to reinstall my program, I'm unsure. If this issue is on my end then, well, I definitely need to reinstall.

Share this post


Link to post
Share on other sites

@Macatlas.

there is nothing wrong with your application. i received the same error when testing from the database.

the scroll_type is data acquired from the map. since battle testing from the database does not load map data, this error is created.

 

perhaps reedo will add an exception at some point to rescue the script from an unitialized scroll_type.

Share this post


Link to post
Share on other sites

Does anyone know if this script is compatible with Riff's Parallaxed BattleBacks? I'm at work right now and don't have means to test it till tonight. If no one has time today to test it I'll test it tonight and edit this post with the answer. Because that would be awesome if they would work together! :)

Share this post


Link to post
Share on other sites

@Macatlas.

there is nothing wrong with your application. i received the same error when testing from the database.

the scroll_type is data acquired from the map. since battle testing from the database does not load map data, this error is created.

 

perhaps reedo will add an exception at some point to rescue the script from an unitialized scroll_type.

 

Well, that's not quite the issue... the script relies on a lot of existing functionality and a portion of it is located in the Game_Map.  The answer was to provide the battle test with an instance of a map, so the script will use map #1 in your game (it doesn't really matter which map - any map will do).

 

Its fixed now.

 

- Bah, can't seem to make two posts in a row... they get merged... anyway -

 

Ok folks, I've updated the script to add images of the character's weapon swinging when they attack, or a pulsing icon of the item or skill when they take those actions.

 

Obviously this isn't going to look right for projectile weapons yet, so that will still have to be taken into consideration.  But this should be a good start on the common request for action images.

 

Please let me know if you find any issues.

Edited by Reedo

Share this post


Link to post
Share on other sites

Does anyone know if this script is compatible with Riff's Parallaxed BattleBacks? I'm at work right now and don't have means to test it till tonight. If no one has time today to test it I'll test it tonight and edit this post with the answer. Because that would be awesome if they would work together! :)

 

Sorry but no.  Let me know what you find though :)

Share this post


Link to post
Share on other sites

The script has been updated to version 1.7.

 

This version adds additional options for weapon icon movement on screen, corrects a bug if an escape attempt failed, and corrects an issue with placement of animations providing compatibility with Yanfly's Ace Engine.

 

See the main thread for additional details.

Share this post


Link to post
Share on other sites

I am getting this error.

This has already been mentioned in the thread.  Its this dumb forum trying to interpret code as an email address.  I'll post again using the insert code button and forget trying to use the broken /ruby tag.

 

Or just go to the main Ace forum and get the code from there.

Share this post


Link to post
Share on other sites

This is awesome thank you so much. I've been trying to learn ruby just so I can understand these battle systems more, but I've been impatient because I wanted to add a side battle system NOW lol thanks to your easy but effective script I can learn ruby and have a good battle system in my game without waiting for my brain to figure out how it works thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×