SHARE
TWEET

[RMXP] Dynamic Gardening 3.0

ForeverZer0 May 21st, 2011 176 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  2. # Dynamic Gardening
  3. # Author: ForeverZer0
  4. # Date: 5.13.2011
  5. # Version: v.3.0
  6. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  7. #                            VERSION HISTORY
  8. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  9. #  v.1.1  (4.15.2010)
  10. #   - Improved coding
  11. #   - No longer uses game variables, events use self-switches instead
  12. #   - Added ability to create different graphics for every plant, without
  13. #     having to use more event pages
  14. #   - Much less tedious setting up multiple events and changing the every
  15. #     condition variable.
  16. #  v.2.0  (10.10.2010)
  17. #   - Total re-write. Code has been vastly improved and is much more efficient.
  18. #   - Event setup has been simplified. Now requires only a single comment, and
  19. #     does not require multiple pages.
  20. #   - Added configurability for the number of stages each item requires.
  21. #   - The timers no longer use Game_System to constantly update, but simply
  22. #     compare themselves with the Graphics.frame_count when the event exists
  23. #     on the current map, which also allows the plants to grow during scenes
  24. #     other than Scene_Map and Scene_Battle.
  25. #   - Got rid of Scene_Harvest. Scene_Garden now handles both aspects, and has
  26. #     been improved.
  27. #   - Added item icons to the help window display.
  28. # v.3.0  (5.13.2011)
  29. #   - Restructured code completely
  30. #   - Increased compatibility and performance
  31. #   - Fixed bug with final graphic not behaving correctly
  32. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  33. #
  34. # Explanation:
  35. #
  36. #   This system allows the player to plant seeds, which will eventually grow
  37. #   into plants that can be harvested for items. The system is very similar in
  38. #   nature to that found in Legend of Mana. Seed's can be combined in different
  39. #   ways, which will effect the total growth duration, the number of stages the
  40. #   plant passes through, the graphics used, and of course the final result.
  41. #
  42. # Features:
  43. #
  44. #  - Totally configurable growth rates, results, and graphics for every plant.
  45. #  - Can use arrays of items for each result, so the final item is not
  46. #    neccessarily the same every time.
  47. #  - Each plant timer is independent, and its progress is saved with the game.
  48. #  - Easy setup. Need only a single comment in one of the event's pages.
  49. #
  50. # Instructions:
  51. #  
  52. #  - Place script below Debug and above Main
  53. #  - Configure the options below (instructions are with each setting)
  54. #  - Create an event, setting the graphic to whatever you want. This will be the
  55. #    graphics used when nothing is growing on the plant.
  56. #  - At the very top event's page, place a comment that reads "Garden Event",
  57. #    omitting the quotation marks.
  58. #  - As long as the page's conditions are met, this event can be clicked on to
  59. #    initiate the Garden scene, and can grow plants.
  60. #  - Note that plants can be harvested early, but they will yield nothing until
  61. #    they are ripe.
  62. #
  63. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  64. #  BEGIN CONFIGURATION
  65. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  66.  
  67. #===============================================================================
  68. # ** Garden
  69. #===============================================================================
  70.  
  71. module Garden
  72.  
  73.   SEED_IDS = [1, 2, 3, 4, 5, 6, 7, 8]
  74.   # IDs of the items in the database that are seeds. Add them into the array in
  75.   # the order of value/rarity in your game
  76.  
  77.   HARVEST_SE = '056-Right02'
  78.   # This is the SE that will be played when the player harvests the plant.
  79.  
  80.   SEED_DISPLAY = true
  81.   # If true, all seeds will be displayed in the seed window, including those
  82.   # that the player does not have, though they will be disabled. If false, only
  83.   # seeds that that the player currently has will be displayed.
  84.  
  85.   # Define the growth rates here. (the average of both seeds will be used)
  86.   def self.growth_rate(seed)
  87.     return case seed
  88.     # when SEED_ID then SECONDS
  89.     when 1 then 10
  90.     when 2 then 12
  91.     when 3 then 15
  92.     when 4 then 20
  93.     when 5 then 23
  94.     when 6 then 25
  95.     when 7 then 30
  96.     when 8 then 35
  97.     end
  98.   end
  99.  
  100. #-------------------------------------------------------------------------------
  101. # Define the number of stages that each item uses. The stages will still cycle
  102. # in the same order, but only use up to the defined number of them before going
  103. # to the final graphic. This will not effect the duration that the seed takes to
  104. # grow, only how many times the graphic changes.
  105. #
  106. # You do not have to define anything that uses a three stage configuration.
  107. #-------------------------------------------------------------------------------
  108.   def self.number_stages(result)
  109.     case result
  110.     when 8..16
  111.       return 4
  112.     when 17..24
  113.       return 5
  114.     else
  115.       return 3
  116.     end
  117.   end
  118.  
  119. #-------------------------------------------------------------------------------
  120. # Define the final result of the seeds. A random item from the array will be
  121. # given as the final result.
  122. #  
  123. # Each seed is given a value from 0 to the total number of seeds in the SEED_IDS
  124. # array, and both values are added together to determine which 'produce' array
  125. # will be used for the final result. This is why it is important that you have
  126. # the SEED_IDS array in order of value/rarity. You can find the total number of
  127. # cases you will need by subtracting 1 from the total number of different seeds
  128. # in SEED_IDS, and multiplying that number by 2.
  129. #
  130. #   EX. Player uses one each of the first and last seed in the SEED_IDS array,
  131. #       and there are 8 total seeds in the array...
  132. #
  133. #       FIRST_SEED = 2
  134. #       LAST_SEED = 5         2 + 5 = RESULT
  135. #
  136. # By placing multiple copies of the same value in an array, you can increase
  137. # the odds of receiving that item over another in the same array.
  138. #-------------------------------------------------------------------------------
  139.  
  140.   def self.produce(seed)
  141.     return case seed
  142.     when 0 then [9, 10]      # Only if both seed are the lowest seeds
  143.     when 1 then [10, 11]
  144.     when 2 then [12, 13]
  145.     when 3 then [13, 14]
  146.     when 4 then [14, 15]
  147.     when 5 then [15, 16]
  148.     when 6 then [16, 17]      # Every combination in between
  149.     when 7 then [17, 18]
  150.     when 8 then [18, 19]
  151.     when 9 then [19, 20]
  152.     when 10 then [20, 21]
  153.     when 11 then [21, 22]
  154.     when 12 then [22, 23]
  155.     when 13 then [23, 24]
  156.     when 14 then [24]         # Only if both seeds are the highest seeds
  157.     end
  158.   end
  159.  
  160. #-------------------------------------------------------------------------------
  161. #  Define graphics for the final results, and each stage. Follow the below
  162. #  template to set it up.
  163. #
  164. #   when ITEM_ID/STAGE then ['FILENAME', X, Y]
  165. #
  166. #   ITEM_ID = The ID number of the item in your database
  167. #   STAGE = The stage during which to display the graphic
  168. #
  169. #   FILENAME = The name of the character file the needed graphic is on
  170. #   X = The x-coordinate of the correct picture on the charset (1 - 4)
  171. #   Y = The y-coordinate of the correct picture on the charset (1 - 4)
  172. #
  173. #           ? X ?             Ex.   If the needed graphic was in the bottom
  174. #         1  2  3  4                left corner:   X = 1    Y = 4
  175. #       +-----------+                    
  176. #     1 ¦  ¦  ¦  ¦  ¦
  177. #       +--+--+--+--¦
  178. #  ?  2 ¦  ¦  ¦  ¦  ¦
  179. #  Y    +--+--+--+--¦
  180. #  ?  3 ¦  ¦  ¦  ¦  ¦
  181. #       +--+--+--+--¦
  182. #     4 ¦  ¦  ¦  ¦  ¦
  183. #       +-----------+
  184. #-------------------------------------------------------------------------------
  185.  
  186.   def self.stage_graphics(stage)
  187.     return case stage
  188.     when 0 then ['Plants1', 1, 1]
  189.     when 1 then ['Plants1', 2, 3]
  190.     when 2 then ['Plants1', 2, 1]
  191.     when 3 then ['Plants1', 4, 2]
  192.     when 4 then ['Plants1', 2, 4]
  193.     end
  194.   end
  195.  
  196.   def self.final_graphic(item)
  197.     return case item  
  198.     when 9 then  ['Garden Plants', 1, 1]
  199.     when 10 then ['Garden Plants', 2, 4]
  200.     when 11 then ['Garden Plants', 3, 4]
  201.     when 12 then ['Garden Plants', 4, 4]
  202.     when 13 then ['Garden Plants', 1, 4]
  203.     when 14 then ['Garden Plants', 2, 2]
  204.     when 15 then ['Garden Plants', 3, 2]  
  205.     when 16 then ['Garden Plants', 4, 2]
  206.     when 17 then ['Garden Plants', 1, 2]
  207.     when 18 then ['Garden Plants', 2, 3]
  208.     when 19 then ['Garden Plants', 3, 3]
  209.     when 20 then ['Garden Plants', 4, 3]
  210.     when 21 then ['Garden Plants', 1, 3]
  211.     when 22 then ['Garden Plants', 2, 1]
  212.     when 23 then ['Garden Plants', 3, 1]
  213.     when 24 then ['Garden Plants', 4, 1]
  214.     end
  215.   end
  216.  
  217. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  218. #  END CONFIGURATION
  219. #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  220.  
  221.   def self.plant_seeds(seed1, seed2, event_id)
  222.     # Create a new instance of a Garden::Plant
  223.     plant = self::Plant.new(event_id, seed1, seed2)
  224.     if $game_system.garden[$game_map.map_id] == nil
  225.       $game_system.garden[$game_map.map_id] = [plant]
  226.     else
  227.       $game_system.garden[$game_map.map_id].push(plant)
  228.     end
  229.   end
  230.  
  231.   def self.harvest(id)
  232.     # Find the appropriate plant.
  233.     plant = $game_system.garden[$game_map.map_id].find {|plant| plant.id == id }
  234.     return nil if plant == nil
  235.     # Return the result, and delete plant data from array.
  236.     result = plant.produce
  237.     plant.restore_event
  238.     $game_system.garden[$game_map.map_id] -= [plant]
  239.     return result
  240.   end
  241.  
  242. #===============================================================================
  243. # ** Garden::Plant
  244. #===============================================================================
  245.  
  246.   class Plant
  247.    
  248.     attr_reader :id, :ripe
  249.    
  250.     def initialize(id, seed1, seed2)
  251.       # Initialize needed instance variables.
  252.       @id, @seed1, @seed2 = id, seed1, seed2
  253.       @ripe, @stage = false, -1
  254.       # Run setup method, using data in Garden config for this plant's seeds
  255.       setup
  256.     end
  257.    
  258.     def setup
  259.       # Store original graphic, direction, and pattern in variable.
  260.       event = $game_map.events[@id]
  261.       @original_event = [event.character_name, event.direction, event.pattern]
  262.       # Calculate the total duration of the seed combination.
  263.       @duration = (Garden.growth_rate(@seed1) + Garden.growth_rate(@seed2))
  264.       # Find the produce that this combination will grow into
  265.       comb = Garden::SEED_IDS.index(@seed1) + Garden::SEED_IDS.index(@seed2)
  266.       @produce = Garden.produce(comb)
  267.       @produce = @produce[rand(@produce.size)]
  268.       # Get the number of stages this plant will use, then setup counts for it
  269.       number, count = Garden.number_stages(@produce), 0
  270.       dur = (@duration / number.to_f).to_i
  271.       @stages = (0...number).to_a
  272.       @stages.collect! {|i| $game_system.garden_counter + (i * dur) }
  273.       # Refresh the plant to apply changes
  274.       refresh
  275.     end
  276.    
  277.     def refresh
  278.       unless @ripe
  279.         # Initialize local variable that will determine if graphic needs redrawn.
  280.         previous = @stage
  281.         count = @stages.find_all {|rate| $game_system.garden_counter <= rate }
  282.         @stage = (@stages.size - count.size)
  283.         @ripe = (@stage >= @stages.size - 1)
  284.         # Redraw bitmap if needed.
  285.         change_graphic(@ripe) if previous != @stage
  286.       end
  287.     end
  288.    
  289.     def change_graphic(final)
  290.       # Set local variable to this plant's event
  291.       event = $game_map.events[@id]
  292.       data = final ? Garden.final_graphic(@produce) :
  293.         Garden.stage_graphics(@stage)
  294.       # Apply graphical change by simply altering event's stance and source
  295.       event.character_name = data[0]
  296.       event.direction = (2 * data[2])
  297.       event.pattern = (data[1] - 1)
  298.       event.refresh
  299.     end
  300.    
  301.     def restore_event
  302.       # Restore event to original state before planting.
  303.       event = $game_map.events[@id]
  304.       event.character_name = @original_event[0]
  305.       event.direction = @original_event[1]
  306.       event.pattern = @original_event[2]
  307.     end
  308.    
  309.     def produce
  310.       # Return nil if not yet ripe, else return an item ID.
  311.       return (@ripe ? @produce : nil)
  312.     end
  313.   end
  314. end
  315.  
  316. #===============================================================================
  317. # ** Game_System
  318. #===============================================================================
  319.  
  320. class Game_System
  321.  
  322.   attr_accessor :garden, :garden_counter
  323.  
  324.   alias zer0_garden_init initialize
  325.   def initialize
  326.     # Initialize variables used for the garden system.
  327.     @garden_counter = 0
  328.     @garden = {}
  329.     zer0_garden_init
  330.   end
  331.  
  332.   alias zer0_garden_upd update
  333.   def update
  334.     # Increase garden counter and check if update is needed every second.
  335.     if (Graphics.frame_count % 40) == 0
  336.       @garden_counter += 1
  337.       # Check if current map has any plants on it. If so, refresh them.
  338.       if @garden[$game_map.map_id] != nil && !@garden[$game_map.map_id].empty?
  339.         @garden[$game_map.map_id].each {|plant| plant.refresh }
  340.       end
  341.     end
  342.     zer0_garden_upd
  343.   end
  344. end
  345.  
  346. #===============================================================================
  347. # ** Game_Event
  348. #===============================================================================
  349.  
  350. class Game_Event
  351.  
  352.   attr_accessor :character_name, :direction, :pattern
  353.  
  354.   alias zer0_garden_event_refresh refresh
  355.   def refresh
  356.     # Normal refresh method.
  357.     zer0_garden_event_refresh
  358.     # Set flag for this event being a garden event.
  359.     @garden_event = (@page != nil && @page.list[0].code == 108 &&
  360.       @page.list[0].parameters[0] == 'Garden Event')
  361.   end
  362.  
  363.   alias zer0_garden_upd update
  364.   def update
  365.     # Skip update method foe this event if it is a plant.
  366.     @garden_event ? return : zer0_garden_upd
  367.   end
  368.  
  369.   alias zer0_garden_event_start start
  370.   def start
  371.     # Redefine the 'start' method if Garden Event flag is present.
  372.     if @garden_event
  373.       plants, harvest = $game_system.garden[$game_map.map_id], false
  374.       # Check if plant exists, and if so check if it is ripe.
  375.       pick = plants != nil ? (plants.find {|obj| obj.id == @id }) != nil : false
  376.       $scene = Scene_Garden.new(@id, pick)
  377.     else
  378.       zer0_garden_event_start
  379.     end
  380.   end
  381. end
  382.  
  383. #===============================================================================
  384. # ** Game_Map
  385. #===============================================================================
  386.  
  387. class Game_Map
  388.  
  389.   alias zer0_garden_setup setup
  390.   def setup(map_id)
  391.     zer0_garden_setup(map_id)
  392.     # Refresh each plant when map is set up
  393.     if $game_system.garden[@map_id] != nil
  394.       $game_system.garden[@map_id].each {|obj| obj.change_graphic(obj.ripe) }
  395.     end
  396.   end
  397. end
  398.  
  399. #===============================================================================
  400. # * Window_Seed
  401. #===============================================================================
  402.  
  403. class Window_Seed < Window_Selectable
  404.  
  405.   def initialize
  406.     super(160, 304, 320, 160)
  407.     self.index = 0
  408.     refresh
  409.   end
  410.  
  411.   def refresh
  412.     # Clear the bitmap.
  413.     self.contents = self.contents.dispose if self.contents != nil
  414.     # Determine what seeds to display.
  415.     @seeds = Garden::SEED_IDS.collect {|id| $data_items[id] }
  416.     unless Garden::SEED_DISPLAY
  417.       @seeds.reject! {|seed| $game_party.item_number(seed.id) < 1 }
  418.     end
  419.     @item_max = @seeds.size
  420.     # Draw the items on the bitmap.
  421.     if @item_max > 0
  422.       self.contents = Bitmap.new(width - 32, @item_max * 32)
  423.       @seeds.each_index {|i|
  424.         item = @seeds[i]
  425.         number = $game_party.item_number(item.id)
  426.         self.contents.font.color = number > 0 ? normal_color : disabled_color
  427.         opacity = number > 0 ? 255 : 128
  428.         # Find icon bitmap and set it to window, and draw the text.
  429.         bitmap = RPG::Cache.icon(item.icon_name)
  430.         self.contents.blt(4, i*32+4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  431.         self.contents.draw_text(32, i*32, 288, 32, item.name)
  432.         self.contents.draw_text(-32, i*32, 288, 32, ':', 2)
  433.         self.contents.draw_text(-4, i*32, 288, 32, number.to_s, 2)
  434.       }
  435.     end
  436.   end
  437.  
  438.   def seed
  439.     # Returns currently highlighted seed item.
  440.     return @seeds[self.index]
  441.   end
  442. end
  443.  
  444. #===============================================================================
  445. # * Scene_Garden
  446. #===============================================================================
  447.  
  448. class Scene_Garden
  449.  
  450.   def initialize(id, harvest)
  451.     @event_id, @harvest = id, harvest
  452.     # Play SE to give impression that scene never changed.
  453.     $game_system.se_play($data_system.decision_se)
  454.     $game_player.straighten
  455.     garden = $game_system.garden[$game_map.map_id]
  456.     if garden != nil
  457.       @plant = garden.find {|plant| plant.id == id }
  458.     end
  459.   end
  460.  
  461.   def main
  462.     # Create map sprite and required windows.
  463.     @map, @help_window = Spriteset_Map.new, Window_Help.new
  464.     # Create Confirmation window.
  465.     @confirm_window = Window_Command.new(128, ['Yes', 'No'])
  466.     @confirm_window.x, @confirm_window.y = 496, 336
  467.     # Initialize sprites array. Used to handle all the sprites together.
  468.     @sprites = [@map, @help_window, @confirm_window]
  469.     # Create seed window if plant is not being harvested.
  470.     unless @harvest
  471.       @seed_window = Window_Seed.new
  472.       @sprites.push(@seed_window)
  473.       @seed_window.active = @seed_window.visible = false
  474.       @help_window.set_text('Plant seeds here?')
  475.     else
  476.       @data = $game_system.garden[$game_map.map_id][@event_id]
  477.       if @plant != nil && @plant.ripe
  478.         text = 'This plant is ripe. Would you like to harvest it?'
  479.       else
  480.         text = 'Nothing is growing yet on this plant. Harvest it anyway?'
  481.       end
  482.       @help_window.set_text(text)
  483.     end
  484.     # Transition instantly then start main loop.
  485.     Graphics.transition(0)
  486.     loop { Graphics.update; Input.update; update; break if $scene != self }
  487.     # Dispose of all the sprites.
  488.     @sprites.each {|sprite| sprite.dispose }
  489.     # Have map refresh to update any changes made.
  490.     $game_map.need_refresh = true
  491.   end
  492.  
  493.   def update
  494.     @sprites.each {|sprite| sprite.update }
  495.     # Branch update method depending on what window is active.
  496.     if @confirm_window.active
  497.       update_confirm
  498.     elsif @seed_window != nil && @seed_window.active
  499.       update_seed_select
  500.     end
  501.   end
  502.  
  503.   def update_confirm
  504.     if Input.trigger?(Input::B)
  505.       # Branch by what action is being canceled.
  506.       if @harvest
  507.         back_to_map
  508.       else
  509.         @seed1 == nil ? back_to_map : cancel_seed_selection
  510.       end
  511.     elsif Input.trigger?(Input::C)
  512.       # Branch by what action is being confirmed.
  513.       if @harvest
  514.         if @confirm_window.index == 0
  515.           item_id = Garden.harvest(@event_id)
  516.           if item_id != nil
  517.             @confirm_window.active = @confirm_window.visible = false
  518.             # Gain item, play the harvest SE, then return to the map.
  519.             $game_party.gain_item(item_id, 1)
  520.             $game_system.se_play(RPG::AudioFile.new(Garden::HARVEST_SE, 80, 100))
  521.             show_results($data_items[item_id])
  522.             $scene = Scene_Map.new
  523.           else
  524.             back_to_map
  525.           end
  526.         else
  527.           back_to_map
  528.         end
  529.       else
  530.         # If asking if player would like to plant seeds at this location.
  531.         if @seed1 == nil
  532.           if @confirm_window.index == 0
  533.             @seed_window.active = @seed_window.visible = true
  534.             @confirm_window.active = @confirm_window.visible = false
  535.             @help_window.set_text('Which seeds would you like to plant?')
  536.           else
  537.             back_to_map
  538.             return
  539.           end
  540.         else # If confirming seed selection.
  541.           if @confirm_window.index == 0
  542.             # Plant seeds and return to map.
  543.             Garden.plant_seeds(@seed1.id, @seed2.id, @event_id)
  544.             $scene = Scene_Map.new
  545.           else # If canceling seed selection
  546.             cancel_seed_selection
  547.             return
  548.           end
  549.         end
  550.         $game_system.se_play($data_system.decision_se)
  551.       end
  552.     end
  553.   end
  554.  
  555.   def show_results(result)
  556.     @help_window.contents.clear
  557.     # Display the message in the help window.
  558.     @help_window.draw_item_name(result, 0, 0)
  559.     cw = @help_window.contents.text_size(result.name).width + 32
  560.     @help_window.contents.draw_text(cw, 0, 608, 32, ' received!')
  561.     # Call Input.update to the clear key press.
  562.     Input.update
  563.     # Loop until it is pressed again.
  564.     until Input.trigger?(Input::C)
  565.       Graphics.update; Input.update; update
  566.     end
  567.   end
  568.  
  569.   def cancel_seed_selection
  570.     # Play cancel SE, reset seeds, and activate/deactivate windows.
  571.     $game_system.se_play($data_system.cancel_se)
  572.     @seed_window.active = @seed_window.visible = true
  573.     @confirm_window.active = @confirm_window.visible = false
  574.     @help_window.set_text('Which seeds would you like to plant?')
  575.     @seed1 = @seed2 = nil
  576.   end
  577.  
  578.   def back_to_map
  579.     # Play cancel SE and return to map.
  580.     $game_system.se_play($data_system.cancel_se)
  581.     $scene = Scene_Map.new
  582.   end
  583.  
  584.   def update_seed_select
  585.     if Input.trigger?(Input::B)
  586.       # If first seed is selected, go back to re-select, else return to map.
  587.       if @seed1 != nil
  588.         $game_party.gain_item(@seed1.id, 1)
  589.         @seed1 = nil
  590.         @seed_window.refresh
  591.         $game_system.se_play($data_system.cancel_se)
  592.       else
  593.         back_to_map
  594.       end
  595.     elsif Input.trigger?(Input::C)
  596.       # Play Cancle SE if displayed and party has none.
  597.       if $game_party.item_number(@seed_window.seed.id) < 1
  598.         $game_system.se_play($data_system.buzzer_se)
  599.         return
  600.       end
  601.       $game_system.se_play($data_system.decision_se)
  602.       # Set first seed if not defined, else set the second seed and continue.
  603.       if @seed1 == nil
  604.         @seed1 = @seed_window.seed
  605.         $game_party.lose_item(@seed1.id, 1)
  606.       else
  607.         @seed2, @seed_window.active = @seed_window.seed, false
  608.         $game_party.lose_item(@seed2.id, 1)
  609.         @confirm_window.active = @confirm_window.visible = true
  610.       end
  611.       # Refresh seed window to show changes in inventory.
  612.       set_help
  613.       @seed_window.refresh
  614.     end
  615.   end
  616.  
  617.   def set_help
  618.     # Clear help window.
  619.     @help_window.contents.clear
  620.     # Draw items
  621.     text = @seed2 != nil ? 'Plant these two seeds?' : 'Select second seed...'
  622.     @help_window.set_text(text)
  623.     @help_window.draw_item_name(@seed1, 224, 0)
  624.     if @seed2 != nil
  625.       cw = @help_window.contents.text_size(@seed1.name).width + 320
  626.       @help_window.draw_item_name(@seed2, cw, 0)
  627.     end
  628.   end
  629. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top