Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

HBGames

Introduction[/FONT]
Hello Everyone, I just made this script because I WAS BORED, it's a simple Bestiary Script.Hope you like.

Script[/FONT]
http://img144.imageshack.us/img144/8670/screencn9.th.png[/IMG]
Code:
#==============================================================================
# ** Scene_bestiary
#------------------------------------------------------------------------------
#  Version: 1.2 Fixed Some Bugs, Code Cleaning, Improved general methods.
#  Author:  Chaosg1
#------------------------------------------------------------------------------
#  Show all the monster in the databse That you have seen.
#==============================================================================
class Scene_Bestiary 
  Opacity = 160
  Chose_Text = "Please chose a Monster from the list below."
  Not_Seen   =  "You haven't seen/battled this Monster."
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @enemies = []
    @wait = 0
    #Checks all enemies
    for i in 0...$data_enemies.size
      if $game_system.seen[i] == true
        @enemies[i] = i.to_s + ' - ' + $data_enemies[i].name
      elsif $game_system.seen[i] == nil 
        @enemies[i] = i.to_s + ' - ???????'
      end
    end
     @enemies.delete_at(0)
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    @spriteset = Spriteset_Map.new
    draw_windows
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    dispose_windows
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    #Updates the Spriteset
    @spriteset.update
    return @wait -= 1 if @wait != 0
    @enemy_window.active = true if @status_window != nil and @status_window.disposed?
    #Checks Wich Windows is active
    if @enemy_window.active
      @index = @enemy_window.index
      @enemy_window.update
      #Sets Help Text
      @help_window.set_text(Chose_Text, 1)
      #Check The player input
      if Input.trigger?(Input::C)
        validate
      elsif Input.trigger?(Input::B)
        $scene = Scene_Map.new
      end
    else
      if Input.trigger?(Input::B)
        @battler_window.dispose
        @points_window.dispose
        @status_window.dispose
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Validates
  #--------------------------------------------------------------------------
  def validate
    if $game_system.seen[@index+1] == nil
      @enemy_window.active = false
      $game_system.se_play($data_system.buzzer_se)
      @help_window.set_text(Not_Seen,1)
      return @wait = 40
    end
    $game_system.se_play($data_system.decision_se)
    @enemy_window.active = false
    @battler_window = Window_Base.new(160,64,200,200)
    @battler_window.opacity = Opacity
    @battler_window.contents = Bitmap.new(200-32,200-32)
    actor = $data_enemies[@index + 1]
    bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
    cw = 200 - 32 
    ch = 200 - 32
    x = 0
    x = (100-16 - bitmap.width/2) if not bitmap.width > 200-32  
    @battler_window.contents.fit_blt(x, 0, cw, ch, bitmap, 255)
    #Draw Status
    @status_window = Window_Base.new(360,64,280,200)
    @status_window.opacity = Opacity
    @status_window.contents = Bitmap.new(280-32,200-32)
    @status_window.contents.draw_text(0,0,200,32,"Monster Name:",0)
    @status_window.contents.draw_text(150+4,0,100,32,$data_enemies[@index + 1].name,0)
    @status_window.contents.draw_text(0,36,150,32,"Monster Hp:",0)
    @status_window.contents.draw_text(150+4,36,100,32,$data_enemies[@index + 1].maxhp.to_s,0)
    @status_window.contents.draw_text(0,72,150,32,"Monster Sp:",0)
    @status_window.contents.draw_text(150+4,72,100,32,$data_enemies[@index + 1].maxsp.to_s,0)
    @status_window.contents.draw_text(0,108,150,32,"Monster Exp:",0)
    @status_window.contents.draw_text(150+4,108,100,32,$data_enemies[@index + 1].exp.to_s,0)
    @status_window.contents.draw_text(0,140,150,32,"Monster " + $data_system.words.gold + ":",0)
    @status_window.contents.draw_text(150+4,140,100,32,$data_enemies[@index + 1].exp.to_s,0)
    @points_window = Window_Base.new(160,264,480,216 )
    @points_window.opacity = Opacity
    @points_window.contents = Bitmap.new(480-32,212-32 )
    @points_window.contents.draw_text(0,-10,200,32,"Status:",0)
    #Easy Coordinate modification LOL
    y = 0
    y2 = 32
    @points_window.contents.draw_text(50,y2 + y,120,32,"Monster " + $data_system.words.str + ":",0)
    @points_window.contents.draw_text(50+120+4,y2 + y,100,32,$data_enemies[@index + 1].str.to_s,0)
    @points_window.contents.draw_text(50,2*y2 + y,120,32,"Monster " + $data_system.words.pdef + ":",0)
    @points_window.contents.draw_text(50+120+4,2*y2 + y,100,32,$data_enemies[@index + 1].pdef.to_s,0)
    @points_window.contents.draw_text(50,3*y2 + y,120,32,"Monster " + $data_system.words.mdef + ":",0)
    @points_window.contents.draw_text(50+120+4,3*y2+ y,100,32,$data_enemies[@index + 1].mdef.to_s,0)
    @points_window.contents.draw_text(50,4*y2+ y,120,32,"Monster " + $data_system.words.int + ":",0)
    @points_window.contents.draw_text(50+120+4,4*y2+ y,100,32,$data_enemies[@index + 1].int.to_s,0)
    @points_window.contents.draw_text(234,y2+ y,120,32,"Monster " + $data_system.words.int + ":",0)
    @points_window.contents.draw_text(354 ,y2+ y,100,32,$data_enemies[@index + 1].int.to_s,0)
    @points_window.contents.draw_text(234,2*y2 +y,120,32,"Monster " + $data_system.words.dex + ":",0)
    @points_window.contents.draw_text(354,2*y2+ y,100,32,$data_enemies[@index + 1].dex.to_s,0)
    @points_window.contents.draw_text(234,3*y2+ y,120,32,"Monster " + $data_system.words.atk + ":",0)
    @points_window.contents.draw_text(354,3*y2+ y,100,32,$data_enemies[@index + 1].atk.to_s,0)
    @points_window.contents.draw_text(234,4*y2+ y,120,32,"Monster EVA:" ,0)
    @points_window.contents.draw_text(354,4*y2+ y,100,32,$data_enemies[@index + 1].eva.to_s,0)
  end
  #--------------------------------------------------------------------------
  # * Main Draw
  #--------------------------------------------------------------------------
  def draw_windows
    #Make Enemy Window
    @enemy_window = Window_Command.new(160,@enemies)
    @enemy_window.x = 0
    @enemy_window.y = 64
    @enemy_window.height = 480-64
    @enemy_window.opacity = Opacity
    #Make Help_Window
    @help_window = Window_Help.new
    @help_window.opacity = Opacity
  end
  #--------------------------------------------------------------------------
  # * Main Dispose
  #--------------------------------------------------------------------------
  def dispose_windows
    #Make Enemy Window
    @enemy_window.dispose
    @help_window.dispose
  end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================
class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :seen
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias cg1_bestiary_initialize initialize
  def initialize
    cg1_bestiary_initialize
    @seen = {}
  end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  This class handles enemies. It's used within the Game_Troop class
#  ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
  alias cg1_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     troop_id     : troop ID
  #     member_index : troop member index
  #--------------------------------------------------------------------------
  def initialize(troop_id, member_index)
    cg1_initialize(troop_id, member_index)
    $game_system.seen[@enemy_id] = true 
  end
end
class Bitmap
  #-------------------------------------------------------------------------
  # * Name:      Fit BLT
  #   Info:      Zooms to Width and Height, if needed
  #   Author:    Trickster
  #   Call Info: Five or Six Arguments, Integer X and Y Define Position
  #              Integer Width and Height Defines Dimensions
  #              Bitmap bitmap bitmap to transfer
  #              Integer opacity, opacity
  #-------------------------------------------------------------------------
  def fit_blt(x, y, width, height, bitmap, opacity = 255)
    w = bitmap.width
    h = bitmap.height
    conversion = w / h.to_f
    if w > width or h > height
      if conversion <= 1
        zoom_x, zoom_y = width * conversion, height
      else
        zoom_x, zoom_y = width, height * conversion ** -1
      end
      dest_rect = Rect.new(x, y, zoom_x, zoom_y)
      self.stretch_blt(dest_rect, bitmap, bitmap.rect, opacity)
    else
      self.full_blt(x, y, bitmap, opacity)
    end
  end
  #-------------------------------------------------------------------------
  #   Name:      Full Block Transfer
  #   Info:      Draws a Bitmap
  #   Author:    Trickster
  #   Call Info: Three or Four Arguments
  #              Integer X and Y define position
  #              Bitmap bitmap is the bitmap to draw
  #              Integer Opacity is the transparency (defaults to 255)
  #   Comment:   Lazy method for people who don't want to type bitmap.rect
  #-------------------------------------------------------------------------
  def full_blt(x,y,bitmap, opacity = 255)
    self.blt(x,y,bitmap,bitmap.rect, opacity)
  end
end
Instructions[/FONT]
Just place this above main, get in a battle, and to call Use $scene = Scene_Bestiary.new
Notes:[/FONT]
Credit me and Trickster Because I used some methods of him.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top