Lets me just go through the script and try and explain it slightly more for you:
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# BEGIN CONFIGURATION
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#===============================================================================
# ** Garden
#===============================================================================
module Garden
SEED_IDS = [980, 981]
# This means that 980 will have a seed index of 0 and 981 a seed index of 1
SINGLE_IDS = [980,981]
# This means that both seeds could be planted seperately
HARVEST_SE = '056-Right02'
# This is the SE that will be played when the player harvests the plant.
SEED_DISPLAY = true
# If true, all seeds will be displayed in the seed window, including those
# that the player does not have, though they will be disabled. If false, only
# seeds that that the player currently has will be displayed.
# Define the growth rates here. (the average of both seeds will be used)
def self.growth_rate(seed)
return case seed
# when SEED_ID then SECONDS
when 980 then 12
# This means the Seed with Item Id of 980
# will have a growth rate of 12 seconds
when 981 then 6
# This means the Seed with Item Id of 981
# will have a growth rate of 6 seconds
else
10 # Default Value to return if no speed is specified
end
end
#-------------------------------------------------------------------------------
# Define the number of stages that each item uses. The stages will still cycle
# in the same order, but only use up to the defined number of them before going
# to the final graphic. This will not effect the duration that the seed takes to
# grow, only how many times the graphic changes.
#
# You do not have to define anything that uses a three stage configuration.
#-------------------------------------------------------------------------------
def self.number_stages(result)
case result
when 8..16
return 4
# This means if the result Item id is 8, 9, 10, 11, 12, 13, 14, 15 or 16
# Then it will have 4 stages of growth
when 17..24
return 5
# This means if the result Item id is 18, 19, 20, 21, 22, 23 or 24
# Then it will have 5 stages of growth
else
return 3 # Otherwise it will have 3 stages of growth
end
end
#-------------------------------------------------------------------------------
# Define the final result of the seeds. A random item from the array will be
# given as the final result.
#
# Each seed is given a value from 0 to the total number of seeds in the SEED_IDS
# array, and both values are added together to determine which 'produce' array
# will be used for the final result. This is why it is important that you have
# the SEED_IDS array in order of value/rarity. You can find the total number of
# cases you will need by subtracting 1 from the total number of different seeds
# in SEED_IDS, and multiplying that number by 2.
#
# EX. Player uses one each of the first and last seed in the SEED_IDS array,
# and there are 8 total seeds in the array...
#
# FIRST_SEED = 2
# LAST_SEED = 5 2 + 5 = RESULT
#
# By placing multiple copies of the same value in an array, you can increase
# the odds of receiving that item over another in the same array.
#-------------------------------------------------------------------------------
#-------------------------------#
# - Double and Single Seed - #
#-------------------------------#
# Now with Else/Defualt Clause #
#-------------------------------#
def self.produce(seed)
return case seed
when 0 then [9, 10]
# Only if both seed are the lowest seeds, 980 and 980
# This means it will produce an Item with the id of either 9 or 10
when 1 then [10, 11]
# Only if both seeds are 981 and 980
# This means it will produce an Item with the id of either 10 or 11
when 2 then [12, 13]
# Only if both seeds are the highest seeds, 981 and 981
# This means it will produce an Item with the id of either 12 or 13
else
[9] # Default Value to return, Brackets are important,
# May contain more than one value e.g [9,10] or [9,10,11,12,13]
end
end
#------------------------------------------#
# - Double and Single Seed New Method - #
#------------------------------------------#
# Table set up much in the same way as #
# .produce, however items come from seed #
# _ID_ not position in array #
#------------------------------------------#
# Also the ids are taken from SINGLE_IDS #
# Array #
#------------------------------------------#
def self.produce_single(seed)
return case seed
when 980 then [970] # Only if seed is the item with Id 980
# will it produce a resulting item of 970 if planted seperatley
when 981 then [3] # If the seed is the item id 981 then it will
# produce an item with the id of 3
else
[9] # Default Value to return, Brackets are important,
# May contain more than one value e.g [9,10] or [9,10,11,12,13]
end
end
#-------------------------------------------------------------------------------
# Define graphics for the final results, and each stage. Follow the below
# template to set it up.
#
# when ITEM_ID/STAGE then ['FILENAME', X, Y]
#
# ITEM_ID = The ID number of the item in your database
# STAGE = The stage during which to display the graphic
#
# FILENAME = The name of the character file the needed graphic is on
# X = The x-coordinate of the correct picture on the charset (1 - 4)
# Y = The y-coordinate of the correct picture on the charset (1 - 4)
#
# ← X → Ex. If the needed graphic was in the bottom
# 1 2 3 4 left corner: X = 1 Y = 4
# ┌──┬──┬──┬──┐
# 1 │ │ │ │ │
# ├──┼──┼──┼──┤
# ↑ 2 │ │ │ │ │
# Y ├──┼──┼──┼──┤
# ↓ 3 │ │ │ │ │
# ├──┼──┼──┼──┤
# 4 │ │ │ │ │
# └──┴──┴──┴──┘
#-------------------------------------------------------------------------------
def self.stage_graphics(stage)
return case stage
when 0 then ['Plants1', 1, 1]
# If stage is 0 then return the graphic 1,1 ifrom the file plants
when 1 then ['Plants1', 2, 3]
when 2 then ['Plants1', 2, 1]
when 3 then ['Plants1', 4, 2]
when 4 then ['Plants1', 2, 4]
end
end
def self.final_graphic(item)
return case item
when 9 then ['Garden Plants', 1, 1]
# If the resulting item is id of 9 then show the final graphic of 1,1
# from the file Garden Plants
when 10 then ['Garden Plants', 2, 4]
when 11 then ['Garden Plants', 3, 4]
when 12 then ['Garden Plants', 4, 4]
when 13 then ['Garden Plants', 1, 4]
when 14 then ['Garden Plants', 2, 2]
when 15 then ['Garden Plants', 3, 2]
when 16 then ['Garden Plants', 4, 2]
when 17 then ['Garden Plants', 1, 2]
when 18 then ['Garden Plants', 2, 3]
when 19 then ['Garden Plants', 3, 3]
when 20 then ['Garden Plants', 4, 3]
when 21 then ['Garden Plants', 1, 3]
when 22 then ['Garden Plants', 2, 1]
when 23 then ['Garden Plants', 3, 1]
when 24 then ['Garden Plants', 4, 1]
end
end
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END CONFIGURATION
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
This is an extract and is not meant for you to plug it in to the script, I've added extra comments and tried to follow roughly your example to show you how it can be set up.