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.

Trouble with Synthezise "Actor Customization" script

Just when I thought I had everything running, I ofcourse had to break something else. You know not a good day unless I break a code! Ok so in any case I am using this wonderful code as a bonus level up system

Code:
#============================================================================
#                            Actor Customization!  
#----------------------------------------------------------------------------
# Written by Synthesize
# Version 5.00 
# July 28, 2007
# Tested with SDK 2.2
#============================================================================

#--------------------------------------------------------------------------
# * Begin Actor Customization modification section*
# Use this section to control many aspects of the script.
# May it be from Message display to Custom Actor Statistic growth
#--------------------------------------------------------------------------
module Customize
  # *General Settings*
  Points_Gained = 3   # Amount of points gained upon leveling up.
  Map_bg = true  # Display the map as the BG? true = yes. false = no; display a picture instead
  Draw_display = true   # Display Statistic advancement preview?
  Draw_face = false   # Draw Face or Character Sprite?. True= face, false; sprite
  Error_sound = '057-Wrong01' # Change the sound effect when insufficient supply
  Picture_name = 'sky'   # Name of your background. Leave blank if not used.
  #----
  # *Messages Control Center*
  # There are a total of seven messages, below you can customize each one
  Messages = ['HP has Increased', 'SP has Increased', 'Strength has Increased',
  'Dexterity has Increased', 'Agility has Increased', "Intellegence has Increased",
  "Please distribute your points", "Not Enough Points"]  
  # Define the messages. 0=HP, 1=SP, 2=STR, 3=DEX, 4=AGI, 
  # 5=INT, 6=Default, 7=Not enough Points
  #----
  # This area allows you to define custom Statistic Advancement.
  # Example, have Actor 1 get 7 HP and 3 STR but have Actor 2 receive 3 HP and 7 STR
# Define the Custom Stat actors below.
  Actor_HP = {1 => 10
  } # Define the amount of HP an actor gets per point. {actor_id => amount}. 
    # Seperate Actors with a comma (,).
      Actor_HP.default = 3 # Change this to set the default growth
  Actor_SP = {1 => 10
  } # Define the Amount of SP an actor gets per point. {actor_id => amount}
    # Seperate Actors with a comma(,)
      Actor_SP.default = 3 # Change this to set the default growth
  Actor_STR = {1 => 1
  } # Define the Amount of STR an actor gets per point. {actor_id => amount}
    # Seperate Actors with a comma(,)
      Actor_STR.default = 1 # Change this to set the default growth
  Actor_DEX = {1 => 1
  } # Define the Amount of DEX an actor gets per point. {actor_id => amount}
    # Seperate Actors with a comma(,)
      Actor_DEX.default = 1 # Change this to set the default growth
  Actor_AGI = {1 => 1
  } # Define the Amount of AGI an actor gets per point. {actor_id => amount}
    # Seperate Actors with a comma(,)
      Actor_AGI.default = 1 # Change this to set the default growth
  Actor_INT = {1 => 1
  } # Define the Amount of INT an actor gets per point. {actor_id => amount}
    # Seperate Actors with a comma(,)
      Actor_INT.default = 1 # Change this to set the default growth
  # Note: To use the Default statistic growth simply leave an actor value blank.
  end      

#--------------------------------------------------------------------------
# * Create Upgrade Points & Add Points on Level-up
#--------------------------------------------------------------------------
  #----------------------------------------------------------------------------
  # Begin Game_Actor Edit
  #----------------------------------------------------------------------------
  class Game_Actor < Game_Battler        
  # Make Upgrade Points
  attr_accessor :upgrade_points   
  alias synthesize_upgrade_points setup
  # Distribute Points among Actors 
  def setup(actor_id)
    synthesize_upgrade_points(actor_id)
    # Starting amount of points 
    @upgrade_points = 3
  end
  # Begin Level-up process 
  alias synthesize_upgrade_points_exp exp
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      # Add an additional level
      @level += 1
      # Add Upgrade Points to the actor that leveled
      @upgrade_points += Customize::Points_Gained
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
  end
  # End Class
end
    
  #----------------------------------------------------------------------------
  # End Game_Actor Edit
  #----------------------------------------------------------------------------


 #--------------------------------------------------------------------------
 # Scene_Upgrade
 # This is the main scene of 'Actor Customization!'
 # Editing not recommended.
 #--------------------------------------------------------------------------
  class Scene_Upgrade
  #--------------------------------------------------------------------------
  # Object Initalize
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0)
    # Define Actor_index. Used to draw actors and for multiple actor support
    @actor_index = actor_index
    # Define Actor Data
    @actor = $game_party.actors[@actor_index]
    @hp = Customize::Actor_HP[@actor.id]
    @sp = Customize::Actor_SP[@actor.id]
    @str = Customize::Actor_STR[@actor.id]
    @dex = Customize::Actor_DEX[@actor.id]
    @agi = Customize::Actor_AGI[@actor.id]
    @int = Customize::Actor_INT[@actor.id]
    @syn_message = Customize::Messages[6]   # The Default Message
  end
  #--------------------------------------------------------------------------
  # * Main Window Initialize
  #--------------------------------------------------------------------------
  def main
    # Draw background
      main_spriteset
    # Make Commands
      s1 = "Increase #{$data_system.words.hp} by #{@hp}"   
      s2 = "Increase #{$data_system.words.sp} by #{@sp}"   
      s3 = "Increase #{$data_system.words.str} by #{@str}"  
      s4 = "Increase #{$data_system.words.dex} by #{@dex}" 
      s5 = "Increase #{$data_system.words.agi} by #{@agi}"  
      s6 = "Increase #{$data_system.words.int} by #{@int}"  
      # Define Command Window
      @command_window = Window_Command.new(275, [s1, s2, s3, s4, s5, s6])
      @command_window.x = 343
      @command_window.y = 56
      @command_window.z = 9998
      @command_window.opacity = 200
      # Turn the Command Window On
      @command_window.active = true
	    @upgrade_status_window = Window_UpgradeStatus.new(@actor, @hp, @sp, @str, @dex, @agi, @int)
      @upgrade_status_window.opacity= 200
      @upgrade_status_window.x = 18
	    @upgrade_status_window.y = 112
	    @upgrade_status_window.z = 9998
      # Set Raise Window Data
      @raise_window = Window_Feedback.new(@syn_message)
      @raise_window.x = 18
      @raise_window.y = 56
      @raise_window.z = 9998
      @raise_window.opacity = 200
      # Set Actor Swap Window
      @actor_window = Window_ActorList.new
      @actor_window.x = 344
      @actor_window.y = 277
      @actor_window.z = 9998
      @actor_window.opacity = 200
      @actor_window.active = false
      @actor_window.index = 0
      # Graphics Transition
      Graphics.transition
      # Main Loop
      loop do
      # Update Graphics
      Graphics.update
      # Update Input
      Input.update
      # Renew
      update
      # Discontinue Loop
      if $scene != self
        break
      end
    end
      # Prepare Transition
      Graphics.freeze
     # Dispose Windows
      @command_window.dispose
      @upgrade_status_window.dispose
      @raise_window.dispose
      @actor_window.dispose
      if Customize::Draw_face == true
        @face.dispose
        end
  end
  #--------------------------------------------------------------------------
  # * Spriteset Initialize
  #--------------------------------------------------------------------------
  def main_spriteset
  # Draw either the Map or a Background Image
  if Customize::Map_bg == true
    # Draw the Map
    @background = Spriteset_Map.new
  else
    # Define the Background
    @background = Sprite.new
    @background.bitmap = RPG::Cache.picture(Customize::Picture_name)
  end
  # Draw Actors Face
  if Customize::Draw_face == true
    @face = Sprite.new
    @face.bitmap = RPG::Cache.picture(@actor.name + "_face")
    @face.x = 40
    @face.y = 120
    @face.z = 9999
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
      @command_window.update
      @actor_window.update
  # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
  # If Actor Window active call update_actor
    if @actor_window.active
      update_actor
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Update Command *
  #--------------------------------------------------------------------------
  def update_command
   # If B button was pressed
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @actor_window.active = true
      @command_window.active = false
      return
    end
      # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # Increase HP
        if @actor.upgrade_points >= 1 and @actor.maxhp <= 9998
          $game_system.se_play($data_system.decision_se)
          @syn_message = Customize::Messages[0]
          @actor.upgrade_points -= 1
          @actor.hp += @hp
          @actor.maxhp += @hp
          @upgrade_status_window.refresh
          @raise_window.update
        else
          @syn_message = Customize::Messages[7]
          @raise_window.update
          $game_system.se_play(RPG::AudioFile.new(Customize::Error_sound))
        end
      when 1  # # Increase SP
        if @actor.upgrade_points >= 1 and @actor.maxsp <= 9998
          $game_system.se_play($data_system.decision_se)
          @syn_message = Customize::Messages[1]
          @actor.upgrade_points -= 1
          @actor.sp += @sp
          @actor.maxsp += @sp
          @upgrade_status_window.refresh
          @raise_window.update
        else
          @syn_message = Customize::Messages[7]
          @raise_window.update
          $game_system.se_play(RPG::AudioFile.new(Customize::Error_sound))
        end
      when 2  # # Increase STR
        if @actor.upgrade_points >= 1 and @actor.str <= 998
          $game_system.se_play($data_system.decision_se)
          @syn_message = Customize::Messages[2]
          @actor.str += @str         
          @actor.upgrade_points -= 1
          @upgrade_status_window.refresh
          @raise_window.refresh
        else
          @syn_message = Customize::Messages[7]
          @raise_window.refresh
          $game_system.se_play(RPG::AudioFile.new(Customize::Error_sound))
        end
      when 3  # # Increase DEX
        if @actor.upgrade_points >= 1 and @actor.dex <= 998
          $game_system.se_play($data_system.decision_se)
          @syn_message = Customize::Messages[3]
          @actor.upgrade_points -= 1
          @actor.dex += @dex
          @upgrade_status_window.refresh
          @raise_window.refresh
        else
          @syn_message = Customize::Messages[7]
          @raise_window.refresh
          $game_system.se_play(RPG::AudioFile.new(Customize::Error_sound))
        end
      when 4  # # Increase AGI
        if @actor.upgrade_points >= 1 and @actor.agi <= 998
          $game_system.se_play($data_system.decision_se)
          @syn_message = Customize::Messages[4]
          @actor.upgrade_points -= 1
          @actor.agi += @agi
          @upgrade_status_window.refresh
          @raise_window.refresh
        else
          @syn_message = Customize::Messages[7]
          @raise_window.refresh
          $game_system.se_play(RPG::AudioFile.new(Customize::Error_sound))
        end
      when 5  # # Increase INT
        if @actor.upgrade_points >= 1 and @actor.int <= 998
          $game_system.se_play($data_system.decision_se)
          @syn_message = Customize::Messages[5]
          @actor.upgrade_points -= 1
          @actor.int += @int
          @upgrade_status_window.refresh
          @raise_window.refresh
        else
          @syn_message = Customize::Messages[7]
          @raise_window.refresh
          $game_system.se_play(RPG::AudioFile.new(Customize::Error_sound))
        end
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Actor Swap *
  #--------------------------------------------------------------------------
  def update_actor
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Swap Actors
      $game_system.se_play($data_system.decision_se)
      @actor_index = @actor_window.index
      $scene = Scene_Upgrade.new(@actor_index)
  end
 end
end

#--------------------------------------------------------------------------
# * Begin Window Data
#--------------------------------------------------------------------------
#=================================
# *Status Window*
#=================================
  class Window_UpgradeStatus < Window_Base
    # Initiate Actor Data
  def initialize(actor, hp, sp, str, dex, agi, int)
    # Define Window Reso.
	super(32, 32, 330, 300)
  # Set Contents
	self.contents = Bitmap.new(width - 32, height - 32)
  # Define Actor Data
	@actor = actor
  @hp = hp
  @sp = sp
  @str = str
  @dex = dex
  @agi = agi
  @int = int
  # Jump to Update
	refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Clear Window Contents
	self.contents.clear
  # Draw Actor Data
  if Customize::Draw_face == false
    draw_actor_graphic(@actor, 35, 50)
  end
  draw_actor_class(@actor, 85, 20)
  draw_actor_name(@actor, 80, 0)
	draw_actor_level(@actor, 176, 0)
  self.contents.font.color = system_color 
  # Draw Stat Display Preview
  if Customize::Draw_display == true
      self.contents.draw_text(85, 12, 35, 100, "Before:") 
      self.contents.draw_text(200, 12, 35, 100, "After:") 
      if @actor.upgrade_points >= 1 and @actor.maxhp <= 9998
        draw_synac_preview(@actor,176, 34, 0, @hp)
      end
        if @actor.upgrade_points >= 1 and @actor.maxsp <= 9998
        draw_synac_preview(@actor,176, 56, 1, @sp)
      end
      if @actor.upgrade_points >= 1 and @actor.str <= 998
        draw_synac_preview(@actor,176, 98, 2, @str)
      end
        if @actor.upgrade_points >= 1 and @actor.dex <= 998
        draw_synac_preview(@actor,176, 123, 3, @dex)
      end
      if @actor.upgrade_points >= 1 and @actor.agi <= 998
        draw_synac_preview(@actor,176, 148, 4, @agi)
      end
      if @actor.upgrade_points >= 1 and @actor.int <= 998
        draw_synac_preview(@actor,176, 173, 5, @int)
        end
      end
      # Draw additional Stats
	draw_actor_hp(@actor, 4, 68, 172)
	draw_actor_sp(@actor, 4, 90, 172)   
	draw_actor_parameter(@actor, 4, 132, 3)
	draw_actor_parameter(@actor, 4, 156, 4)
	draw_actor_parameter(@actor, 4, 180, 5)
	draw_actor_parameter(@actor, 4, 204, 6) 
  # Draw Point Data
  self.contents.font.color = system_color
  self.contents.draw_text(175, 205, 100, 100, "Points:")
  self.contents.font.color = normal_color
  self.contents.draw_text(165, 205, 100, 100, @actor.upgrade_points.to_s, 2)
end
  #=======================================================
  # Draw SC Preview
  #=======================================================
    def draw_synac_preview(actor,x, y, stat, value)
      if stat == 0
      minpreview = actor.hp + value
      maxpreview = actor.maxhp + value   
    elsif stat == 1
      minpreview = actor.sp + value
      maxpreview = actor.maxsp + value  
    elsif stat == 2
      maxpreview = actor.str + value  
    elsif stat == 3
      maxpreview = actor.dex + value  
    elsif stat == 4
      maxpreview = actor.agi + value  
    elsif stat == 5
      maxpreview = actor.int + value  
    end
    if stat > 1
      self.contents.font.color = crisis_color
      self.contents.draw_text(x, y, 12, 100, "=>") 
      self.contents.font.color = system_color
      self.contents.draw_text(x+24, y, 100, 100, "#{maxpreview}") 
    else
      self.contents.font.color = crisis_color
      self.contents.draw_text(x, y, 12, 100, "=>") 
      self.contents.font.color = system_color
      self.contents.draw_text(x+24, y, 100, 100, "#{minpreview}/#{maxpreview}") 
      end
    end
end
#--------------------------------------------------------------------------
# Raise Window
#--------------------------------------------------------------------------
class Window_Feedback < Window_Base
  def initialize(syn_message)
    super(0, 0, 330, 60)
    @syn_message = syn_message
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  def refresh
    # Clear the Window
    self.contents.clear
    # Draw the Message ID
    self.contents.draw_text(0, 0, 300, 34, @syn_message)
  end
end 
#--------------------------------------------------------------------------
# Actor Window
#--------------------------------------------------------------------------
class Window_ActorList < Window_Selectable
  
  def initialize
    super(0, 0, 275, 85)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.active = false
    self.index = -1
    @item_max = $game_party.actors.size
    @column_max = 2
    draw_actor
    self.active = false
    self.index = 0
  end
  
  def draw_actor
   for i in 0...$game_party.actors.size
    actor = $game_party.actors[i]
      x = i * 65
      y = 50
      draw_actor_graphic(actor, x + 20, y)
    end
    end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    self.cursor_rect.set(0 + index * 65, 0, 40, 54)
  end
end 

#                            
#----------------------------------------------------------------------------
# Written by Synthesize
# Additional Thanks: Icedmetal57 (Custom Stat Progression), Trickster (Bug smashing)
# DerVVulfman (SDK Module detection idea). Community for reporting bugs and support ^-^
#----------------------------------------------------------------------------
#                           Actor Customization! 
#============================================================================

Everything is working just great, except the code only works on certain maps. Funny ant it? I have an event that calls this script (so they can assign points and such) and it works fine. But when I copy the same bloody event onto another map, it crashes the game! Any help would be great considering its 4am and I think I am just stupid now.

Thanks guys!
 
shadowball":t61bzrra said:
have you already tried to create a common event instead of several local events? Just a single map would need to turn on a switch and... you know what should happen next.

Indeed, and I still get the same results. I thought it was just the scripts fighting it out at first, but then the strange thing of it working on some maps came into play. I mean for now it's fine, I'll just make people goto one two to do it ^_^. But hey thanks for the quick reply and the help!
 
mmm, I remember I had a problem as weird as this one just because there were two scripts in conflict. One of them was one of the message systems... I read there was some kind of message system script call included. Normally UMS or AMS should work fine if you include the SDK, but sometimes they don't react very well if there is something else messing with them. Did you include any of them? If not, you may need to post a list of custom scripts you included in your project. Let's see what Seph or someone like him has to say about this issue.
 
Hey there again Shadow... Sorry I took so long to reply, 11 hour work days can really hurt sometimes. Anyways the only message script i have running is one that allows faces to be displayed. And would this (if it is a conflict) really cause the game to crash? Honestly didn't know that >_<

If that's the case let me go ahead and post the scripts I am running, thanks again for all your help man! I would have prob thrown my laptop again... Oh and a quick note I am not using SDK, I have heard bad things about that, do you think it would help?

Code:
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  def now_exp
    return @exp - @exp_list[@level]
  end
  def next_exp
    return (@exp_list[@level+1] > 0 ?
      @exp_list[@level+1] - @exp_list[@level] : 0)
  end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x      : window x-coordinate
  #     y      : window y-coordinate
  #     height : window height
  #--------------------------------------------------------------------------
  alias :initialize_gauge :initialize
  def initialize(x, y, width, height)
    initialize_gauge(x, y, width, height)
    # Initialize HP and SP gauge values
    @hp_gauge = {}
    @sp_gauge = {}
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  alias :dispose_gauge :dispose
  def dispose
    # Æ’QÂ
 
(think i ran out of room >_<)

Code:
#######################################
# Monster Album #
#######################################
# Author: El Conducter
# Date: August/3/07
# Version: 1.0
#######################################

#----------------------------------------------------------------------------
# What it Does:
# This script basically creates a catalogue of monsters you've killed.
# You are also given a monster hunter rank based on how many
# different monsters have been defeated. The catalogue displays all
# the monsters attributes & picture, player rank, and percent of album
# completion.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# How it Works:
# At the end of each battle, every monster that was involved is sent
# to the @enemies_killed array that has been added to Game_Troop.
# The album scene and windows use the monsters in that array and
# displays their information.
#
# Scripts used are:
# - Scene_Album
# - Window_Album_Right
# - Window_Monster_List
# - Window_Monster_Picture
# - Window_Total
# - Window_Base
# - Game_Party
# - Game_Troop
# - Scene_Battle
# - Scene_Menu
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# How to Use This Script:
# Just copy it and paste it above Main.
#
# If you are going to use events to call the album menu, use Call Script:
# $scene = Scene_Album.new
#
# You can use an item to call the menu as well. Just make the item call a
# Common Event, and make the Common Event do the above task.
#----------------------------------------------------------------------------

#----------------------------------------------------------------------------
# Comments:
# I hope my script is easy for you to use and modify. Study this
# script to learn RGSS better and become a better scriptor yourself.
#----------------------------------------------------------------------------

#==============================================================================
# ** Scene_Album
#------------------------------------------------------------------------------
# This class handles the monster album windows.
#==============================================================================

class Scene_Album
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Set up windows used in this scene
# Set window of monster names currently known
@monster_list_window = Window_Monster_List.new
# Get monster currently selected in window list
@monster = @monster_list_window.monster
# Make window that shows current selected monster's stats
@monster_info_window = Window_Album_Right.new(@monster)
# Make info window of album completion
@total_window = Window_Total.new
# Make monster window
@monster_window = Window_Monster_Picture.new(@monster)
@monster_window.visible = false
refresh
# Execute transition
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
@monster_info_window.dispose
@monster_list_window.dispose
@total_window.dispose
@monster_window.dispose
end
#--------------------------------------------------------------------------
# * Refresh Method
#--------------------------------------------------------------------------
def refresh
@monster = @monster_list_window.monster
if @monster != nil
@monster_info_window.set_new_monster(@monster)
@monster_window.get_new_monster(@monster)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@monster_list_window.update
refresh
# If monster list window is active: call update_list
if @monster_list_window.active
update_list
return
end
# If monster window is visible: call update_list
if @monster_window.visible
update_monster
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when monster list window is active)
#--------------------------------------------------------------------------
def update_list
refresh
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
@monster_list_window.active = false
$scene = Scene_Menu.new(0)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
if @monster != nil
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Activate monster window
@monster_list_window.active = false
@monster_list_window.visible = false
@monster_info_window.visible = false
@total_window.visible = false
@monster_window.visible = true
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (when monster window is active)
#--------------------------------------------------------------------------
def update_monster
refresh
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Go back to monster list
@monster_list_window.active = true
@monster_window.visible = false
@monster_list_window.visible = true
@monster_info_window.visible = true
@total_window.visible = true
return
end
end
end

#==============================================================================
# ** Window_Album_Right
#------------------------------------------------------------------------------
# This window shows monster attributes.
#==============================================================================

class Window_Album_Right < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(enemy)
super(241, 64, 400, 416)
self.contents = Bitmap.new(width - 32, height - 32)
@enemy = enemy
self.opacity = 0 # Make this higher if you want to see the window
refresh
end
#--------------------------------------------------------------------------
# * Set parameters for monster
#--------------------------------------------------------------------------
def set_new_monster(new_monster)
if @enemy != new_monster
@enemy = new_monster
refresh
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @enemy != nil
draw_enemy_picture(@enemy, 190, 208)
draw_enemy_name(@enemy, 2, 0)
draw_enemy_stats(@enemy, 4, 220)
draw_enemy_exp(@enemy, 4, 50)
draw_enemy_gold(@enemy, 4, 100)
end
end
end

#==============================================================================
# ** Window_Monster_List
#------------------------------------------------------------------------------
# The list of monster names.
#==============================================================================

class Window_Monster_List < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 240, 416)
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Monster Acquisition
#--------------------------------------------------------------------------
def monster
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# For every enemy in the game, send a copy of them to @data
for i in 0...$game_troop.enemies_killed.size
@data.push($game_troop.enemies_killed[i])
end
# Sort enemies by ID
@data.sort! {|a, z| a.id <=> z.id}
# If item count is not 0, make a bitmap and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
monster = @data[index]
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.font.color = system_color
self.contents.draw_text(x, y, 204, 32, monster.id.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x+50, y, 204, 32, monster.name, 0)
end
end

#==============================================================================
# ** Window_Monster_Picture
#------------------------------------------------------------------------------
# This window shows a bigger picture of the monster with name.
#==============================================================================

class Window_Monster_Picture < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(enemy)
super(115, 0, 430, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@enemy = enemy
refresh
end
#--------------------------------------------------------------------------
# * Set parameters for monster
#--------------------------------------------------------------------------
def get_new_monster(new_monster)
if @enemy != new_monster
@enemy = new_monster
refresh
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @enemy != nil
draw_enemy_picture2(@enemy)
draw_enemy_name2(@enemy, 10, 420)
end
end
end

#==============================================================================
# ** Window_Monster_Total
#------------------------------------------------------------------------------
# Shows album completion.
#==============================================================================

class Window_Total < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Determine party's rank title for album completion
#--------------------------------------------------------------------------
def calculate_rank
case $game_party.rank
when 0
@title = "No Rank"
when 1
@title = "Adventurer"
when 2
@title = "Hunter"
when 3
@title = "Collector"
when 4
@title = "Obesessed"
when 5
@title = "Poke Master"
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 200, 32, "Bestiary Completion :")
self.contents.draw_text(215, 0, 200, 32, " / ")
self.contents.draw_text(370, 0, 200, 32, "Rank :")
self.contents.font.color = normal_color
percent_of = ((($game_troop.enemies_killed.size) * 100) / ($data_enemies.size - 1))
self.contents.draw_text(200, 0, 200, 32, $game_troop.enemies_killed.size.to_s)
self.contents.draw_text(240, 0, 200, 32, ($data_enemies.size - 1).to_s + " : ")
self.contents.draw_text(295, 0, 200, 32, percent_of.to_s + "%")
calculate_rank
self.contents.draw_text(430, 0, 200, 32, @title)
end
end

#==============================================================================
# ** Window_Command2
#------------------------------------------------------------------------------
# This version of command window is a set size with scrolling commands.
#==============================================================================

class Window_Command2 < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands)
super(0, 0, width, 224)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end

#==============================================================================
# ** Window_Base
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Draws enemy's picture
#--------------------------------------------------------------------------
def draw_enemy_picture(enemy, x, y)
bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
x2 = bitmap.width
y2 = bitmap.height
x3 = x2 / 2
y3 = y2 - 120
src_rect = Rect.new(0, 0, x2, y2)
# If enemy height is greater than 220, draw the picture lower on the screen
if bitmap.height > 220
self.contents.blt(x - x3, y - y3, bitmap, src_rect)
else
self.contents.blt(x - x3, y - y2, bitmap, src_rect)
end
end
#--------------------------------------------------------------------------
# * Draws enemy's large picture
#--------------------------------------------------------------------------
def draw_enemy_picture2(enemy)
bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
x2 = bitmap.width
y2 = bitmap.height
x3 = 398 - bitmap.width
y3 = 398 - bitmap.height
src_rect = Rect.new(0, 0, x2, y2)
if x3 <= y3
new_rect = Rect.new(0, 0, x2 + x3, y2 + x3)
else
new_rect = Rect.new(0, 0, x2 + y3, y2 + y3)
end
self.contents.stretch_blt(new_rect, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Draws enemy's name
#--------------------------------------------------------------------------
def draw_enemy_name(enemy, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 200, 32, enemy.name)
end
#--------------------------------------------------------------------------
# * Draws enemy's name different color
#--------------------------------------------------------------------------
def draw_enemy_name2(enemy, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 200, 32, enemy.name)
end
#--------------------------------------------------------------------------
# * Draws enemy's gold
#--------------------------------------------------------------------------
def draw_enemy_gold(enemy, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 100, 32, "Money")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, enemy.gold.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draws enemy's exp
#--------------------------------------------------------------------------
def draw_enemy_exp(enemy, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "EXP")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, enemy.exp.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draws enemy's statistics
#--------------------------------------------------------------------------
def draw_enemy_stats(enemy, x, y)
# Change color
self.contents.font.color = system_color
# Draw text
self.contents.draw_text(x, y, 32, 32, "HP")
self.contents.draw_text(x + 200, y, 32, 32, "SP")
self.contents.draw_text(x, y + 26, 32, 32, "Atk")
self.contents.draw_text(x + 200, y + 26, 32, 32, "Str")
self.contents.draw_text(x, y + 52, 60, 32, "Def")
self.contents.draw_text(x + 200, y + 52, 32, 32, "Mdf")
self.contents.draw_text(x, y + 78, 32, 32, "Dex")
self.contents.draw_text(x + 200, y + 78, 32, 32, "Int")
self.contents.draw_text(x, y + 104, 32, 32, "Agi")
self.contents.draw_text(x + 200, y + 104, 32, 32, "Eva")
self.contents.draw_text(x, y + 130, 125, 32, "Item Dropped :")
self.contents.draw_text(x, y - 65, 100, 32, "Drop Rate :")
# Change color
self.contents.font.color = normal_color
# Draw stats
self.contents.draw_text(x + 40, y, 84, 32, enemy.maxhp.to_s, 2)
self.contents.draw_text(x + 240, y, 84, 32, enemy.maxsp.to_s, 2)
self.contents.draw_text(x + 40, y + 26, 84, 32, enemy.atk.to_s, 2)
self.contents.draw_text(x + 240, y + 26, 84, 32, enemy.str.to_s, 2)
self.contents.draw_text(x + 40, y + 52, 84, 32, enemy.pdef.to_s, 2)
self.contents.draw_text(x + 240, y + 52, 84, 32, enemy.mdef.to_s, 2)
self.contents.draw_text(x + 40, y + 78, 84, 32, enemy.dex.to_s, 2)
self.contents.draw_text(x + 240, y + 78, 84, 32, enemy.int.to_s, 2)
self.contents.draw_text(x + 40, y + 104, 84, 32, enemy.agi.to_s, 2)
self.contents.draw_text(x + 240, y + 104, 84, 32, enemy.eva.to_s, 2)
# If enemy has a weapon, draw its name and icon
if enemy.weapon_id > 0
bitmap = RPG::Cache.icon($data_weapons[enemy.weapon_id].icon_name)
self.contents.blt(x + 140, y + 135, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(x + 140, y + 130, 200, 32, ($data_weapons[(enemy.weapon_id)].name).to_s, 2)
self.contents.draw_text(x + 95, y - 65, 50, 32, enemy.treasure_prob.to_s + "%", 2)
end
# If enemy has a piece armor, draw its name and icon
if enemy.armor_id > 0
bitmap = RPG::Cache.icon($data_armors[enemy.armor_id].icon_name)
self.contents.blt(x + 140, y + 135, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(x + 140, y + 130, 200, 32, ($data_armors[(enemy.armor_id)].name).to_s, 2)
self.contents.draw_text(x + 95, y - 65, 50, 32, enemy.treasure_prob.to_s + "%", 2)
end
# If enemy has an item, draw its name and icon
if enemy.item_id > 0
bitmap = RPG::Cache.icon($data_items[enemy.item_id].icon_name)
self.contents.blt(x + 140, y + 135, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(x + 140, y + 130, 200, 32, ($data_items[(enemy.item_id)].name).to_s, 2)
self.contents.draw_text(x + 95, y - 65, 50, 32, enemy.treasure_prob.to_s + "%", 2)
end
end
end

#==============================================================================
# ** Game_Party
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor:rank
#--------------------------------------------------------------------------
# * Alias method
#--------------------------------------------------------------------------
alias beast_game_party_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Added variable
@rank = 0
# Original method
beast_game_party_init
end
#--------------------------------------------------------------------------
# * Calculates the players rank
#--------------------------------------------------------------------------
def define_rank
# Get percent of enemies killed over total amount of enemies in game
# -1 to make up for nil in $data_enemies array
percent = ((($game_troop.enemies_killed.size) * 100) / ($data_enemies.size - 1))
# Change player rank according to percent
case percent
when 1..25 # When up to 25%
@rank = 1
when 26..50 # When 26% to 50%
@rank = 2
when 51..75 # When 51% to 75%
@rank = 3
when 76..99 # When 76% to 99%
@rank = 4
when 100 # When 100%
@rank = 5
end
end
end

#==============================================================================
# ** Game_Troop
#==============================================================================

class Game_Troop
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Added variable
attr_accessor :enemies_killed
#--------------------------------------------------------------------------
# * Alias Method
#--------------------------------------------------------------------------
alias beast_game_troop_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original method
beast_game_troop_init
# Create enemies killed array
@enemies_killed = []
end
end

#==============================================================================
# ** Scene_Battle (part 2)
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
def start_phase5
# Shift to phase 5
@phase = 5
# Play battle end ME
$game_system.me_play($game_system.battle_end_me)
# Return to BGM before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Initialize EXP, amount of gold, and treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# If enemy is not hidden
unless enemy.hidden
# Get current enemy troop id
troop = $data_troops[$game_temp.battle_troop_id]
# For every monster in that troop add them to the list of enemies killed
for i in 0...troop.members.size
monster = $data_enemies[troop.members[i].enemy_id]
$game_troop.enemies_killed.push(monster).uniq!
# Uniq! so there aren't any of the same enemy in array
end
# Determine party's monster hunting rank
$game_party.define_rank
# Add EXP and amount of gold obtained
exp += enemy.exp
gold += enemy.gold
# Determine if treasure appears
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure is limited to a maximum of 6 items
treasures = treasures[0..5]
# Obtaining EXP
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# Obtaining gold
$game_party.gain_gold(gold)
# Obtaining treasure
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Make battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
# Set wait count
@phase5_wait_count = 100
end
end

#==============================================================================
# ** Scene_Menu
#==============================================================================

class Scene_Menu
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Album"
s5 = "Status"
s6 = "Save"
s7 = "End Game"
@command_window = Window_Command2.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, album, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
@command_window.disable_item(4)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(5)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# Execute transition
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
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # Monster Album
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Go to monster album
$scene = Scene_Album.new
when 4 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 5 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 6 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 1 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 4 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
 
mmm SDK would help you if you already included some SDK compatible script or something like that...
wait... I have seen 2 scripts that mentions the SDK... well, one of them is the retry...
 
shadowball":2qzc6yp7 said:
mmm SDK would help you if you already included some SDK compatible script or something like that...
wait... I have seen 2 scripts that mentions the SDK... well, one of them is the retry...

Ok as soon as I get home from work today, I'll give that a try. I hope it works this time, every other time I did it... it blew up in my face >_< But thanks again for the time you spent with me ^_^
 
Ok problem solved, apparently it was the beast book script and the animated save script I had that screwed everything up. Removed them and now everything is working fine. Again thanks for the help.
 

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