Rpg˛S Forum uses cookies. Read the Privacy Policy for more info. To remove this message, please click the button to the right:    I accept the use of cookies

Vai al contenuto

Rpg˛S Forum uses cookies. Read the Privacy Policy for more info. To remove this message, please click the button to the right:    I accept the use of cookies

Screen Contest #90

Kamikun






  • Si prega di effettuare il log in prima di rispondere
script banca

    harry1447
  • Nuovo Arrivato

  • Utenti
  • Rens: 0
  • 0
  • Stelletta
  • 33 messaggi

#1 Inviato 08 September 2012 - 12:53 PM

ciao, vorrei (se esiste) uno script per creare una banca

    NoxChibi
  • Utente occasionale

  • Utenti
  • Rens: 0
  • 0
  • StellettaStelletta
  • 164 messaggi
  • Sesso:Maschio
  • Provenienza:NAPOLI
  • Abilitā:Novizio

#2 Inviato 16 September 2012 - 16:18 PM

#==============================================================================
# Vampyr Warehouse
#==============================================================================
class Game_Party < Game_Unit
  
  alias vampyr_warehouse_initialize initialize
  
  attr_reader :wgold
  
  def initialize
    vampyr_warehouse_initialize
    @witems = {}
    @wweapons = {}
    @warmors = {}
    @wgold = 0
  end
  
  def witems
    result = []
    for i in @witems.keys.sort
      result.push($data_items[i]) if @witems[i] > 0
    end
    for i in @wweapons.keys.sort
      result.push($data_weapons[i]) if @wweapons[i] > 0
    end
    for i in @warmors.keys.sort
      result.push($data_armors[i]) if @warmors[i] > 0
    end
    return result
  end
  
  def store_gold(n)
    @wgold = [[@wgold + n, 0].max, 9999999].min
  end

  def withdraw_gold(n)
    store_gold(-n)
  end
  
  def witem_number(item)
    case item
    when RPG::Item
      number = @witems[item.id]
    when RPG::Weapon
      number = @wweapons[item.id]
    when RPG::Armor
      number = @warmors[item.id]
    end
    return number == nil ? 0 : number
  end
  
  def store_item(item, n)
    number = witem_number(item)
    case item
    when RPG::Item
      @witems[item.id] = [[number + n, 0].max, 99].min
    when RPG::Weapon
      @wweapons[item.id] = [[number + n, 0].max, 99].min
    when RPG::Armor
      @warmors[item.id] = [[number + n, 0].max, 99].min
    end
    n += number
  end

  def withdraw_item(item, n)
    store_item(item, -n)
  end
  
end

#------------------------------------------------------------------------------
class Window_Warehouse < Window_Selectable
  
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 2
    self.index = 0
    refresh
  end
  
  def item
    return @data[self.index]
  end
  
  def refresh
    @data = []
    $game_party.witems.each { |i| @data.push(i) }
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      number = $game_party.witem_number(item)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y)
      self.contents.draw_text(rect, sprintf(":%2d", number), 2)
    end
  end
  
  def update_help
    if $scene.is_a?(Scene_VampyrWarehouse) and $scene.description_delay > 0
      @help_window.set_text("Item Retirado!")
    else
      @help_window.set_text(item == nil ? "" : item.description)
    end
  end
  
end

#------------------------------------------------------------------------------
class Window_Item < Window_Selectable
  
  def update_help
    if $scene.is_a?(Scene_VampyrWarehouse) and $scene.description_delay > 0
      @help_window.set_text("Item Depositado!")
    else
      @help_window.set_text(item == nil ? "" : item.description)
    end
  end
  
end

#------------------------------------------------------------------------------
class Window_MyGold < Window_Base
  
  def initialize
    super(0, 0, 256, 56)
    refresh
  end
  
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(contents.rect, "Meu #{Vocab.gold}:")
    self.contents.font.color = normal_color
    self.contents.draw_text(contents.rect, $game_party.gold, 2)
  end
  
end

#------------------------------------------------------------------------------
class Window_WareGold < Window_Base
  
  def initialize
    super(0, 0, 256, 56)
    refresh
  end
  
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(contents.rect, "#{Vocab.gold} do Baú:")
    self.contents.font.color = normal_color
    self.contents.draw_text(contents.rect, $game_party.wgold, 2)
  end
  
end

#------------------------------------------------------------------------------
class Window_TypeGold < Window_Command
  
  attr_reader :value
  attr_reader :commands
  
  def initialize
    super(256, ["0", "0", "0", "0", "0", "0", "0"], 7, 0, 0)
    @index = 6
  end
  
  def reset
    for i in [email protected]
      @commands[i] = "0"
    end
    refresh
  end
  
  def update
    super
    value = @commands[@index].to_i
    if Input.press?(Input::UP) and Graphics.frame_count % 7 <= 0
      Sound.play_cursor
      @commands[@index] = (value < 9 ? value+1 : 9).to_s
      refresh
    elsif Input.press?(Input::DOWN) and Graphics.frame_count % 7 <= 0
      Sound.play_cursor
      @commands[@index] = (value > 0 ? value-1 : 0).to_s
      refresh
    end
  end
  
end

#------------------------------------------------------------------------------
class Scene_VampyrWarehouse < Scene_Base
  
  attr_reader :description_delay
  
  def start
    super
    create_menu_background
    @description_delay = 0
    @store_gold = false
    @withdraw_gold = false
    s1 = "Depositar Itens "
    s2 = "Retirar Itens"
    s3 = "Depositar Dinheiro"
    s4 = "Retirar Dinheiro"
    s5 = "Cancelar"
    @command_window = Window_Command.new(208, [s1, s2, s3, s4, s5])
    @command_window.x = (544-@command_window.width)/2
    @command_window.y = (416-@command_window.height)/2
    @command_window.visible = @command_window.active = true
    @help_window = Window_Help.new
    @help_window.visible = @help_window.active = false
    @item_window = Window_Item.new(0, 56, 544, 360)
    @item_window.help_window = @help_window
    @item_window.visible = @item_window.active = false
    @warehouse_window = Window_Warehouse.new(0, 56, 544, 360)
    @warehouse_window.help_window = @help_window
    @warehouse_window.visible = @warehouse_window.active = false
    @typegold_window = Window_TypeGold.new
    @typegold_window.x = (544-@typegold_window.width)/2
    @typegold_window.y = ((416-@typegold_window.height)/2)
    @typegold_window.visible = @typegold_window.active = false
    @mygold_window = Window_MyGold.new
    @mygold_window.visible = @mygold_window.active = false
    @mygold_window.x = (544-@mygold_window.width)/2
    @mygold_window.y = ((416-@mygold_window.height)/2)-56
    @waregold_window = Window_WareGold.new
    @waregold_window.visible = @waregold_window.active = false
    @waregold_window.x = (544-@waregold_window.width)/2
    @waregold_window.y = ((416-@waregold_window.height)/2)+56
  end
  
  def update
    super
    update_menu_background
    @description_delay -= 1 if @description_delay > 0
    @command_window.update
    @item_window.update
    @warehouse_window.update
    @help_window.update
    @mygold_window.update
    @waregold_window.update
    @typegold_window.update if @typegold_window.active
    if @command_window.active
      update_selection
    elsif @item_window.active
      update_store
    elsif @warehouse_window.active
      update_whitedraw
    elsif @typegold_window.active and @store_gold
      update_store_gold
    elsif @typegold_window.active and @withdraw_gold
      update_whitdraw_gold
    end
  end
  
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @item_window.dispose
    @warehouse_window.dispose
    @help_window.dispose
    @typegold_window.dispose
    @mygold_window.dispose
    @waregold_window.dispose
  end
  
  def update_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      @command_window.visible = @command_window.active = false
      case @command_window.index
      when 0
        @item_window.visible = @item_window.active = true
        @help_window.visible = @help_window.active = true
        @warehouse_window.visible = @warehouse_window.active = false
      when 1
        @item_window.visible = @item_window.active = false
        @help_window.visible = @help_window.active = true
        @warehouse_window.visible = @warehouse_window.active = true
      when 2
        @store_gold = true
        @withdraw_gold = false
        @typegold_window.visible = @typegold_window.active = true
        @mygold_window.visible = @mygold_window.active = true
        @waregold_window.visible = @waregold_window.active = true
      when 3
        @store_gold = false
        @withdraw_gold = true
        @typegold_window.visible = @typegold_window.active = true
        @mygold_window.visible = @mygold_window.active = true
        @waregold_window.visible = @waregold_window.active = true
      when 4
        $scene = Scene_Map.new
      end
    end
  end
  
  def update_store
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @item_window.visible = @item_window.active = false
      @help_window.visible = @help_window.active = false
      @command_window.visible = @command_window.active = true
    elsif Input.trigger?(Input::C)
      if @item_window.item == nil
        Sound.play_buzzer
      elsif @item_window.item.note.include?("Dont't Store")
        Sound.play_buzzer
      else
        Sound.play_decision
        $game_party.lose_item(@item_window.item, 1)
        $game_party.store_item(@item_window.item, 1)
        @item_window.refresh
        @warehouse_window.refresh
        @description_delay = 90
      end
    end
  end
  
  def update_whitedraw
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @warehouse_window.visible = @warehouse_window.active = false
      @help_window.visible = @help_window.active = false
      @command_window.visible = @command_window.active = true
    elsif Input.trigger?(Input::C)
      if @warehouse_window.item == nil
        Sound.play_buzzer
      else
        Sound.play_decision
        $game_party.gain_item(@warehouse_window.item, 1)
        $game_party.withdraw_item(@warehouse_window.item, 1)
        @item_window.refresh
        @warehouse_window.refresh
        @description_delay = 90
      end
    end
  end
  
  def update_store_gold
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @typegold_window.visible = @typegold_window.active = false
      @typegold_window.reset
      @mygold_window.visible = @mygold_window.active = false
      @waregold_window.visible = @waregold_window.active = false
      @command_window.visible = @command_window.active = true
    elsif Input.trigger?(Input::C)
      return if @typegold_window.commands.to_s.to_i <= 0
      if $game_party.gold < @typegold_window.commands.to_s.to_i
        Sound.play_buzzer
      else
        Sound.play_shop
        $game_party.lose_gold(@typegold_window.commands.to_s.to_i)
        $game_party.store_gold(@typegold_window.commands.to_s.to_i)
        @mygold_window.refresh
        @waregold_window.refresh
      end
    end
  end
  
  def update_whitdraw_gold
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @typegold_window.visible = @typegold_window.active = false
      @typegold_window.reset
      @mygold_window.visible = @mygold_window.active = false
      @waregold_window.visible = @waregold_window.active = false
      @command_window.visible = @command_window.active = true
    elsif Input.trigger?(Input::C)
      return if @typegold_window.commands.to_s.to_i <= 0
      if $game_party.wgold < @typegold_window.commands.to_s.to_i
        Sound.play_buzzer
      else
        Sound.play_shop
        $game_party.withdraw_gold(@typegold_window.commands.to_s.to_i)
        $game_party.gain_gold(@typegold_window.commands.to_s.to_i)
        @mygold_window.refresh
        @waregold_window.refresh
      end
    end
  end
  
end
banca e deposito

    SiSteP
  • Nuovo Arrivato

  • Utenti
  • Rens: 0
  • 0
  • Stelletta
  • 88 messaggi
  • Sesso:Maschio
  • Provenienza:Milano
  • Abilitā:Adepto

#3 Inviato 31 October 2012 - 16:37 PM

E lo script per chiamarlo?

 

TUTORIAL

 

 

FACEBOOK

 

 

PROGETTO IN CORSO

Spoiler

    Guardian of Irael
  • Coniglietto Rosso

  • Rpg˛S Admin
  • Rens: 195
  • 19
  • StellettaStellettaStellettaStellettaStellettaStelletta
  • 58413 messaggi
  • Sesso:Maschio
  • Provenienza:Bagnaia (Viterbo)
  • Abilitā:Apprendista


#4 Inviato 31 October 2012 - 20:13 PM

Dovrebbe andare questo

$scene=Scene_VampyrWarehouse.new

^ ^

(\_/)
(^ ^) <----coniglietto rosso, me!     
(> <)

 
Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^
 
KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^
 
FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^  
 
REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^

Spoiler


    SiSteP
  • Nuovo Arrivato

  • Utenti
  • Rens: 0
  • 0
  • Stelletta
  • 88 messaggi
  • Sesso:Maschio
  • Provenienza:Milano
  • Abilitā:Adepto

#5 Inviato 31 October 2012 - 22:15 PM

Perfetto... Grazie mille! :)

 

TUTORIAL

 

 

FACEBOOK

 

 

PROGETTO IN CORSO

Spoiler




  • Feed RSS