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 7.17 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. #The Display names given to your dummy items in items.txt need to go here.
  48. # *NOTE: These MUST be in the same order as ApricornVairables_List!
  49. DisplayNames_List=[
  50.   "White and Blue Apricorns",
  51.   "Red and Yellow Apricorns",
  52.   "Black and Green Apricorns"
  53. ]
  54.  
  55. #*Run this before anything else in your Apricorn Creation Event/Script (i.e. Kurk).
  56. def pbGetDummyApricorns
  57.   #Gets the total number Multi Apricorn types and stores it in a Global Variable.
  58.   $apricorncombos_num = (MultiApricorns_List.length/3)
  59.   #p $apricorncombos_num  #Debug
  60.   #pbPopulateApriconRealNameArray
  61.   apricorn_count = 0
  62.   #Add the dummy items and sets the quantity variables for later use.
  63.   while apricorn_count < $apricorncombos_num
  64.     if apricorn_count == 0  #Makes sure the first spot on the array is used for line 1.
  65.       multitype = MultiApricorns_List[apricorn_count]   #Stores the multi type.
  66.       multitypevar = 0  #Temp var.
  67.     else
  68.       multitype = MultiApricorns_List[apricorn_count*3] #Stores the multi type.
  69.       multitypevar = apricorn_count  #Temp var.
  70.     end
  71.     #Grabs the apricorn sub types from the array and stores them in temp variables.
  72.     subtype1 = MultiApricorns_List[apricorn_count*3+1]
  73.     subtype2 = MultiApricorns_List[apricorn_count*3+2]
  74.     #Checks if the player at least one of each Multi Apricorn subtype Apricorn in their bag.
  75.     if ($PokemonBag.pbHasItem?(subtype1) && $PokemonBag.pbHasItem?(subtype2))
  76.       $game_variables[1] = $PokemonBag.pbQuantity(subtype1)
  77.       $game_variables[2] = $PokemonBag.pbQuantity(subtype2)
  78.       #Gives the player a dummy item for each pair of Multi Apricorns subtypes they have.
  79.       # E.g. if the player had 7 White and 6 Blue Apricorns, they are given 6 White/Blue dummy items.
  80.       tmpapricornvar = ApricornVairables_List[multitypevar]
  81.       if pbGet(1) > pbGet(2)
  82.         $PokemonBag.pbStoreItem(multitype,pbGet(2))
  83.         pbSet(tmpapricornvar,pbGet(2))
  84.       else
  85.         $PokemonBag.pbStoreItem(multitype,pbGet(1))
  86.         pbSet(tmpapricornvar,pbGet(1))
  87.       end
  88.     end
  89.     apricorn_count+=1
  90.     #p apricorn_count  #Debug
  91.   end
  92. end
  93.  
  94.  
  95. #*Run this instead of the usual "$PokemonBag.pbDeleteItem(pbGet(8))" script in your Apricorn Creation Event/Script.
  96. def pbRemoveDummyApricorns
  97.   #Gets the total number Multi Apricorn types and stores it in a Global Variable.
  98.   $apricorncombos_num = (MultiApricorns_List.length/3)
  99.   #p $apricorncombos_num  #Debug
  100.   #pbPopulateApriconRealNameArray
  101.   apricorn_count = 0
  102.   #Checks what dummy items the player has left and removes their apricorn subtypes
  103.   # from the player's bag if they chose to use some of them.
  104.   while apricorn_count < $apricorncombos_num
  105.       if apricorn_count == 0  #Makes sure the first spot on the array is used for line 1.
  106.         multitype = MultiApricorns_List[apricorn_count] #Stores the multi type.
  107.       multitypevar = 0   #Temp var.
  108.     else
  109.       multitype = MultiApricorns_List[apricorn_count*3] #Stores the multi type.
  110.       multitypevar = apricorn_count  #Temp var.
  111.     end
  112.     #Grabs the apricorn sub types from the array and stores them in temp variables.
  113.     subtype1 = MultiApricorns_List[apricorn_count*3+1]
  114.     subtype2 = MultiApricorns_List[apricorn_count*3+2]
  115.     #If the player has at least one dummy item...
  116.     if $PokemonBag.pbHasItem?(multitype)
  117.       #Check and store the number of dummy items the player still has.
  118.       $PokemonBag.pbDeleteItem(multitype,1)
  119.       $game_variables[1] = $PokemonBag.pbQuantity(multitype)
  120.       #If the player chose to convert the Multi Type Apricorn...
  121.       if PBItems.getName(pbGet(8)) == DisplayNames_List[apricorn_count]
  122.         dummyitems_total = pbGet(ApricornVairables_List[multitypevar])
  123.         dummyitems_removenum = (dummyitems_total - dummyitems_remaining)
  124.         $PokemonBag.pbDeleteItem(subtype1,dummyitems_removenum)
  125.         $PokemonBag.pbDeleteItem(subtype2,dummyitems_removenum)
  126.         #Remove the Multi Type Apricorn dummy items.
  127.         $PokemonBag.pbDeleteItem(multitype,pbGet(1))
  128.         #Assign the name of the Multi Type Apricorn to the Variable (3).
  129.         pbSet(3,PBItems.getName(pbGet(8)))
  130.       else #If the player choose not to convert a the the Multi Type Apricorn...
  131.         #Remove the Multi Type Apricorn dummy items.
  132.         $PokemonBag.pbDeleteItem(multitype,pbGet(1))
  133.       end
  134.     end
  135.     apricorn_count+=1
  136.   end
  137. end
  138.  
  139.  
  140. =begin
  141. #::::DECREPIT::::
  142. def pbPopulateApriconRealNameArray
  143.   #displayNamesList = Array.new
  144.   arraylength = (MultiApricorns_List.length/3)
  145.   displayNamesList = Array.new(arraylength,"Name")
  146.   itterationcount = 0
  147.   for n in MultiApricorns_List
  148.     for i in displayNamesList
  149.       if itterationcount == 0
  150.         tempname = MultiApricorns_List[n]
  151.         puts PBItems.getName(tempname)
  152.       end
  153.       itterationcount+=1
  154.     end
  155.     if itterationcount == 2
  156.       itterationcount = 0
  157.     end
  158.   end
  159. #  p displayNamesList
  160.   return displayNamesList
  161. end
  162. =end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement