Jump to content
Reedo

RSSBSACE: Reedo's Simple Side Battle System Ace Edition

Recommended Posts

Weapon swing is strange. it should swing only one time, not three times. And it should be closer to character, beacuse at this moment it floats, and isn't hold by character.

Share this post


Link to post
Share on other sites

@Swish:

That's exactly how it is supposed to work. The weapon icons are no where near being scaled to the character so it would be unreasonable for the character to try to hold the weapon.

The effect is modeled after FF3 per a request on the main thread.

Share this post


Link to post
Share on other sites

Well, you could use script lane which would shrink icon a ittle. Anyway, other sideview scripts utilize icon swing as described by me and it looks better in my opinion. 

Share this post


Link to post
Share on other sites

I didn't say it couldn't be done; but shrinking the icons won't look good, and the user would have to specify where the attachment points where at for each weapon to fit the "hand" of each character - and ideally you'd need the arm in its own layer.  It all just becomes complex and deviates from the "Simple" part of the script.

 

Most likely the other side view scripts you refer to use separate assets for attack animations; while this looks best, it does require a lot more extra assets and configuration (again, deviating from simple).  And that's why multiple scripts exist... so you can choose the one that works best for your requirements.  :)

Share this post


Link to post
Share on other sites

Other scripts are really complex, and require understanding of ruby script. Yours is simple, and little more customisation to make it looks better would be great. And why not make option for player to change to one swing or to move icon closer to character? 

Share this post


Link to post
Share on other sites

Hrmm, this is actually a really nice Side View Battle System, and I like it a lot. But I had an idea, or more accurately a thought of a possible idea. Would it be possible to script enemy movements? Not so much moving towards the players, but like attacking animations. More like... I don't know... "life" to enemies, I guess.

 

Let's say you are fighting a "Bat" enemy. I'd like to see the bat flapping it's wings, or enemies on the ground moving as though they were breathing. It's just an idea, something to give the enemies more "life" as it were. Maybe once I am better at scripting I could do this myself, but I was wondering if it is even possible in the first place.

Share this post


Link to post
Share on other sites

Is there a way to make that the actor not show the icon when do magic or attack?

I like the simplisity and all of this script, but not the icon, did someone have the last version without the icons during attack?

Share this post


Link to post
Share on other sites

This script is AWESOME! I'm using MOG scripts and I tried sooooooo many side view battle systems and every single one was broken as balls (incompatible).

Your script works fine and it doesn't break my actor's positions like other scripts did (damage indicators etc. were all over the place or some functions from other script simply disappeared).

 

Can I ask / suggest something?

Would it be possible to change character sprite when he's dead? Nothing more, no fancy thingies, just to make him look dead, instead of disappearing or turning into a ghostie goo. For example I would do another file named Actor1_dead, where I would put just one sprite and all the script would do is to replace actor's sprite while he's dead.

If you could do that, I would be VERY happy! :D

Share this post


Link to post
Share on other sites
On 9/14/2013 at 12:54 AM, Reedo said:

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:
 

  Hide contents

 



###############################################################################
##  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.

it doesnt know what x is

Share this post


Link to post
Share on other sites
On 9/14/2013 at 12:54 AM, Reedo said:

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:
 

  Reveal hidden contents

 



###############################################################################
##  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.

ok this script is extremly buggy,my troops turn red,and the enemies are facing the other way

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.

×