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.

Skill Shop Please

HI i am looking for skill shop  that will allow me to buy skill and be able to forget a selected skill That you have to buy i have found others but they either other languages and or corrupted
 
hey! I only found a skill shop script without the ability to forget a selected skill. maybe someone can add it...
Here's the script:
Code:
module BurritoSkillshop
  SKILLPRICE_CLASS_ID = 11
end

class Scene_Skillshop
  def initialize(skill_ids)
    @skills = []
    skill_ids.each { |id| @skills.push($data_skills[id]) }
  end
  
  def main
    build_view
    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
    Graphics.freeze
    cleanup
  end
  
  def build_view
    @help_window = Window_Help.new
    
    @gold_window = Window_Gold.new
    @gold_window.x = 480
    @gold_window.y = 64
    
    @command_window = Window_SkillshopCommand.new
    @command_window.active = true
    
    @left_window = Window_SkillshopLeft.new(@skills)
    @left_window.help_window = @help_window
    @left_window.active = false
    
    @right_window = Window_SkillshopRight.new
    @right_window.active = false
    
    @help_window.set_text("")
  end
  
  def update
    @help_window.update
    @gold_window.update
    @command_window.update
    @left_window.update
    @right_window.update
    
    if @command_window.active
      update_command
      return
    end
    
    if @left_window.active 
      update_left
      return
    end
    
    if @right_window.active
      update_right
      return
    end
  end

  def update_command
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      case @command_window.index
      when 0
        @command_window.active = false
        @left_window.active = true
      when 1
        $scene = Scene_Map.new
      end
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
  end
  
  def update_left
    @right_window.skill = @left_window.skill
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @left_window.active = false
      @command_window.active = true
      @help_window.set_text("")
      @left_window.index = 0
    end
    
    if Input.trigger?(Input::C)
      if @left_window.price > $game_party.gold
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      @left_window.active = false
      @right_window.active = true
      @right_window.index = 0
    end
  end
  
  def update_right
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @left_window.active = true
      @right_window.active = false
      @right_window.index = -1
    end
    
    if Input.trigger?(Input::C)
      if not @right_window.ok?
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      $game_system.se_play($data_system.decision_se)
      $game_party.lose_gold(@left_window.price)
      @right_window.actor.learn_skill(@left_window.skill.id)
      @right_window.refresh
      @gold_window.refresh
      @left_window.refresh
    end
  end
  
  def cleanup
    @help_window.visible = false
    @help_window.dispose
    
    @gold_window.visible = false
    @gold_window.dispose
    
    @command_window.visible = false
    @command_window.dispose
    
    @left_window.visible = false
    @left_window.dispose
    
    @right_window.visible = false
    @right_window.dispose
  end
end

class Window_SkillshopCommand < Window_Selectable
  def initialize
    super(0, 64, 480, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @item_max = 2
    @column_max = 3
    @commands = ["Buy", "Exit"]
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    x = 4 + index * 160
    self.contents.draw_text(x, 0, 128, 32, @commands[index])
  end
end

class Window_SkillshopLeft < Window_Selectable
  def initialize(skills)
    super(0, 128, 368, 352)
    @data = skills
    set_prices
    refresh
    self.index = 0
  end
  
  def set_prices
    @prices = {}
    $data_classes[BurritoSkillshop::SKILLPRICE_CLASS_ID].learnings.each do |learning|
      @prices[learning.skill_id] = learning.level * 10
    end
  end
  
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    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
  
  def skill
    return @data[self.index]
  end
  
  def price
    return @prices[self.skill.id]
  end
  
  def draw_item(index)
    skill = @data[index]
    
    # If price is less than money in possession, then set to normal text color. 
    # Otherwise set to disabled color
    if @prices[skill.id] <= $game_party.gold
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 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, 212, 32, skill.name, 0)
    self.contents.draw_text(x + 240, y, 88, 32, @prices[skill.id].to_s, 2)
  end
  
  def update_help
    @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  end
end

class Window_SkillshopRight < Window_Selectable
  def initialize
    super(368, 128, 272, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    @skill = nil
    @index = -1
    refresh
  end
  
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    self.contents.font.color = normal_color
    for i in 0 ... $game_party.actors.size
      actor = $game_party.actors[i]
      
      draw_actor_graphic(actor, 16, 64 + 64 * i)
      self.contents.draw_text(64, 16 + 64 * i, 120, 32, actor.name)
    end
    return if @skill == nil
    @learn_ok = []
    for i in 0 ... $game_party.actors.size
      actor = $game_party.actors[i]
      
      text = "Not possible"
      color = disabled_color
      ok = false
      
      $data_classes[actor.class_id].learnings.each do |l|
        if l.skill_id == @skill.id
          text = "Not learned"
          color = normal_color
          ok = true
        end
      end
      
      actor.skills.each do |s|
        if s == @skill.id
          text = "Learnd"
          color = disabled_color
          ok = false
        end        
      end
      @learn_ok.push(ok)
      self.contents.font.color = color
      self.contents.draw_text(64, 32 + 64 * i, 120, 32, text)
    end
  end
  
  def skill=(skill)
    if @skill != skill
      @skill = skill
      refresh
    end
  end
  
  def ok?
    return @learn_ok[self.index]
  end
  
  def actor
    return $game_party.actors[self.index]
  end
  
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, 16 + 64 * @index, self.width - 32, 64)
    end
  end
end

to activate it u need to make a script event and write:

Code:
skills = [x]
$scene = Scene_Skillshop.new(skills)

x is the ID of the skills you want to be mercenarily. If you want more skills to be mercenarily u must write more then one x ;P
e.g:

Code:
skills = [222,225,228]
$scene = Scene_Skillshop.new(skills)

here is an example as Screensot:

http://img65.imageshack.us/img65/127/exampleev7.th.png[/img]http://img65.imageshack.us/images/thpix.gif[/img]

Credits for the Slript to Burrito!

I know, that that's not exactly the script you wanted, but it's the only one i found.

~Kairi
 

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