[XP] Dynamic Gardening

Started by ForeverZer0, April 14, 2010, 05:44:04 pm

Previous topic - Next topic

XaineC

Please disregard my posts. It seems I've been using the wrong version. Sorry!

ForeverZer0

I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Mimi Chan

Why do you always make such awsum scripts O.O
This will definitely be in my game *.* (your weather thingy too ^^)

Would be cool though if you can water the plants or apply fertilizer (reduces growth time)
And is weather affected (rain will make it grow fast, though a storm might lower the produce, some plants grow faster on certain season, etc)
Different soil types o.O (for games that has a variety of environment, like a desert soil will be different from forest soil and certain seeds prefer certain stuffs)
I dunno if plants do cycle themselves (if left fully grown, will return to seed state, either random of the two seeds, or their combination)

And finally...a plant catalog O.O (to see the list of your grown plants *.*)

Might be too much though ^^;
Enough to make a Harvest Moon game I guess o.oa

What's a sig?

ForeverZer0

Those are some good ideas.

I especially like the idea of having weather, fertilizer, etc. affecting plant growth.
I am a little busy with my first CBS at the moment since I have taken it off hold, but I will definitely create an add-on once it is about done, or I may even squeeze it in if I feel the need for a little break from the CBS.

Thanks for the suggestions.  ;)
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Mimi Chan

November 12, 2010, 01:08:10 am #24 Last Edit: November 12, 2010, 02:38:08 am by Blizzard
Too bad idea is all I have @.@
I wish I could script too then I would make tons of unique script *.*

Anyway, I always like the idea of different scripts working together so they are seen as a big system, not isolated once that is just put there for the sake of it o.O

Also would be cool if map ID can be also used to affect growth/yield rate depending on the plant.  Like for example in densely tree'd forrest plants will go a tad slower (low sunlight condition) and will yield less (wild animals eating it) unless you put a scarecrow or other animal scaring stuffs o.O

And an open mountain area will make a seed grow faster because it has more sunlight o.O (though more devastating lost if hit by a storm)

Then different seeds will have different needs too *.* (Some like more water/light, while others don't)
While it may be too demanding to grow seeds, you can always just plant and leave them (but yeah, growth time and yield) Plus maybe if you grow the plant well, some might give you a rare different seed instead O.O

A berry catalog should prolly look like this (sorry for the quality, 5 mins mock up ^^;)
Spoiler: ShowHide
What's a sig?

Taiine

How about making the watering and such optional so those that want the more simple version of planting and letting it grow can have that. Also, what about needing just one seed to plant something?

Does this continue tom let thing's grow if you leave the map or must you stay on it?
I was thinking you could tie it to the games play time, so when you leave the map, and come back, it'll update the events with the correct growth to that of how much time has passed and have plants of various growth times.

Mimi Chan

Yeah everything is optional, but if you want to have the most yield with shortest time and probably a chance for a rare seed then you have to take care of them well *.*

You either just plant randomly and get a little, or you plan your planting and get a lot O.O
And I am pretty sure they grow even if you are out of the map, at least if Zero was the scripter ^^;
What's a sig?

ForeverZer0

Yeah, when I get around to to this idea, it will all be optional. It will likely be an add-on to this script, instead of a newer version, depends on what I come up with. I usually do try to keep features in newer versions optional, so that the script can still be used just as before if the user doesn't want all the extra features. This script's version 2.0 was one exception with how en event is set up, but it is only a one time deal, but it was an easy fix and the script itself is much more efficient because of it.

@taiine
To answer your questions, yes the plants continue to grow when the player is not on the map, and they are based off the game time, which was one of the changes made in 2.0. It is actually based off the Graphics frame count, but the game time is based off of that, so its all the same really.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Taiine

Well then... wonder how well this may work in my game.. or if not that then this smaller game project I've been tinkering with... hmmmmmmmmmm...

Should drop this in my test game of OMGTHATSALOTOFSCRIPS to test for conflicts  :P

Cavegiraffe


ForeverZer0

Quote from: Cavegiraffe on January 29, 2011, 02:52:47 pm
I found pedobear


Congratualations!  :D
I know WhiteRose found it, but I do believe you are the first to unwittingly stumble upon it (as far as I know).
I had completely forgot I had even put that in there until just recently. Isn't nice to know that pedobear is always watching?
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

radioacitve12

Hi. I cant configurate your awesome script, the Dynamic Gardening. I dont want to produce 16 products, only 1. This one is generated by every seed combinaton.
When i practice this script, this line have an error message: @character_name = graphic[0].
Thanks your help, yours sincelery

Xtar

You are probably making some mistake when adding stages or final graphics, it happened to me too once because of an error.

The system works almost perfectly, I just have one issue: sometimes the final graphics "move". There's a neverending looping between stage 0 and the last one. I kept the standard format of the script, I just changed IDs.

ForeverZer0

@radioactive12:
I am unsure exactly what is causing that error, but it most definitely sounds like a configuration error. Make sure that the graphic file is in the appropriate place, and named correctly in the script.

@Everone:
Xtar is right, there is a bug with the "final graphics". They will not "stick" and display the wrong graphic. Will update very soon when I get the time to fix it. Sorry for the inconvenience.  :shy:
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

ForeverZer0

May 12, 2011, 07:22:27 pm #34 Last Edit: May 13, 2011, 07:36:46 pm by Baraka
* Begins the rewrite  *

I have some ideas for vastly improving how the script is structured and how data is handled.
It will also remove the current bug of the final graphic not changing correctly.

EDIT:
The script is done, and working flawlessly with the new system. I'll post once I do some more extensive debugging and commenting.
It works completely different, but I managed to keep it so that you won't have to change a single line of your config for the new system, everything from the current version works in this one.

Compatibility has been improved, and the bug with the final graphic is a thing of the past.

EDIT 2:
Updated the script and the main topic.
Script has been improved and bug has been removed.
Screenshots have been added as well.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Taiine

Sorry for bumping. But I am having a issue and not sure if it's just me not understanding it right or if I'm doing things the wrong way.

I would like to only use one seed per plant rather then mixing two seeds and getting a random plant back based on the added values of the two seeds used. But I'm not really seeing away to do that with this script.


I am also getting this error when I tried adding in my own seed to your demo.

Pretty much made a new seed on the 25th item slot, and a new item to be grown in the 26th.

Went though everywhere, adding 25 as a seed, added it's growth rate,  didn't mess with the stages, added the produce matching the pattern, just adding 26 to it. Then added the when 26 use such and such sprite for final. Boom error.

Spoiler: ShowHide
SEED_IDS = [1, 2, 3, 4, 5, 6, 7, 8, 25]
 # IDs of the items in the database that are seeds. Add them into the array in
 # the order of value/rarity in your game
 
 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 1 then 10
   when 2 then 12
   when 3 then 15
   when 4 then 20
   when 5 then 23
   when 6 then 25
   when 7 then 30
   when 8 then 35
   when 25 then 50
   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
   when 17..24
     return 5
   else
     return 3
   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.
#-------------------------------------------------------------------------------

 def self.produce(seed)
   return case seed
   when 0 then [9, 10]      # Only if both seed are the lowest seeds
   when 1 then [10, 11]
   when 2 then [12, 13]
   when 3 then [13, 14]
   when 4 then [14, 15]
   when 5 then [15, 16]
   when 6 then [16, 17]      # Every combination in between
   when 7 then [17, 18]
   when 8 then [18, 19]
   when 9 then [19, 20]
   when 10 then [20, 21]
   when 11 then [21, 22]
   when 12 then [22, 23]
   when 13 then [23, 24]
   when 14 then [24, 26]         # Only if both seeds are the highest seeds
   when 15 then [26]        
   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]
   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]
   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]
     
     when 26 then ['Garden Plants', 4, 2]
   end
 end


Can you point out what I did wrong in the config? Everything works until I put two of the new seed together. I can mix the new one with others and no error, I just can't mix it with it's self.


I'd still like to only use one seed for each plant. But experimenting it just threw more errors attempting such.

ForeverZer0

The result of the combo is nil. Just missing the configuration in the "self.produce(seed)" method.
Your new seeds index is 8. If you combine two of them, the result is 16. You do not have a configuration for that combination. Try adding that and things will work fine.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Taiine

Alright thanks. Where did it read the new index as 8? I think that's the only part I am not understanding where it gets the values for such.

Also what about using just one seed for each plant?

ForeverZer0

The seeds array. The index (starting at 0) where the ID for that seed is in the array is the value. Since your seed is the 9th seed in the SEEDS array, it has an index of 8.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Taiine

Ah okay I get it now.


Still no answer on being able to use just one seed for plants. Is there anyway to do such? This system would work very nice for my game to have bonus plants you can grow to give you healing herbs or foods (and the only such plant system that still grows even if you leave the map). But would prefer use one seed per plant rather then two and receiving an item based on the id value of the two.