[XP] Dynamic Gardening

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

Previous topic - Next topic

ForeverZer0

The two seed way of working is implemented into the script.  It would not be terribly difficult to edit to allow for only one seed, but more than I'll be doing at the very moment.  If anyone else would like to volunteer to make the required edits, I'd be more than happy to post it up and give credit.
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.

Twb6543

July 14, 2011, 03:17:52 am #41 Last Edit: July 14, 2011, 01:46:46 pm by Twb6543
I'll have a go at it tonight, Would you like me to post the script or pm you with it for you to add.

- Script Edit 80% -
TODO:
Key: item(Percentage of script)
- General Clean up (Makes up 5%)-
- Change the Seeds Array Used (Makes up 3%)-
- Windows Edit (Makes up 12%)-



-Script Edit 95%-
TODO:
- Clean up(5%) -
o Pm ForeverZer0 the new Script
o Write up the documentation(change logs, etc)
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

Taiine

Thanks for taking it on :3 I'm trying to gather and make sure all the scrips I have are up to date and working as due to being laid off, have to cut back on some of the bills and sadly the net is one of them. So after the 30th I may be gone for a few months until I find another job. But I hope to still work on my game and by the time I come back have a good sized demo for people to test place. :3

Twb6543

Finished the Script for now, It's been pm'd to ForeverZer0. Just need to check he's ok with it (as it tries to replicate the script style) and whether he wants to post it himself... Also currently you can not use a seed as a double and single plant, but I am going to fix it.
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

ForeverZer0

Quote from: Twb6543 on July 15, 2011, 11:00:04 am
Finished the Script for now, It's been pm'd to ForeverZer0. Just need to check he's ok with it (as it tries to replicate the script style) and whether he wants to post it himself... Also currently you can not use a seed as a double and single plant, but I am going to fix it.


I'll update the topic when I get from from work in a few hours.
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

Single seed variation to the script has been added to the main post.
All credit goes to Twb6543 for the edits. 

@Twb6543:
Thanks again!   ;)
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.

Twb6543

July 16, 2011, 06:44:47 am #46 Last Edit: July 17, 2011, 09:53:44 am by Twb6543
It's fine, I'm currently trying to change it so that seeds can be used singly or in a pair. Current process on that is about 10%, sorry for making another update for the script but some people may like the option to use a seed either way and also I found a few faults in the system.

Current Bugs in Single Seed Variation of ForeverZer0's Dynamic Gardening
- Nil graphics error may occur if you choose a Double seed then a Single seed
 - Reason, Forgot to change what seeds are shown after choosing a seed... Fix will be with the new version
- Seeds do not return if you choose not to plant them (This is from ForeverZer0's version)
 - Mostly Fixed (once got a duplication bug but mainly it's fine) - Fix is in next version
- Refresh issue (item numbers do not refresh) (This is from ForeverZer0's version and also my edits to the script)
 - Fix is in next version
- And Others


Script Status: Not Finished // 90% One annoying bug to squash and code cleanup left to do.
BUG left is the seeds still not updating... (pick double/s-d seed single seeds still stay the same (s-d means a single/double seed) )...


Script Status: Finished // 100%
- Code still needs quite a bit of cleanup


Bug fixed due to me stupidly using .concat() instead of + whilst making the seed list. :facepalm:
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

Twb6543

- Twb6543's Single Variation of Dynamic Gardening by ForeverZer0 is now Version 3.2 -

- Main post has been updated -


ChangeLog :
- Changed Scene_Garden to ask if the player wants to plant only one seed if the the first seed selected is a   
   Single seed Id...
- Single Seeds can now also be Double Seeds (and vice versa)

BugFixes:
- Fixed the Graphics not updating issue...
- Fixed the Seeds not being given back to the player if cancelling a seed option...
- Fixed Nil graphics Issue...
- Fixed Single seeds option removed when second seed is being chosen...

NewBugs:
- Duplication bug may occur (this happened whilst testing 3.2s release (unfinished at that time, may be fixed))

Notes:
- The code is not optimised and is over the top in the class Window_Seed and class Scene_Garden, this is due
    to an annoying bug that occurred in the unfinished version that was the last thing stopping release of Ver
    3.2, the over the top code was my attempt to stop this bug before I realised I was using '.concat()' rather
    than '+'.
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

Sacrifyx

I'm having an issue with this script, more precisely with its configuration. I'm using a single seed dealie-o.
For testing purposes, I've set up one seed and one result item.
The seed has ID 980, the result item has ID 970.
I get the seed_id, single_id bit, that works fine.
I get the growth rate bit as well - when 980 then 10 - so seed grows at 10 second intervals or some such? Don't know for sure, but that bit works fine too.
The next bit is throwing me off. I don't understand how to define the number of stages - the numbers already there don't make any sense. when 8..16 return 4...eh?
Anyhow, if I can avoid messing with that, I will - I don't see any need to change it anyway. The big problem is the end result - it always gives me item ID 10, which is something I definitely don't want growing in the ground. How would I change it so a specific seed gives me a specific item every time? I can't seem to find that anywhere in the script...

ForeverZer0

Read the instructions more carefully in the section for the results.
Here's an a quick example:

SEED_INDEX = [4, 5, 78, 980]


This makes seed with Item ID of 980 have a seed index of 3 (array indices start at 0, not 1)

Then, in the config for the item results (if you are using the single-seed variant), it would look something like this:

when 3 then return [970]


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.

Sacrifyx

Well...I got the first item to work, so I decided to throw another one in to see if it was just a fluke.
SEED_IDS = [980, 981](this is what you meant by SEED_INDEX?)
SINGLE_IDS = [980, 981] (not sure if I needed this in both spots, but doesn't seem to hurt)

Set up the time...didn't mess with the stages as I still don't understand how that works.

Under results:
when 980 then [970]
when 981 then [3] (already had an item for this seed set up)

Duplicated that under the single seed part, again not sure if that's necessary or not. So, it looks like my method is a little off compared to yours and I still don't understand how or why it works or why it didn't before, but it works now and that's all I care about. I believe you said earlier in the thread you might add a watering feature to it at some point in the future, definitely looking forward to that! Thanks for the quick reply!


Twb6543

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.
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

Sacrifyx

October 25, 2011, 02:18:39 pm #52 Last Edit: October 25, 2011, 02:56:03 pm by Sacrifyx
That was beautiful, and actually cleared up quite a bit of confusion, particularly around the growth stages bit. I'm gonna copy the comments from your example into the comments in the script (old age and memory, you know how it goes) so I have that reference. Thanks much!

Quick edit for a question: If the seed IDs are also in single IDs, will I still be able to use them in a two-seed process, or will they only work individually? I initially shied away from the two seed thing, but after thinking on it, that kind of thing will be handy for what I have planned.

Edit 2: In testing it looks like I've answered my own question above, however, in the test event, I have the farmer give the player 1 carrot seed and 1 potato seed. When I go to plant, carrot seeds are listed once, but potato seeds are listed twice, like so:
Potato seed: 1
Potato seed: 1
Using one potato seed causes the other instance to disappear as it should, and this did occur using the other method I was prior to your explanation, just wondering if this is a bug in the script or if you've heard of or seen this happening before.

Edit 3: Additional testing (adding a 3rd seed/item and swapping around the seed index) would seem to indicate that the issue is with whatever has seed index of 1.

Twb6543

October 26, 2011, 05:19:22 am #53 Last Edit: October 26, 2011, 05:32:48 am by Twb6543
I'll look into it, in a second or two, As I probably have said this more of a hashed together edit and the first single seed variant did have a few problems which may have carried other into the recent version.




I currently can not replicate the results, Would you pm me a link to a archive of the project (e.g. a rar or zip file uploaded to the media fire, dropbox, etc). So I can look into it, So far I have not found anything in the code that would cause that.



The way the system of the seed list works is that it creates the normal double seeds list and then adds to it any seed in the single seed ids that are not in the double.

For example
Double Seeds 1,2,3
Single Seeds 1,3,4,5
Would Result in a seed list of 1,2,3,4,5
If you plant 1 or 3 first then a choice menu should appear with the options to add a new seed to the mix or just plant one.
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

Sacrifyx

October 26, 2011, 05:36:37 am #54 Last Edit: October 26, 2011, 06:07:19 am by Sacrifyx
Gimme a bit to slap together the necessary bits and I'll pm you a link.

Edit: Check your inbox.

Twb6543

October 26, 2011, 06:45:42 am #55 Last Edit: October 26, 2011, 06:53:01 am by Twb6543
- Twb6543's Single Variation of Dynamic Gardening by ForeverZer0 is now Version 3.2.1 -


ChangeLog :
- Optimised the code for generating the seed lists.

BugFixes:
- Fixed the Extra Seed Glitch that occured (Still have no Idea how it happened)

NewBugs:
- None Found whilst Testing

Notes:
- Yet to be integrated into the normal script, first version was pm'd to Sacrifyx.
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

ShadowIce

Can u make this script online so other players can see ur garden? :) Thanks! :D

firevenge007

Can you get this to give farming experience in the single seed script or is this not possible?

Thanks.

KK20

It shouldn't be too hard to implement. It will require another configuration option, something like when ITEM_ID then return EXP, and another variable stored in $game_party most likely to hold the farming experience.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

firevenge007

How about seed level requirements as well? Would that be hard to add on?