Advertisement
neutale

Get All Items [VX & VXA]

Aug 27th, 2019
1,068
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.11 KB | None | 0 0
  1. #==============================================================================
  2. # ○ Get all items Ver1.00
  3. # for RGSS2, also VX Ace
  4. # 西瓜 / Space not far
  5. # http://muspell.raindrop.jp/
  6. # Get 99 items, weapons and armor. For debugging.
  7. #==============================================================================
  8.  
  9. # Use snf_getallitem as a script call in the event command.
  10. # Get all items. However, items with blank names are ignored.
  11.  
  12. module SNF
  13.   ALLITEM_NONAMESKIP = true
  14.   # Whether or not to skip blank name items? (true/false)
  15.   ALLITEM_TESTPLAYONLY = true
  16.   # Is the effect happens only during test play? (true/false)
  17. end
  18.  
  19.  
  20. class Game_Interpreter
  21.   def snf_getallitem
  22.     if SNF::ALLITEM_TESTPLAYONLY
  23.       return unless $TEST # End if not test play
  24.     end
  25.     items = []
  26.     items += $data_items
  27.     items += $data_weapons
  28.     items += $data_armors
  29.     for item in items.compact
  30.       next if item.name == "" and SNF::ALLITEM_NONAMESKIP # Skip blank items
  31.       $game_party.gain_item(item, 99)
  32.     end
  33.   end
  34. end
  35. class Game_Interpreter
  36.   SNF_RANDOMITEM_EXCEPTION = "<random item exception>"
  37.   def snf_randomget(kind = rand(3), array= 1..999, sze = 1)
  38.     items = []
  39.     randomlist = []
  40.     # Array initialization
  41.     for i in array
  42.       case kind
  43.       when 0 # Item
  44.         items.push($data_items[i])
  45.       when 1 # Weapon
  46.         items.push($data_weapons[i])
  47.       when 2 # Armor
  48.         items.push($data_armors[i])
  49.       end
  50.     end
  51.     for item in items.compact
  52.       next if item.name == "" and SNF::RANDOMITEM_NONAMESKIP # Skip blank items
  53.       if SNF::RANDOMITEM_EXCEPETITE # Handling exception items
  54.         next if item.note.include?(SNF_RANDOMITEM_EXCEPTION)
  55.       else
  56.         next unless item.note.include?(SNF_RANDOMITEM_EXCEPTION)
  57.       end
  58.       randomlist.push(item)
  59.     end
  60.     return if randomlist.size == 0 # End if there are no candidates
  61.     getitem = randomlist[rand(randomlist.size)] # randomly select
  62.     $game_variables[SNF::RANDOMITEM_NAME_ID] = getitem.name if SNF::RANDOMITEM_SUBSTITUTENAME
  63.     $game_party.gain_item(getitem, sze)
  64.   end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement