Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.98 KB | None | 0 0
  1. #==============================================================================#
  2. #                                                                              #
  3. #                         Multi Type Apricorns                                 #
  4. #                          By Ulithium_Dragon                                  #
  5. #                                                                              #
  6. #==============================================================================#
  7. #         ------------------------------------------------------               #
  8. #      Allows creating an Apricorn Ball from two different apricorns.          #
  9. #         ------------------------------------------------------               #
  10. #==============================================================================#
  11. #//////////////////////////////////////////////////////////////////////////////#
  12. #------------------------------------------------------------------------------#
  13. # ***NOTE*** You must create a dummy item for each multi apricorn combination! #
  14. #            Edit your items.txt PSB file accordingly. The data for the item   #
  15. #            does not matter. The only thing that matters is that the name you #
  16. #            use is the same as the one you put under "MultiApricorns_List".   #
  17. #------------------------------------------------------------------------------#
  18. #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
  19. #==============================================================================#
  20.  
  21.  
  22. #Variable ID for the dummy item checks to use.
  23. WHT&BLUAPRICORN_VAR = 65
  24. RED&YLWAPRICORN_VAR = 66
  25. BLK&GRNAPRICORN_VAR = 67
  26.  
  27.  
  28. #Variables array. Add each of the variables you assigned above to this.
  29. # *NOTE: These MUST be in the same order as MultiApricorns_List!
  30. ApricornVairables_List=[
  31. WHT&BLUAPRICORN_VAR,
  32. RED&YLWAPRICORN_VAR,
  33. BLK&GRNAPRICORN_VAR
  34. ]
  35.  
  36. #Add your multiple combo apricorns to this array.
  37. # *NOTE: These MUST be in the same order as ApricornVairables_List!
  38. #
  39. # USAGE: Each line should consist of a Multi Apricorn Dummy item,
  40. #        followed by the two real Apricorns that it represents.
  41. MultiApricorns_List=[
  42.   ":WHT&BLUAPRICORN",":WHTAPRICORN",":BLUAPRICORN",
  43.   ":RED&YLWAPRICORN",":REDAPRICORN",":YLWAPRICORN",
  44.   ":BLK&GRNAPRICORN",":BLKAPRICORN",":GRNAPRICORN"
  45. ]
  46.  
  47. #*Run this before anything else in your Apricorn Creation Event/Script (i.e. Kurk).
  48. def pbGetDummyApricorns
  49.   #Gets the total number Multi Apricorn types and stores it in a global variable.
  50.   $apricorncombos_num = (MultiApricorns_List.length/3)
  51.   apricorn_count = 0
  52.   #Add the dummy items and sets the quantity variables for later use.
  53.   while apricorn_count <= $apricorncombos_num
  54.     #Makes sure the first spot on the array is used for line 1.
  55.     if apricorn_count == 0
  56.       multitype = MultiApricorns_List[apricorn_count]   #Stores the multi type.
  57.     else
  58.       multitype = MultiApricorns_List[apricorn_count*3] #Stores the multi type.
  59.     end
  60.     #Grabs the apricorn sub types from the array and stores them in temp variables.
  61.     subtype1 = MultiApricorns_List[apricorn_count*3+1]
  62.     subtype2 = MultiApricorns_List[apricorn_count*3+2]
  63.     #Checks if the player at least one of each Multi Apricorn subtype Apricorn in their bag.
  64.     if ($PokemonBag.pbHasItem?(subtype1) && $PokemonBag.pbHasItem?(subtype2))
  65.       $game_variables[1] = $PokemonBag.pbQuantity(subtype1)
  66.       $game_variables[2] = $PokemonBag.pbQuantity(subtype2)
  67.       #Gives the player a dummy item for each pair of Multi Apricorns subtypes they have.
  68.       # E.g. if the player had 7 White and 6 Blue Apricorns, they are given 6 White/Blue dummy items.
  69.       if pbGet(1) > pbGet(2)
  70.         $PokemonBag.pbStoreItem(multitype,pbGet(2))
  71.         pbSet(ApricornVairables_List[multitype],pbGet(2))
  72.       else
  73.         $PokemonBag.pbStoreItem(multitype,pbGet(1))
  74.         pbSet(ApricornVairables_List[multitype],pbGet(1))
  75.       end
  76.     end
  77.     apricorn_count=+1
  78.   end
  79. end
  80.  
  81.  
  82. #*Run this in place of the usual "$PokemonBag.pbDeleteItem(pbGet(8))" script in
  83. # your Apricorn Creation Event/Script.
  84. def pbRemoveDummyApricorns
  85.   #Gets the total number Multi Apricorn types and stores it in a global variable.
  86.   $apricorncombos_num = (MultiApricorns_List.length/3)
  87.   apricorn_count = 0
  88.   #Checks what dummy items the player has left and removes their apricorn subtypes
  89.   # from the player's bag if they chose to use some of them.
  90.   while apricorn_count <= $apricorncombos_num
  91.     #Makes sure the first spot on the array is used for line 1.
  92.       if apricorn_count == 0
  93.         multitype = MultiApricorns_List[apricorn_count] #Stores the multi type.
  94.     else
  95.       multitype = MultiApricorns_List[apricorn_count*3] #Stores the multi type.
  96.     end
  97.     #Grabs the apricorn sub types from the array and stores them in temp variables.
  98.     subtype1 = MultiApricorns_List[apricorn_count*3+1]
  99.     subtype2 = MultiApricorns_List[apricorn_count*3+2]
  100.     #If the player has at least one dummy item...
  101.     if $PokemonBag.pbHasItem?(multitype)
  102.       #Check and store the number of dummy items the player still has.
  103.       $game_variables[1] = $PokemonBag.pbQuantity(multitype)
  104.       #If the player chose to convert the Multi Type Apricorn...
  105.       if pbGet(8) == multitype
  106.         dummyitems_total = pbGet(ApricornVairables_List[multitype])
  107.         dummyitems_remaining = pbGet(1)
  108.         dummyitems_removenum = (dummyitems_total - dummyitems_remaining)
  109.         $PokemonBag.pbDeleteItem(subtype1,(dummyitems_removenum))
  110.         $PokemonBag.pbDeleteItem(subtype2,(dummyitems_removenum))
  111.         #Remove the Multi Type Apricorn dummy items.
  112.         $PokemonBag.pbDeleteItem(multitype,pbGet(1))
  113.         #Assign the name of the Multi Type Apricorn to the Variable (3).
  114.         pbSet(3,PBItems.getName(pbGet(8)))
  115.       else #If the player choose not to convert a the the Multi Type Apricorn...
  116.         #Remove the Multi Type Apricorn dummy items.
  117.         $PokemonBag.pbDeleteItem(multitype,pbGet(1))
  118.       end
  119.     end
  120.     apricorn_count=+1
  121.   end
  122. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement