Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Skill Screen
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.

Heres a skill screen I finished today. It took me only a couple of hours, with each script I make they get more advanced. You cant tell though, but its what im doing in the scripts, I learn alot of different things with each script I make. Right now im practising on screens, like this one, so lets get on with the script.

Simply place the following script above main and everything will work.

Code:
#==============================================================================
# Custom Skill Screen 1.0 by Marked(23.10.06) Script no.:4
#---------------------------------------------------------
# This script is fairly basic. It displays extra stats in the skills screen
# which are: ATK, PDEF, MDEF, STR, DEX and AGI, it displays the actors graphic
# and the windows are rearranged. Another feature that is the skill screen in
# battle, it is the same as the default. This script will also change the battle
# skill screen, and it didnt look very good, so it changes back to the default
# one.
#----------------------------------------------------------
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
#  This class performs skill screen processing.
#==============================================================================

class Scene_Skill
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_index : actor index
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Get actor
    @actor = $game_party.actors[@actor_index]
    # Make help window, status window, skill window and graphic window.
    @help_window = Window_Help.new
    @status_window = Window_SkillStatus.new(@actor)
    @skill_window = Window_Skill.new(@actor)
    @skill_graphic = Window_Skill_Graphic.new(@actor)
    # Associate help window
    @skill_window.help_window = @help_window
    # Make target window (set to invisible / inactive)
    @target_window = Window_Target.new
    @target_window.visible = false
    @target_window.active = false
    # 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
    @help_window.dispose
    @status_window.dispose
    @skill_window.dispose
    @target_window.dispose
    @skill_graphic.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @help_window.update
    @status_window.update
    @skill_window.update
    @target_window.update
    # If skill window is active: call update_skill
    if @skill_window.active
      update_skill
      return
    end
    # If skill target is active: call update_target
    if @target_window.active
      update_target
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (if skill window is active)
  #--------------------------------------------------------------------------
  def update_skill
    # 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
      $scene = Scene_Menu.new(1)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the skill window
      @skill = @skill_window.skill
      # If unable to use
      if @skill == nil or not @actor.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # If effect scope is ally
      if @skill.scope >= 3
        # Activate target window
        @skill_window.active = false
        @target_window.x = (@skill_window.index + 1) % 2 * 304
        @target_window.visible = true
        @target_window.active = true
        # Set cursor position to effect scope (single / all)
        if @skill.scope == 4 || @skill.scope == 6
          @target_window.index = -1
        elsif @skill.scope == 7
          @target_window.index = @actor_index - 10
        else
          @target_window.index = 0
        end
      # If effect scope is other than ally
      else
        # If common event ID is valid
        if @skill.common_event_id > 0
          # Common event call reservation
          $game_temp.common_event_id = @skill.common_event_id
          # Play use skill SE
          $game_system.se_play(@skill.menu_se)
          # Use up SP
          @actor.sp -= @skill.sp_cost
          # Remake each window content
          @status_window.refresh
          @skill_window.refresh
          @target_window.refresh
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
    # If R button was pressed
    if Input.trigger?(Input::R)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To next actor
      @actor_index += 1
      @actor_index %= $game_party.actors.size
      # Switch to different skill screen
      $scene = Scene_Skill.new(@actor_index)
      return
    end
    # If L button was pressed
    if Input.trigger?(Input::L)
      # Play cursor SE
      $game_system.se_play($data_system.cursor_se)
      # To previous actor
      @actor_index += $game_party.actors.size - 1
      @actor_index %= $game_party.actors.size
      # Switch to different skill screen
      $scene = Scene_Skill.new(@actor_index)
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when target window is active)
  #--------------------------------------------------------------------------
  def update_target
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Erase target window
      @skill_window.active = true
      @target_window.visible = false
      @target_window.active = false
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If unable to use because SP ran out
      unless @actor.skill_can_use?(@skill.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If target is all
      if @target_window.index == -1
        # Apply skill use effects to entire party
        used = false
        for i in $game_party.actors
          used |= i.skill_effect(@actor, @skill)
        end
      end
      # If target is user
      if @target_window.index <= -2
        # Apply skill use effects to target actor
        target = $game_party.actors[@target_window.index + 10]
        used = target.skill_effect(@actor, @skill)
      end
      # If single target
      if @target_window.index >= 0
        # Apply skill use effects to target actor
        target = $game_party.actors[@target_window.index]
        used = target.skill_effect(@actor, @skill)
      end
      # If skill was used
      if used
        # Play skill use SE
        $game_system.se_play(@skill.menu_se)
        # Use up SP
        @actor.sp -= @skill.sp_cost
        # Remake each window content
        @status_window.refresh
        @skill_window.refresh
        @target_window.refresh
        # If entire party is dead
        if $game_party.all_dead?
          # Switch to game over screen
          $scene = Scene_Gameover.new
          return
        end
        # If command event ID is valid
        if @skill.common_event_id > 0
          # Command event call reservation
          $game_temp.common_event_id = @skill.common_event_id
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      # If skill wasn't used
      unless used
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
      end
      return
    end
  end
end







#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
#  This window displays usable skills on the skill and battle screens.
#==============================================================================

class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    if $game_temp.in_battle
    super(200, 64, 640, 300)
    else
    super(200, 64, 440, 300)
    end
    @actor = actor
    if $game_temp.in_battle
     @column_max = 2
    else
     @column_max = 1
    end
    refresh
    self.index = 0
    # If in battle, move window to center of screen
    # and make it semi-transparent
    if $game_temp.in_battle
      self.x = 0
      self.y = 64
      self.width = 640
      self.height = 256
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # * Acquiring Skill
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil
        @data.push(skill)
      end
    end
    # If item count is not 0, make a bit map 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
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    if @actor.skill_can_use?(skill.id)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 1 * (288 + 32)
    y = index / 1 * 32
    if $game_temp.in_battle
      x = 4 + index % 2 * (288 + 32)
      y = index / 2 * 32
    end
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(skill.icon_name)
    opacity = self.contents.font.color == normal_color ? 255 : 128
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
    if $game_temp.in_battle
    self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
    else
    self.contents.draw_text(x + 350, y, 48, 32, skill.sp_cost.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  end
end

#==============================================================================
# ** Window_SkillStatus
#------------------------------------------------------------------------------
#  This window displays the skill user's status on the skill screen.
#==============================================================================

class Window_SkillStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 364, 640, 116)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_state(@actor, 0, 0)
    draw_actor_hp(@actor, 0, 28)
    draw_actor_sp(@actor, 0, 28+28)
  #--------------------------------------------------------------------------
  # * Draw Parameters
  #--------------------------------------------------------------------------
    draw_actor_parameter(@actor, 200, 0, 0)
    draw_actor_parameter(@actor, 200, 28, 1)
    draw_actor_parameter(@actor, 200, 28+28, 2)
    draw_actor_parameter(@actor, 420, 0, 3)
    draw_actor_parameter(@actor, 420, 28, 4)
    draw_actor_parameter(@actor, 420, 28+28, 5)
  end
end

#==============================================================================
# ** Window_Skill_Actor_Graphic
#------------------------------------------------------------------------------
#  This window displays the Actors name, class and graphic.
#==============================================================================

class Window_Skill_Graphic < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor : actor
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 64, 200, 300)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
  draw_actor_class(@actor, 200, 200)
  end
  #--------------------------------------------------------------------------
  # * Draw Actor Graphic
  # REMEMBER!: Set the character set and the graphic picture's name exactly
  # the same, otherwise the wrong, or no, graphic will appear.
  #--------------------------------------------------------------------------
  def draw_actor_battler(actor, x, y)
   face = RPG::Cache.battler(actor.character_name, actor.character_hue)
   fw = face.width
   fh = face.height
   src_rect = Rect.new(3, -1, fw, fh)
   self.contents.blt(x - fw / 43, y - fh, face, src_rect, opacity)
end
  
    def refresh
    self.contents.clear
    draw_actor_battler(@actor, 37, 255)
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 4+32, 22)
    end
end


The script will only edit the menu skill window, not the battle one. It changes the battle one back to default because it looked better.
I hope someone will like this script. So please leave your comments and feedback, thanks.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  RX-Stats Screen Fugly 0 2,827 10-22-2006, 01:00 PM
Last Post: Fugly
  Actor's Weapon Skill Leon Westbrooke 0 2,412 09-21-2006, 01:00 PM
Last Post: Leon Westbrooke
  Tasty custom menu screen with gradients tktarr 0 2,450 07-05-2006, 01:00 PM
Last Post: tktarr
  SIBruno AES - Advanced Equip Screen sibruno 0 2,368 02-10-2006, 01:00 PM
Last Post: sibruno
  SIBruno Advanced Equip Screen v2 sibruno 0 1,967 01-30-2006, 01:00 PM
Last Post: sibruno
  Skill Details Derk-Jan 0 1,870 12-31-2005, 01:00 PM
Last Post: Derk-Jan
  Advanced Title Screen 2 kaito 0 2,314 09-19-2005, 01:00 PM
Last Post: kaito
  Equip Weapon Gain Skill makeamidget 0 2,063 08-17-2005, 01:00 PM
Last Post: makeamidget
  Title Screen Mod Hadriel 0 2,128 02-19-2005, 01:00 PM
Last Post: Hadriel
  Here's how to bypass the title screen Killswitch 0 2,273 01-13-2005, 01:00 PM
Last Post: Killswitch



Users browsing this thread: