IceDragon200

ICY-TempItemSelection v1.0

Nov 16th, 2011
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.10 KB | None | 0 0
  1. #==============================================================================#
  2. # // ICY - Temp Item Selection //
  3. #==============================================================================#
  4. # // Created by    : IceDragon
  5. # // Date Created  : 11/16/2011
  6. # // Date Modified : 11/16/2011
  7. # // Version       : 1.0
  8. # // Created for   : Archeia
  9. #==============================================================================#
  10. # // In a script call use :
  11. # //   start_temp_item_select()
  12. # //
  13. # // To change the variable for the item ids
  14. # // Go to Scene_Item (below) and change the constant:
  15. # //   SEL_ITEM_ID_VAR
  16. # //
  17. #==============================================================================#
  18. ($imported ||= {})["ICY-TempItemSelection"] = true
  19. #==============================================================================#
  20. # ** Game_Temp
  21. #==============================================================================#
  22. class Game_Temp
  23.  
  24.   #--------------------------------------------------------------------------#
  25.   # * Public Instance Variable(s)
  26.   #--------------------------------------------------------------------------#
  27.   attr_accessor :temp_item_selection
  28.   attr_accessor :return_scene
  29.  
  30. end
  31.  
  32. #==============================================================================#
  33. # ** Game_Interpreter
  34. #==============================================================================#
  35. class Game_Interpreter
  36.  
  37.   #--------------------------------------------------------------------------#
  38.   # * new-method :start_temp_item_select
  39.   #--------------------------------------------------------------------------#
  40.   def start_temp_item_select()
  41.     $game_temp.temp_item_selection = true
  42.     $game_temp.return_scene = "map"
  43.     $scene = Scene_Item.new()
  44.     $game_temp.return_scene = "null"
  45.   end
  46.  
  47. end
  48.  
  49. #==============================================================================#
  50. # ** Scene_Item
  51. #==============================================================================#
  52. class Scene_Item
  53.  
  54.   #--------------------------------------------------------------------------#
  55.   # * Constant(s)
  56.   #--------------------------------------------------------------------------#
  57.   SEL_ITEM_ID_VAR = 101 # // Variable used for storing item ID
  58.  
  59.   #--------------------------------------------------------------------------#
  60.   # * alias-method :initialize
  61.   #--------------------------------------------------------------------------#
  62.   alias :icy_temp_initialize :initialize unless $@
  63.   def initialize( *args, &block )
  64.     icy_temp_initialize( *args, &block )
  65.     @return_obj = case $game_temp.return_scene
  66.                   when "map" ; "map"
  67.                   else ; "menu"
  68.                   end
  69.     $game_variables[SEL_ITEM_ID_VAR] = 0
  70.   end
  71.  
  72.   #--------------------------------------------------------------------------#
  73.   # * alias-method :update_item_selection
  74.   #--------------------------------------------------------------------------#
  75.   alias :icy_temp_item_selection :update_item_selection unless $@
  76.   def update_item_selection( *args, &block )
  77.     if Input.trigger?(Input::C)
  78.       $game_variables[SEL_ITEM_ID_VAR] = 0
  79.       @item = @item_window.item
  80.       $game_party.last_item_id = @item.id unless @item.nil?()
  81.       if $game_party.item_can_use?( @item )
  82.         Sound.play_decision()
  83.         $game_variables[SEL_ITEM_ID_VAR] = @item.id
  84.         return_scene()
  85.       else
  86.         Sound.play_buzzer()
  87.       end
  88.       return
  89.     end if $game_temp.temp_item_selection
  90.     icy_temp_item_selection( *args, &block )
  91.   end
  92.  
  93.   #--------------------------------------------------------------------------#
  94.   # * overwrite-method :return_scene
  95.   #--------------------------------------------------------------------------#  
  96.   def return_scene()
  97.     case @return_obj
  98.     when "map"
  99.       $scene = Scene_Map.new()
  100.     when "menu"
  101.       $scene = Scene_Menu.new( 0 )
  102.     end  
  103.   end
  104.  
  105. end
  106.  
  107. #=*==========================================================================*=#
  108. # ** END OF FILE
  109. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment