UltimaForum

Skrypty [VX] - Usuwanie przedmiotów.

HESEE - Pią 21 Maj, 2010 14:09
Temat postu: Usuwanie przedmiotów.
Autor: Ayene
Opis:usuwa przedmiot z plecaka (bezpowrotnie)

Spoiler:

Kod:
# Użyj / Usuń Przedmiot
# by Ayene
# www.ultimateam.pl

module Ayene
  KOMENDY = ['Użyj', 'Usuń', 'Anuluj']
end


class Scene_Item < Scene_Base
  alias ayene_scitem_con_del_start start
  alias ayene_scitem_con_del_terminate terminate
  alias ayene_scitem_con_del_hitarwin hide_target_window
 
  def start   
    @confirm_window = Window_Command.new (160, Ayene::KOMENDY) 
    @confirm_window.x = (544 - @confirm_window.width) / 2
    @confirm_window.y = 100
    ayene_scitem_con_del_start 
  end   
 
  def terminate
    ayene_scitem_con_del_terminate
    @confirm_window.dispose
  end
 
  def update   
    super
    update_menu_background
    @help_window.update
    @item_window.update
    @target_window.update
    @confirm_window.update
    if @item_window.active
      item_selection     
    elsif @confirm_window.active
      update_confirm_selection
    elsif @target_window.active     
      update_target_selection
    end
  end
 
  def item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      @item = @item_window.item 
      if $game_party.item_can_use?(@item)
        @confirm_window.draw_item(0, true)
      else
        @confirm_window.draw_item(0, false)
      end       
      if @item != nil
        @item_window.active = false       
        @confirm_window.visible = true
        @confirm_window.active = true       
      end     
    end 
  end
 
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      if $game_party.item_can_use?(@item)
        Sound.play_decision
        determine_item
      else
        Sound.play_buzzer
      end
    end
  end
 
  def hide_target_window
    ayene_scitem_con_del_hitarwin
    @confirm_window.visible = false
    @confirm_window.active = false
    @confirm_window.index = 0   
  end
   
  def update_confirm_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      hide_target_window     
    elsif Input.trigger?(Input::C)     
      Sound.play_decision   
      case @confirm_window.index
      when 0     
        if $game_party.item_can_use?(@item)         
          @confirm_window.visible = false
          @confirm_window.active = false     
          update_item_selection
        else
          Sound.play_buzzer
        end
      when 1       
        $game_party.lose_item(@item, 1)
        hide_target_window
      when 2       
        hide_target_window
      end
      @item_window.refresh     
    end   
  end 
end


adoksz - Sro 26 Sty, 2011 11:10

a da sie zrobić tak że by było "Wyrzuć, zniszcz, anuluj"? tylko ze po "wyzuc" item pojawia sie obok postaci? :-D

Powered by phpBB modified by Przemo © 2003 phpBB Group