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?
Sistema de Banco Vx EmptyQui 25 Nov 2021, 14:04 por Halt

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

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

» Tileset Converter to MV
Sistema de Banco Vx EmptySex 12 maio 2017, 14:07 por Douggi

» Pack Resources, Sprites e etc
Sistema de Banco Vx EmptyQua 23 Dez 2015, 12:30 por raydengv

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

» Fantasy Art Online
Sistema de Banco Vx EmptyDom 18 Out 2015, 18:42 por daviih123

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

» O Barato é louco
Sistema de Banco Vx EmptySáb 27 Jun 2015, 16:26 por Halt

» Download RPG Maker 2000 + RTP em português
Sistema de Banco Vx 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]

1Sistema de Banco Vx Empty Sistema de Banco Vx Qui 03 Jan 2013, 17:53

-Dark

-Dark
Sub Admnistrador
Sub Admnistrador
SCRIPT DE BANCO
Maker utilizado: RMVX
[versão 1.0]

Descrição
Esse script adiciona a opção de criar um banco para depositar e retirar dinheiro.

Funções
Depositar e retirar dinheiro...

Instruções
Copie e cole o script acima do main. Para chamar crie um evento e digite o seguinte código na opção chamar scripts : $scene = Scene_Depository.new

Download

Download aqui

Script

Código:
# --------------------------------------------------------------------------------------
# Script de Banco para RMVX hecho por RayRpg 
# tomando como base script de banco de KGC
# para RMXP
# para llamar script:$scene = Scene_Depository.new
#--------------------------------------------------------------------------------------

class Window_DepositoryCommand < Window_Selectable

# Nombre de los comandos

DEPOSITORY_COMMAND = [

  "Depositar",      # depósito ouro

  "Retirar",    # retirar ouro

]

# Defina los comandos

DEPOSITORY_HELP = [

  "Depositar ",  # Depositar oro

  "Retirar ",    # Retirarlo

]

end

class Window_DepositoryGold < Window_Base

# Numero de 0 maximos

GOLD_DIGITS = 7

end


class Scene_Depository

DEPOSIT_GOLD = "Insira a quantidade que será depositada"

WDEPOSIT_GOLD = "Insira a quantidade que será retirada"

end

#--------------------------------------------------------------------------

def call_depository

$game_player.straighten

$scene = Scene_Depository.new

end

#--------------------------------------------------------------------------------------
# Class Game_Party
#-------------------------------------------------------------------------------------

class Game_Party

alias initialize_Ray_Depository initialize

def initialize

  initialize_Ray_Depository

  @deposit_gold = 0

end

#--------------------------------------------------------------------------
# informacion de oro
#--------------------------------------------------------------------------

def deposit_gold

  @deposit_gold = 0 if @deposit_gold == nil

  return @deposit_gold

end

#--------------------------------------------------------------------------

# Recupere informacion del oro

#--------------------------------------------------------------------------

def gain_deposit_gold(number)

  @deposit_gold = 0 if @deposit_gold == nil

  @deposit_gold += number

end

def lose_deposit_gold(number)

  self.gain_deposit_gold(-number)

end
end


#---------------------------------------------------------------------------------
#  Window_DepositoryCommand
#---------------------------------------------------------------------------------


class Window_DepositoryCommand < Window_Selectable

def initialize

  super(0, 64, 545, 60)

  self.contents = Bitmap.new(width - 32, height - 32)

  @commands = DEPOSITORY_COMMAND

  @item_max = @commands.size

  @column_max = @commands.size

    @item_width = (width - 32) / @commands.size
 
    self.back_opacity = 160

  self.index = 0

  refresh

end

#--------------------------------------------------------------------------
# Actulizacion
#--------------------------------------------------------------------------

def refresh

  for i in [Tens de ter uma conta e sessão iniciada para poderes visualizar este link]

    rect = Rect.new(@item_width * i, 0, @item_width, 32)

    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

    self.contents.font.color = system_color

    self.contents.draw_text(rect, @commands[i], 1)

  end

end

#-------------------------------------------------------------------------------- 
# Cursor
#---------------------------------------------------------------------------------

def update_cursor_rect

  if index != -1

    self.cursor_rect.set(@item_width * index, 0, @item_width, 32)

  end

end

def update_help

  @help_window.set_text(DEPOSITORY_HELP[self.index])

end

end

#--------------------------------------------------------------------------------
#  Window_DepositoryGold
#---------------------------------------------------------------------------------


class Window_DepositoryGold < Window_Base

def initialize

  super(0, 128, 545, 285)

  @digits_max = GOLD_DIGITS

  dummy_bitmap = Bitmap.new(32, 32)

  @cursor_width = dummy_bitmap.text_size("0").width + 8

  dummy_bitmap.dispose

  self.contents = Bitmap.new(width - 32, height - 32)

  self.back_opacity = 160

  self.active = false

  self.visible = false

  @cursor_position = 0

  @max = 0

  @price = 0

  @index = 0

end

def price

  return @price

end

def price=(np)

  @price = [[np, 0].max, @max].min

  redraw_price

end

def reset(type)

  @price = 0

  @index = @digits_max - 1

  refresh(type)

end

def refresh(type)

  self.contents.clear

  domination = $game_party.gold

  cx = contents.text_size(domination).width

  @cursor_position = 332 - cx - @cursor_width * @digits_max

  self.contents.font.color = system_color

  self.contents.draw_text(0, 0, 608, 32, "Dinheiro que possui:")

  self.contents.draw_text(0, 64, 608, 32, "Depósito:")

  if type == 0

    self.contents.draw_text(0, 128, 608, 32, "Quantidade:")

    @max = $game_party.gold

  else

    self.contents.draw_text(0, 128, 608, 32, "Retirada:")

    @max = [10 ** @digits_max - $game_party.gold - 1, $game_party.deposit_gold].min

  end

  self.contents.font.color = normal_color

  self.contents.draw_text(4, 32, 326 - cx, 32, $game_party.gold.to_s, 2)

  self.contents.font.color = system_color

  self.contents.draw_text(332 - cx, 32, cx, 32, domination, 2)

  self.contents.font.color = normal_color

  self.contents.draw_text(4, 96, 326 - cx, 32, $game_party.deposit_gold.to_s, 2)

  self.contents.font.color = system_color

  self.contents.draw_text(332 - cx, 96, cx, 32, domination, 2)

  redraw_price

end

def redraw_price

  domination = $game_party.gold

  cx = contents.text_size(domination).width

  self.contents.fill_rect(0, 160, 608, 32, Color.new(0, 0, 0, 0))

  self.contents.font.color = normal_color

  text = sprintf("%0#{@digits_max}d", self.price)

  for i in 0...text.length

    x = @cursor_position + (i - 1) * @cursor_width

    self.contents.draw_text(x, 160, 32, 32, text[i, 1], 2)

  end

  self.contents.font.color = system_color

  self.contents.draw_text(332 - cx, 160, cx, 32, domination, 2)

end

#--------------------------------------------------------------------------
# Actualizacion del cursor
#--------------------------------------------------------------------------

def update_cursor_rect

  x = @cursor_position + @index * @cursor_width

  self.cursor_rect.set(x, 160, @cursor_width, 32)

end

def update

  super

  return unless self.active

  if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)

    Sound.play_decision
    place = 10 ** (@digits_max - 1 - @index)

    n = self.price / place % 10

    self.price -= n * place

    n = (n + 1) % 10 if Input.repeat?(Input::UP)

    n = (n + 9) % 10 if Input.repeat?(Input::DOWN)

    self.price += n * place

  end

  if Input.repeat?(Input::RIGHT)

    if @digits_max >= 2

      Sound.play_decision     
      @index = (@index + 1) % @digits_max

    end

  end

  if Input.repeat?(Input::LEFT)

    if @digits_max >= 2

      Sound.play_decision
      @index = (@index + @digits_max - 1) % @digits_max

    end

  end

  update_cursor_rect

end

end

def item

  return @data[self.index]

end

#--------------------------------------------------------------------------------
#  Window_DepositoryNumber
#-------------------------------------------------------------------------------

class Window_DepositoryNumber < Window_Base

def initialize

  @digits_max = 2

  @number = 0

  dummy_bitmap = Bitmap.new(32, 32)

  @cursor_width = dummy_bitmap.text_size("0").width + 8

  dummy_bitmap.dispose

  @default_size = @cursor_width * @digits_max + 32

  super(0, 0, @default_size, 128)

  self.contents = Bitmap.new(width - 32, height - 32)

  self.z = 1000

  self.back_opacity = 160

  self.active = false

  self.visible = false

  @index = 0

  @item = nil

  refresh

  update_cursor_rect

end

#-------------------------------------------------------------------------
# Actualizacion del cursor
#--------------------------------------------------------------------------

def update_cursor_rect

  self.cursor_rect.set(@index * @cursor_width, 32, @cursor_width, 32)

end

def refresh

  self.contents.fill_rect(0, 32, width - 32, 32, Color.new(0, 0, 0, 0))

  self.contents.font.color = normal_color

  s = sprintf("%0*d", @digits_max, @number)

  for i in 0...@digits_max

    self.contents.draw_text(i * @cursor_width + 4, 32, 32, 32, s[i,1])

  end

end

def set_text(string = " ")

  self.resize(self.contents.text_size(string).width + 40)

  self.contents.fill_rect(0, 0, width - 32, 32, Color.new(0, 0, 0, 0))

  self.contents.font.color = normal_color

  self.contents.draw_text(0, 0, width - 32, 32, string, 1)

  refresh

  centering

end

def resize(nw)

  self.width = nw

  buf = self.contents.dup

  self.contents.dispose

  self.contents = Bitmap.new(nw - 32, 96)

  self.contents.blt(0, 0, buf, buf.rect)

  buf.dispose

end

#-------------------------------------------------------------------------
# Movimiento central
#--------------------------------------------------------------------------

def centering

  self.x = 320 - self.width / 2

  self.y = 240 - self.height / 2

end

#-------------------------------------------------------------------------
# Actualizacion
#--------------------------------------------------------------------------

def update

  super

  return unless self.active

  if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)

    $game_system.se_play($data_system.cursor_se)

    place = 10 ** (@digits_max - 1 - @index)

    n = self.number / place % 10

    self.number -= n * place

    n = (n + 1) % 10 if Input.repeat?(Input::UP)

    n = (n + 9) % 10 if Input.repeat?(Input::DOWN)

    self.number += n * place

    refresh

  end

  if Input.repeat?(Input::RIGHT)

    if @digits_max >= 2

      $game_system.se_play($data_system.cursor_se)

      @index = (@index + 1) % @digits_max

    end

  end

  if Input.repeat?(Input::LEFT)

    if @digits_max >= 2

        Sound.play_decision

      @index = (@index + @digits_max - 1) % @digits_max

    end

  end

  update_cursor_rect

end

end

#---------------------------------------------------------------------------------
#  Scene_Depository
#---------------------------------------------------------------------------------

class Scene_Depository

def main

  @spriteset = Spriteset_Map.new

  @dummy_window = Window_Base.new(0, 60, 545, 352)

  @help_window = Window_Help.new

  @dummy_window.back_opacity = 160

  @help_window.back_opacity = 160

  @command_window = Window_DepositoryCommand.new

  @gold_window = Window_DepositoryGold.new

  @number_window = Window_DepositoryNumber.new

  @command_window.help_window = @help_window

  Graphics.transition

  loop do

    Graphics.update

    Input.update

    update

    if $scene != self

      break

    end

  end

  Graphics.freeze

  @spriteset.dispose

  @dummy_window.dispose

  @help_window.dispose

  @command_window.dispose

  @gold_window.dispose

  @number_window.dispose

end

#------------------------------------------------------------------------
# Actualizacion
#--------------------------------------------------------------------------

def update

  @dummy_window.update

  @help_window.update

  @command_window.update

  @gold_window.update

  @number_window.update

  if @command_window.active

    update_command

    return

  end

  if @gold_window.active

    update_gold

    return

  end

  if @number_window.active

    update_number

    return

  end

end

def update_command

  if Input.trigger?(Input::B)

  Sound.play_decision

    $scene = Scene_Map.new

    return

  end

  if Input.trigger?(Input::C)

    Sound.play_decision
    case @command_window.index

    when 0

      @gold_window.active = true

      @gold_window.visible = true

      @gold_window.reset(0)

      @help_window.set_text(DEPOSIT_GOLD)

    when 1

      @gold_window.active = true

      @gold_window.visible = true

      @gold_window.reset(1)

      @help_window.set_text(WDEPOSIT_GOLD)

    when 2

      @item_window.active = true

      @item_window.visible = true

      @item_window.refresh(0)

    when 3

      @item_window.active = true

      @item_window.visible = true

      @item_window.refresh(1)

    end

    @command_window.active = false

    @dummy_window.visible = false

    return

  end

end

def update_gold

  if Input.trigger?(Input::B)

    Sound.play_decision

    @command_window.active = true

    @gold_window.active = false

    @gold_window.visible = false

    @dummy_window.visible = true

    return

  end

  if Input.trigger?(Input::C)

    price = @gold_window.price

    if price == 0

      Sound.play_decision
      @command_window.active = true

      @gold_window.active = false

      @gold_window.visible = false

      @dummy_window.visible = true

      return

    end

    Sound.play_decision
    case @command_window.index

    when 0

      $game_party.lose_gold(price)

      $game_party.gain_deposit_gold(price)

    when 1

      $game_party.gain_gold(price)

      $game_party.lose_deposit_gold(price)

    end

    @gold_window.reset(@command_window.index)

    return

  end

end

def update_number

  if Input.trigger?(Input::B)

  Sound.play_decision

    @number_window.active = false

    @number_window.visible = false

    return

  end

    @number_window.active = false

    @number_window.visible = false

    return

  end

end
Creditos a
RayRPG (por criar)
Yoshi (por traduzir pro português e criar a demo)

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