IceDragon200

Item Button Mapping

Dec 4th, 2011
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.83 KB | None | 0 0
  1.  
  2.   KEY_MAP = {
  3.     0 => Input::NUMBERS[6],
  4.     1 => Input::NUMBERS[7],
  5.     2 => Input::NUMBERS[8],
  6.     3 => Input::NUMBERS[9],
  7.     4 => Input::NUMBERS[0]
  8.   }
  9.  
  10.   def update_item_selection
  11.     if Input.trigger?(Input::B)
  12.       Sound.play_cancel
  13.       return_scene
  14.     elsif Input.trigger?(Input::C)
  15.       @item = @item_window.item
  16.       if @item != nil
  17.         $game_party.last_item_id = @item.id
  18.       end
  19.       if $game_party.item_can_use?(@item)
  20.         Sound.play_decision
  21.         determine_item
  22.       else
  23.         Sound.play_buzzer
  24.       end
  25.     else
  26.       KEY_MAP.each_pair { |key, value|
  27.         if Input.trigger?( value )
  28.           Sound.play_decision()
  29.           id = @item_window.item.nil?() ? 0 : @item_window.item.id
  30.           $game_actors[1].set_item_slot( key, id )
  31.         end
  32.       }
  33.     end
  34.   end
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment