Arena RPG Maker
Olá, visitante!
Seja bem-vindo ao fórum Arena RPG Maker, caso queira aprender sobre criação de jogos, está no fórum certo. Esperamos que possa aprender tanto quanto possa nos ensinar aqui.

Atenciosamente,
Equipe Arena RPG Maker.
Arena RPG Maker
Olá, visitante!
Seja bem-vindo ao fórum Arena RPG Maker, caso queira aprender sobre criação de jogos, está no fórum certo. Esperamos que possa aprender tanto quanto possa nos ensinar aqui.

Atenciosamente,
Equipe Arena RPG Maker.
Arena RPG Maker

Estamos de volta o/ ... Ou não.Eu amo a -Dark
Doações para o fórum abertas, clique aqui e saiba mais.
Últimos assuntos
» Ainda temos gente aqui?
Loja de Habilidades EmptyQui 25 Nov 2021, 14:04 por Halt

» [Dúvida] Como tirar a porcentagem de esquiva
Loja de Habilidades EmptySex 19 Nov 2021, 17:14 por Halt

» Pokémon Genesis Online! (PGO)
Loja de Habilidades EmptyQua 05 Jul 2017, 18:08 por Lexar

» Tileset Converter to MV
Loja de Habilidades EmptySex 12 maio 2017, 14:07 por Douggi

» Pack Resources, Sprites e etc
Loja de Habilidades EmptyQua 23 Dez 2015, 12:30 por raydengv

» Download RPG Maker 2003 + RTP em português
Loja de Habilidades EmptyTer 22 Dez 2015, 11:14 por ::KimMax::

» Fantasy Art Online
Loja de Habilidades EmptyDom 18 Out 2015, 18:42 por daviih123

» Você vai ter medo do Nerve gear?
Loja de Habilidades EmptySáb 25 Jul 2015, 17:02 por Kirito-kun

» O Barato é louco
Loja de Habilidades EmptySáb 27 Jun 2015, 16:26 por Halt

» Download RPG Maker 2000 + RTP em português
Loja de Habilidades EmptyQui 21 maio 2015, 20:28 por Wismael


Você não está conectado. Conecte-se ou registre-se

Ver o tópico anterior Ver o tópico seguinte Ir para baixo  Mensagem [Página 1 de 1]

1Loja de Habilidades Empty Loja de Habilidades Seg 29 Out 2012, 01:58

Carlos

Carlos
Administrador
Administrador
Introdução:

Quem aqui não jogou final fantasy, que você compra habilidades ao invés de aprender, para mim esse é um dos melhores sistemas já feitos .. e não é tão difícil usá-lo.

Screenshots:

[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]

Como usar:

Primeiro você deve inserir o script acima do main.

Configurações básicas:

Para que a loja de habilidades funcione normalmente primeiro você deverá criar um evento, clicando na 3º página com o comando "chamar script", e copiando este código:

Código:
$skill_shop =[1,2,3,6,7]
$scene = Scene_Skill_Shop.new

$skill_shop =[1,2,5] você viram os números 1,2 e 5 ali não é?
eles são a "ID" das habilidades, ou seja se eu criar uma habilidade
com ID 6 e colocar alí , ela irá aparecer na loja, mas são necessárias
algumas configurações básicas.

Configuração da loja:

a partir da linha 37, você verá isto:

Código:
1 => 150,
2 => 550,
3 => 450,
80 => 1000,
e eu vou explicar oque é..

Código:
3 => 450,
"3" é a ID da habilidade e "450" é o preço dela.

a partir da linha 46, você irá ver isto:
Código:
1 => [1,2,3,80],
2 => [1,6,7],

o "1" que apareceu alí é a ID do herói , no caso é o nosso famoso e nem tanto querido "ash"

Código:
1 =>[1,2,3,80]

esses números são as ID's das habilidades que o herói de ID "1" pode comprar,

então o "ash" pode aprender as habilidades , que eu coloquei ali.

Script:

Código:
#==============================================================================
# Loja de Habilidades v1.0
#==============================================================================
# Por Nechigawara Sanzenin , tutorial por NicholasRg
#==============================================================================
=begin
Para que a loja de habilidades funcione normalmente primeiro você
deverá criar um evento, clicando na 3º página com o comando
"chamar script", e copiando este código:
$skill_shop =[1,2,3,6,7]
$scene = Scene_Skill_Shop.new

vou ensinar como se usa ela aqui...
$skill_shop =[1,2,5] você viram os números 1,2 e 5 ali não é?
eles são a "ID" das habilidades, ou seja se eu criar uma habilidade
com ID 6 e colocar alí , ela irá aparecer na loja, mas são necessárias
algumas configurações básicas.


=end
#==============================================================================
#module SKILL_SHOP
#==============================================================================
module SKILL_SHOP
  # Learn Text
  How_Learn = "Qual pode aprender?"
  Can_Learn = "Pode Aprender"
  Cant_Learn = "Não pode"
  Learnt = "Já aprendeu"
  Teach = "Comprar Habilidade"
  Cancel = "Sair"
  # Aqui é o banco de dados dos preços
  PRICE = {
  # de Preço n º Set
  0 => 100,
  # Adicione os preços aqui.
  1 => 150,
  2 => 550,
  3 => 450,
  80 => 1000,
  # Fim
  }
  # Banco de dados do herói
  SKILL_BUY = {
  # adicione aqui oque o herói poderá aprender
  1 => [1,2,3,80],
  2 => [1,6,7], 
  # End
  }
  # Add Price
  def self.skill_price(id)
    if PRICE.include?(id)
      return PRICE[id]
    else
      return PRICE[0]
    end
  end
  # Add Hero id
  def self.skill_buy(id)
    if SKILL_BUY.include?(id)
      return SKILL_BUY[id]
    else
      return []
    end
  end
end
#==============================================================================
#class Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  def learn?(skill)
    learn = skill_learn?(skill.id)
    if learn
      return false
    else
      return true
    end
  end
end
#==============================================================================
#class Window_Skill_ShopCommand
#==============================================================================
class Window_Skill_ShopCommand < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize
    super(0, 64, 480, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    @item_max = 2
    @column_max = 2
    s1 = SKILL_SHOP::Teach
    s2 = SKILL_SHOP::Cancel
    @commands = [s1, s2]
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  def draw_item(index)
    x = 4 + index * 240
    self.contents.draw_text(x, 0, 128, 32, @commands[index])
  end
end
#==============================================================================
#class Window_Skill_ShopBuy
#==============================================================================
class Window_Skill_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize(shop_goods)
    super(0, 128, 368, 352)
    @skill_shop_goods = $skill_shop
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in [Tens de ter uma conta e sessão iniciada para poderes visualizar este link]
      skill = $data_skills[@skill_shop_goods[i]]
      if skill != nil
        @data.push(skill)
      end
    end
    # If the number of items is not 0, it draws up bit map, drawing all item
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  def draw_item(index)
    skill = @data[index]
    # Acquiring the frequency of possession of the item
    price = SKILL_SHOP.skill_price(skill.id)
    enabled = (price <= $game_party.gold)
    # If price is not below the money in hand, at the same time the frequency of possession 99, usually in letter color
    # So if is not, it sets to invalid letter color
    if enabled
      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, price.to_s, 2)
  end
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end
#==============================================================================
#class Window_Skill_ShopStatus
#==============================================================================
class Window_Skill_ShopStatus < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize
    super(368, 128, 272, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    @item = nil
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    if @item == nil
      return
    end
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, 32, SKILL_SHOP::How_Learn)
    self.contents.font.color = normal_color
    # Equipment supplementary information
    for i in 0...$game_party.actors.size
      # Acquiring the actor
      actor = $game_party.actors[i]
      can_learn = SKILL_SHOP.skill_buy(actor.id)
      id = @item.id
      enabled = (can_learn.include?(id) and actor.learn?(@item))
      # If equipment possibility if usually in letter color, the impossibility, it sets to invalid letter color
      if enabled
        self.contents.font.color = normal_color
      else
        self.contents.font.color = disabled_color
      end
      # Drawing the name of the actor
      self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
      # Check Skill
      if can_learn.include?(id) == false
        text = SKILL_SHOP::Cant_Learn
      elsif actor.learn?(@item) == false
        text = SKILL_SHOP::Learnt
      else
        text = SKILL_SHOP::Can_Learn
      end
      # Drawing the item
      self.contents.draw_text(124, 64 + 64 * i, 112, 32, text, 2)
    end
  end
  #--------------------------------------------------------------------------
  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # Cursor position as for -1 all selection, -2 below independence selection (user himself)
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, 64 + @index * 64, self.width - 32, 32)
    end
  end
end
#==============================================================================
#class Scene_Skill_Shop
#==============================================================================
class Scene_Skill_Shop
  #--------------------------------------------------------------------------
  def main
    # Drawing up the help window
    @help_window = Window_Help.new
    # Drawing up the command window
    @command_window = Window_Skill_ShopCommand.new
    # Drawing up the Goldwyn dough
    @gold_window = Window_Gold.new
    @gold_window.x = 480
    @gold_window.y = 64
    # Drawing up the dummy window
    @dummy_window = Window_Base.new(0, 128, 640, 352)
    # Drawing up the purchase window
    @buy_window = Window_Skill_ShopBuy.new($game_temp.shop_goods)
    @buy_window.active = false
    @buy_window.visible = false
    @buy_window.help_window = @help_window
    # Drawing up the status window
    @status_window = Window_Skill_ShopStatus.new
    @status_window.visible = false
    @status_window.active
    # Transition execution
    Graphics.transition
    # Main loop
    loop do
      # Renewing the game picture
      Graphics.update
      # Updating the information of input
      Input.update
      # Frame renewal
      update
      # When the picture changes, discontinuing the loop
      if $scene != self
        break
      end
    end
    # Transition preparation
    Graphics.freeze
    # Releasing the window
    @help_window.dispose
    @command_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @buy_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  def update
    # Renewing the window
    @help_window.update
    @command_window.update
    @gold_window.update
    @dummy_window.update
    @buy_window.update
    @status_window.update
    # When the command window is active,: Update_command is called
    if @command_window.active
      update_command
      return
    end
    # When the purchase window is active,: Update_buy is called
    if @buy_window.active
      update_buy
      return
    end
    # When the target window is active,: Update_target is called
    if @status_window.active
      update_target
      return
    end
  end
  #--------------------------------------------------------------------------
  def update_command
    # The B when button is pushed
    if Input.trigger?(Input::B)
      # Performing cancellation SE
      $game_system.se_play($data_system.cancel_se)
      # Change to map picture
      $scene = Scene_Map.new
      return
    end
    # When C button is pushed
    if Input.trigger?(Input::C)
      # Eliminating the help text
      @help_window.set_text("")
      # It diverges at cursor position of the command window
      case @command_window.index
      when 0  # It purchases
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # State of window to purchase mode
        @command_window.active = false
        @dummy_window.visible = false
        @buy_window.active = true
        @buy_window.visible = true
        @buy_window.refresh
        @status_window.visible = true
      when 1  # It stops
        # Performing decision SE
        $game_system.se_play($data_system.decision_se)
        # Change to map picture
        $scene = Scene_Map.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  def update_buy
    # Setting the item of the status window
    @status_window.item = @buy_window.skill
    # The B when button is pushed
    if Input.trigger?(Input::B)
      # Performing cancellation SE
      $game_system.se_play($data_system.cancel_se)
      # State of window to early mode
      @command_window.active = true
      @dummy_window.visible = true
      @buy_window.active = false
      @buy_window.visible = false
      @status_window.visible = false
      @status_window.item = nil
      # Eliminating the help text
      @help_window.set_text("")
      return
    end
    # When C button is pushed
    if Input.trigger?(Input::C)
      # Acquiring the item
      @item = @buy_window.skill
      @price = SKILL_SHOP.skill_price(@item.id)
      enabled = (@price <= $game_party.gold)
      # When the item is invalid, or when price it is on from the money in hand
      unless  enabled
        # Performing buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Performing decision SE
      $game_system.se_play($data_system.decision_se)
      @buy_window.active = false
      @status_window.active = true
      @status_window.index = 0
    end
  end
  #--------------------------------------------------------------------------
  def update_target
    # The B when button is pushed
    if Input.trigger?(Input::B)
      # Performing cancellation SE
      $game_system.se_play($data_system.cancel_se)
      # Eliminating the target window
      @buy_window.active = true
      @status_window.index =- 1
      @status_window.active = false
      return
    end
    # When C button is pushed
    if Input.trigger?(Input::C)
      @actor = $game_party.actors[@status_window.index]
      can_learn = SKILL_SHOP.skill_buy(@actor.id)
      id = @item.id
      enabled = (can_learn.include?(id) and @actor.learn?(@item))
      # When with SP and so on is cut off and it becomes not be able to use
      unless enabled
        # Performing buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Performing shop SE
      $game_system.se_play($data_system.shop_se)
      @actor.learn_skill(@item.id)
      $game_party.lose_gold(@price)
      @buy_window.refresh
      @gold_window.refresh
      @status_window.refresh
      @buy_window.active = true
      @status_window.index =- 1
      @status_window.active = false
    end
  end
end

Créditos:

Nechigawara Sanzenin por fazer esse script.
NicholasRg por fazer o tutorial e traduzir.

https://arenarpgmaker.forumeiros.com

2Loja de Habilidades Empty Re: Loja de Habilidades Seg 29 Out 2012, 10:37

Halt

Halt
Administrador
Administrador
Não sei pra que um script pra isso se pode fazer por eventos + banco de dados, só criar o item da skill com o evento comum de aprender a skill e depois criar um NPC com inserir loja vendendo os itens da skill x.x

https://arenarpgmaker.forumeiros.com

Ver o tópico anterior Ver o tópico seguinte Ir para o topo  Mensagem [Página 1 de 1]

Permissões neste sub-fórum
Não podes responder a tópicos