Gw Temp

Menu

Tutorial - 'Field System' by Davinator

An item about RPGMaker 2000 posted on

Blurb

Make a field system in your RPG like in harvest moon!

Body

In this tutorial I'll explain how to make a field system like in Harvest Moon.



What is a Field System?!

A field system is very simple yet very cool. You buy seeds at a schop, and plant them on your field and they will grow to different types of crops.





What we need:

-Basic knowledge of switches

-Basic knowledge of variables

-Basic knowledge of forks

-Many switches

-Many variables

-One common event



First we will set up a shop which sells seeds to grow crops.


Make 3 items:

Carrot seed

Cabbage seed

Potato seed

(If you want more different types of seeds, go ahead.)

Make a room called: Seed Shop (or something like that)

Make an event which sells these items. You can do that using the default Shop-menu RM2K(3) has or through a choice menu, which pretty much explains itself.



So, now we have a shop that sells seeds. Now we need a field to plant them.


Make a new map called: Field (or something like that)

Make the layout as you like, I just add a field with a little tool-shed.

In the field, add an event which asks you to plant the seeds etc.

Make it a Push Key event and start condition Same Level as Hero or Below Hero if you want the hero to stand on it.

Add a message which asks you if you want to plant a seed.

Show choice Yes or No.

When player choses Yes, add a message which asks what seed he wants to plant

Show Choice Carrot seed, Cabbage seed or Potato seed

When the player selects a seed, first check if he has the seed.

Add a fork condition which checks if the player has item Carrot/Cabbage/Potato -seed. Add Else case. In the else case, add a message that tells the player that he doesn't have the seed. You can let him go back to the seed menu by adding labels.
But isn't necessary.

It should look like this now:



<>Msg: Do you want to plant a seed?
<>Show Choice: Yes/No
:[Yes] Handler
<>Msg: What seed do you want to plant?
<>Show Choice: Carrot seed/Cabbage seed/Potato seed
:[Carrot seed] Handler
<>If: Hero has Carrot seed:
<>
[Else]
<>Msg: You don't have Carrot seed
:End
<>
:[Cabbage seed] Handler
<>If: Hero has Cabbage seed:
<>
[Else]
<>Msg: You don't have Cabbage seed
:End
<>
:[Potato seed] Handler
<>If: Hero has Potato seed:
<>
[Else]
<>Msg: You don't have Potato seed
:End
<>
:[No] Handler
<>
: End
<>




I hope you understand that, if you don't; read it again or just exactly do what the coding says.

Now, the hero has the seed and has to plant them.

Below the If Hero has ....seed, turn a switch on which tells an event that the seed has been planted.



!!!Problem: The event which let's the seed grow, doesn't know which part of the field has been planted.
So we have to make one switch for every seed on every piece of land.


Example: Potato1
Potato2
Cabbage1
Cabbage2
Cabbage3
Carrot1



Etc etc.

So, suppose that we just planted a Potato seed on field 2, turn switch Potato2 on.
Now the common event knows which part of the field is planted and with what seed. :Problem!!!



Now you have to make different pages which checks if this part of field is already planted. Make a new page for Potato, Cabbage and Carrot.

Select switch in the preconditions tab, and select the Carrot/Cabbage/Potato switch.

Make the page a parallel process, and don't add anything, you'll see why later.



I will not add the code here again, or else this tutorial will be way too long.

I suppose you know how to turn a switch on... If not, read the Help File in RM2K(3) and learn something about switches.



Okay, we can now plant seeds. COOL!
But we need to check when we can harvest them again.
We will add that on the "planted-pages". (the ones which appear after you planted a seed)

-----This can probably be done with common events, but I encountered problems-----



!!!Problem: So, it seems like we need a timer system... It's very simple and I'll put the code here, just copy it.
Make a common event called timer. Make it a paralell process and make a trigger switch which let's you turn it on when you want it to. Add this code:



<>Wait 0.3 sec
<>Change Var [Timer minutes] +1
<>If Var[Timer minutes] = 60
<>Change Var [Timer hours] +1
<>Change Var [Timer minutes] Set 0
<>If Var[Timer hours] = 24
<>Change Var[Timer days] +1
<>Change Var[Timer hours] Set 0
<>If Var[Timer days] >30
<>Change Var[Timer months] +1
<>Change Var[Timer days] Set 1
<>If Var[Timer months] = 13
<>Change Var[Timer years] +1
<>Change Var[Timer months] Set 1



So, that's the timer system. :Problem!!!




We planted a cabbage seed on field 1, so go to the page you created which is empty because the seed has already been planted. Make sure it is a paralell process and started by the switch Cabbage1. (that's for this field with cabbage planted)
We need to make a variable for every field and every seed, same as the switches.
(it's getting pretty complicated...)

So, for this event, we now use Variable Cabbage1 and Switch Cabbage1.

The day advances with 1 on the 24th hour.

So, make a conditional branch (if case) which checks when it is the 24th hour.

If Var[Timer hours] = 24
Change Var[Cabbage 1] +1



Every time it is the 24th hour, the variable Cabbage1 gains 1.

We wanted to make the crop harvestable after 3 days, so when the variable Cabbage1 reaches 3, we want to turn on a switch which tells the event the crop can be harvested.

If Var[Cabbage1] = 3
Change Switch[Cabbage1b] On
Change Var[Cabbage1] Set 0
Change Var[Cabbage1] Off



You probably noticed, that we need more switches. For every crop in every field. You can name it Cabbage1b or something you want.
We need to create a new page, with precondition Switch Cabbage1b.

Make it a Push Key event with Same Level as Hero or Below Hero, just what you like. You can give the event a graphic of a cabbage, if you want.

Add a message which says: Do you want to harvest Cabbage?

Then show choice Yes or No.

Under No, do nothing, just end the event.

Under yes, give the player the item Cabbage. And then turn off switch Cabbage1b.

Now, the player has harvested the Cabbage and he can plant a new seed.

(For the Carrots and Potatoes, do the same, only the switches and variables are called different.)

If you want, you can eat the crops or sell them. But I won't explain how to do that here, because the tutorial is already very long.




Okay, I hope that was helpful, and that you learned something.

If there is an error, contact me on GamingW through PM. (My name there is Davinator)



-David