collapse collapse

 Community


 User Info




Willkommen Gast. Bitte einloggen oder registrieren.

 Partnerseiten

rpgvx.net

Das Forum ist offline

Autor Thema: (Tech) Itemlager-Script  (Gelesen 928 mal)

Offline Marcy

  • Event-Jongleur
  • **
  • Beiträge: 68
(Tech) Itemlager-Script
« am: August 18, 2009, 23:03:18 »
Hi ^^

Habe folgendes Problem:

Ich möchte gerne in meinem Projekt ein Itemlager-Event erstellen.
Dazu habe ich das Shopoholic-Script so verändert das im Bankevent
jetzt nur noch das Itemlager-Menü vorhanden ist. Soweit so gut.
Aber sobald ich das gewünschte Item in das Lager verschoben habe,
"friert" das Bild so zu sagen ein. Ich komme auch nicht mit "ESC" zurück auf die Map.

Ich bin zwar nicht sonderlich gut im Scripten, habe aber stark den Verdacht ich
müsste hier, im Script "Scene_Bank" nach der Zeile "@item_window.refresh" irgendeinen Befehl geben, dass sich
"@command_window.active" auf "true" setzt.

Spoiler for Hiden:
# Checks the command window for input when it is active
  #-----------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
    when 0  # vault
        if not @hasVault
          Sound.play_buzzer
        else
          Sound.play_decision
          @command_window.active  = false
          @dummy_window.visible   = false
          @vault_window.active    = true
          @vault_window.visible   = true
          @item_window.visible    = true
          @vault_window.refresh
          @item_window.refresh   
       end
      when 1  # cancel
        Sound.play_decision
        $scene = Scene_Map.new
      end
    end

Weiß aber nicht genau wie. Denn man müsste ja noch irgendwie sagen, dass das erst
nach dem Verschieben des Items geschehen soll.

Wenn jemand alle Scripte benötigt, die findet ihr hier:
http://www.rpgrevolution.com/forums/index.php?showtopic=14016

Lg, Marcy

EDIT:

Okay, hab das Problem gelöst. Thread kann geschlossen werden ;)

Sollte jemand, so wie ich, auch nur ein Itemlager-System brauchen muss er
"Scene_Bank" mit dem hier ersetzten.

Spoiler for Hiden:
#-------------------------------------------------------------------------------
#                                                                 page 12 of 12
#                                Shopoholic v 2.0
#                                code by cmpsr2000
#                  available exclusively @ rpgrevolution.com/forums
#                              Released June 25, 2008
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# ** Scene_Bank
#-------------------------------------------------------------------------------
#  This class performs the bank screen processing.
#-------------------------------------------------------------------------------
class Scene_Bank < Scene_Base
  #-----------------------------------------------------------------------------
  # Creates the banking scene.
  #   bankID:     The ID of the bank to be shown. (you can show the same bank
  #               In various events throughout your game, just as you can with
  #               shops. This way, you can have 1 bank for your entire game
  #               if you chose)
  #   rates:      An array of interest rates: [savings, checking, loan]
  #                 savings:  interest rate for savings accounts at this
  #                           instance of this bank.
  #                 checking: interest rate for checking accounts at this
  #                           instance of this bank.
  #                 loan:     interest rate for checking accounts at this
  #                           instance of this bank.
  #                 NOTE: If you have more than one event per bankID you can
  #                 set different interest rates at each one! (sort of like
  #                 branches of a real bank)
  #   slotCost:   Cost for each new Saftey Deposit Box in the vault
  #   loanMax:    The max amount the bank will issue in a single loan. This
  #               overrides the global setting for max loan if it is lower.
  #   hasVault    Boolean indicating whether or not this instance of this bank
  #               has a vault. Again if you have multiple events for a bankID
  #               Then you can enable the vault in some while disabling it in
  #               others and the players items will persist.
  #-----------------------------------------------------------------------------
  def initialize(bankID, rates, slotCost, loanMax = 9999999, hasVault = true)
    @bankID   = bankID
    @xfer     = false
    @rates    = rates #interest rates array: [savings, checking, loan]
    @slotCost = slotCost
    @hasVault = hasVault
    @loanMax  = loanMax
    $game_banking.setRates(@bankID, @rates)
    $game_banking.calcInterest(@bankID)
  end
  #-----------------------------------------------------------------------------
  # Uhhh.....ends the banking scene :)
  #-----------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @accountCmd_window.dispose
    @help_window.dispose
    @gold_window.dispose
    @dummy_window.dispose
    @account_window.dispose
    @vault_window.dispose
    @item_window.dispose
    @number_window.dispose
  end
  #-----------------------------------------------------------------------------
  # Creates the windows and sets up the starting positions and attributes
  #-----------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    create_accountCmd_window
    @help_window    = Window_Help.new
    @gold_window    = Window_Gold.new(384, 56)
    @dummy_window   = Window_Base.new(0, 112, 544, 304)
    @account_window = Window_Bank_Account.new(0, 112, @bankID)
    @vault_window   = Window_Bank_Vault.new(0, 112, @bankID)
    @number_window  = Window_Bank_Number.new(0, 112)
    @item_window    = Window_Item.new(304, 112, 240, 304)
    @account_window.active            = false
    @account_window.visible           = false
    @account_window.help_window       = @help_window
    @account_window.accountCmd_window = @accountCmd_window
    @account_window.refresh
    @vault_window.active              = false
    @vault_window.visible             = false
    @vault_window.help_window         = @help_window
    @number_window.active             = false
    @number_window.visible            = false
    @item_window.column_max           = 1
    @item_window.active               = false
    @item_window.visible              = false
    @dummy_window.active              = false
    @dummy_window.visible             = true
    @accountCmd_window.active         = false
    @accountCmd_window.visible        = false
    @accountCmd_window.z              = 101
  end
  #-----------------------------------------------------------------------------
  # Builds the main command window
  #-----------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::BankVault
    s2 = Vocab::BankCancel
    @command_window = Window_Command.new(384, [s1, s2 ], 2)
    @command_window.y = 56
    if not @hasVault
      @command_window.draw_item(1, false)
    end
  end
  #-----------------------------------------------------------------------------
  # Builds the account command window
  #-----------------------------------------------------------------------------
  def create_accountCmd_window
    s1 = Vocab::BankDeposit
    s2 = Vocab::BankWithdraw
    s3 = Vocab::BankTransfer
    @accountCmd_window = Window_Command.new(384, [s1, s2, s3], 3)
    @accountCmd_window.x = 80
    @accountCmd_window.y = 212
  end
  #-----------------------------------------------------------------------------
  # Updates the windows and checks for input depending on the active window
  #-----------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @help_window.update
    @command_window.update
    @accountCmd_window.update
    @gold_window.update
    @dummy_window.update
    @account_window.update
    @vault_window.update
    @item_window.update
    @number_window.update
    if @command_window.active
      update_command_selection
    elsif @account_window.active
      update_account_selection
    elsif @vault_window.active
      update_vault_selection
    elsif @item_window.active
      update_item_selection
    elsif @number_window.active
      update_number_input
    elsif @accountCmd_window.active
      update_accountCmd_selection
    end
  end
  #-----------------------------------------------------------------------------
  # Checks the command window for input when it is active
  #-----------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      case @command_window.index
      when 0  # vault
         if not @hasVault
          Sound.play_buzzer
          Sound.play_decision
        else
          @command_window.active  = false
          @dummy_window.visible   = false
          @vault_window.active    = true
          @vault_window.visible   = true
          @item_window.visible    = true
          @vault_window.refresh
          @item_window.refresh
      end
        when 1  # cancel
        Sound.play_decision
        $scene = Scene_Map.new
      end
      end
  end
  #-----------------------------------------------------------------------------
  # Brigns the number window to the front with the correct layout
  #-----------------------------------------------------------------------------
  def callNumberWindow(max)
    @account_window.active      = false
    @account_window.visible     = false
    @accountCmd_window.active   = false
    @accountCmd_window.visible  = false
    @item_window.visible        = false
    @item_window.active         = false
    @vault_window.visible       = false
    @vault_window.active        = false
    @number_window.set(max, @action, @account, @xferAccount, @item, @slotCost)
    @number_window.active       = true
    @number_window.visible      = true
  end
  #-----------------------------------------------------------------------------
  # Checks the vault window for input when it is active
  #-----------------------------------------------------------------------------       
  def update_vault_selection
     if Input.trigger?(Input::B)
        Sound.play_cancel
     if @storing
        @storing = false
      else
        @command_window.active = true
        @dummy_window.visible = true
        @vault_window.active = false
        @vault_window.visible = false
        @item_window.visible = false
      end
      @help_window.set_text("")
 elsif Input.trigger?(Input::C)
      @slot = @vault_window.slot
      if @slot != nil and @slot.item != nil
        Sound.play_decision
        @slot.takeItem
        @vault_window.refresh
        @item_window.refresh
      else
        if @vault_window.index == @vault_window.item_max - 1
          max = $game_banking.closedVaultSlots(@bankID)
          @action = 4 #buy slots
          callNumberWindow(max)
        elsif @slot == nil or @slot.locked
          Sound.play_buzzer
        else
          Sound.play_decision
          @storing              = true
          @item_window.active   = true
          @vault_window.active  = false
        end
      end
    end
  end
  #-----------------------------------------------------------------------------
  # Checks the item window for input when it is active
  #-----------------------------------------------------------------------------
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @storing = false
      @item_window.active = false
      @vault_window.active = true
    elsif Input.trigger?(Input::C)
      @item = @item_window.item
      max = $game_party.item_number(@item)
      @action = 5 #how many to transfer
      callNumberWindow(max)
    end
  end
  #-----------------------------------------------------------------------------
  # Checks the number window for input when it is active
  #-----------------------------------------------------------------------------
  def update_number_input
    if Input.trigger?(Input::B)
      cancel_number_input
    elsif Input.trigger?(Input::C)
      decide_number_input
    end
  end
  #-----------------------------------------------------------------------------
  # Cancels the number window and restores the previous window state.
  #-----------------------------------------------------------------------------
  def cancel_number_input
    Sound.play_cancel
    @number_window.active = false
    @number_window.visible = false
    case @command_window.index
    when 2  # accounts
      @account_window.active = true
      @account_window.visible = true
      @xfer = false if @xfer
    when 0  # vault
      if @storing
        @item_window.active = true
      else
        @vault_window.active = true
      end
      @vault_window.visible = true
      @item_window.visible = true
    end
  end
  #-----------------------------------------------------------------------------
  # Confirms the number input and proccesses banking events accordingly
  #-----------------------------------------------------------------------------
  def decide_number_input
    Sound.play_save
    @number_window.active = false
    @number_window.visible = false
    case @command_window.index
    when 3 # accounts
      if @account_window.index == @account_window.item_max - 1 #get loan
        $game_banking.makeLoan(@bankID, @rates, @number_window.number)
        $game_party.gain_gold(@number_window.number)
      else
        case @accountCmd_window.index
        when 0 #deposit
          @account.deposit(@number_window.number)
          $game_party.lose_gold(@number_window.number)
          if @account.type == 2 and @account.balance == 0
            $game_banking.bankAccounts[@bankID].delete(@account)
          end
        when 1 #withdraw(NA for loan)
          @account.withdraw(@number_window.number)
          $game_party.gain_gold(@number_window.number)
        when 2 #transfer
          @account.withdraw(@number_window.number)
          @xferAccount.deposit(@number_window.number)
          if @xferAccount.type == 2 and @xferAccount.balance == 0
            $game_banking.bankAccounts[@bankID].delete(@xferAccount)
          end
          @xfer = false
        end
      end
      @account                  = nil
      @xferAccount              = nil
      @accountCmd_window.index  = 3
      @account_window.active    = true
      @account_window.visible   = true
      @account_window.refresh
      @gold_window.refresh
    when 0  # vault
      if @storing
        @slot.storeItem(@item, @number_window.number)
        @storing = false
      else #must be buying slots
        purchasedSlots = @number_window.number
        $game_party.lose_gold(purchasedSlots * @slotCost)
        x = 0
        while purchasedSlots > 0
          if $game_banking.bankVaults[@bankID][x].locked
            $game_banking.bankVaults[@bankID][x].unlock
            purchasedSlots -= 1
          end
          x += 1
        end
      end
      @vault_window.active = true
      @vault_window.visible = true
      @item_window.visible = true
      @vault_window.refresh
      @item_window.refresh
    end
  end
end



~Danke Marcy für den guten Tipp!

Closed.
MfG, Colo
« Letzte Änderung: August 20, 2009, 00:10:29 von Colonios »

 


 Bild des Monats

rooftop party

Views: 3700
By: papilion

 Umfrage

  • Wer soll das BdM gewinnen?
  • Dot Kandidat 1
  • 3 (25%)
  • Dot Kandidat 2
  • 1 (8%)
  • Dot Kandidat 3
  • 2 (16%)
  • Dot Kandidat 4
  • 0 (0%)
  • Dot Kandidat 5
  • 6 (50%)
  • Stimmen insgesamt: 12
  • View Topic

 Schnellsuche





SimplePortal 2.3.3 © 2008-2010, SimplePortal