15 December 2009

Woodcutting Tutorial - RM2K3

Woodcutting DemoAn accompanying demo is available with this tutorial.

This is how to create a basic woodcutting process in RM2K3, similar to that used in Runescape, but without the experience points gained.

Using the "defaults" from a new Project, first create two common items: Handaxe and Logs.

Also, create a variable to store the number of logs chopped. In this example, 0001:Wood.

Next, create a map and place a few events on it, setting the event graphics to trees. Make sure you name each one differently, as each one also has a matching switch. For this tutorial, I created 4 "tree events", named Tree1, Tree2, Tree3 and Tree4.

Create another event for the Woodcutter, who will give you an axe with which to chop the trees down. In the Woodcutter's Event Commands, we'll need to set it up so that:

  • He first checks to see if you have a Handaxe. If not, he'll give you one. If so, he'll tell you how many logs you've chopped.
  • If you've collected the required number of logs (in this case 10), he'll congratulate you. If not, continue until you have the number of logs.

The code for this is as follows:
<>Branch if Handaxe Possessed
  <>Branch if Var[0001:Wood] is 10
    <>Message: Congratulations! You've collected 10 logs.
    <>
  : Else Handler
    <>Message: You've collected \V[1] out of 10 logs.
    <>
  : End
  <>
: Else Handler
  <>Message: You don't have an axe! Here, have this one!
  <>Change Items: Handaxe 1 Add
  <>
: End
The next step is to set up the trees so that they can be chopped down and you'll receive some logs. We'll start with the "Tree1" event.

Create 2 pages. In the Event Commands (Page 1), we need to:

  • Check once more if you have a Handaxe - you can't chop trees down with your bare hands, after all.
  • If not, display an appropriate message.
  • If so, change the tree to a stump and add the logs to the inventory, not forgetting to "store" the number of logs possessed.
  • Finally, add some sound effects and chop away!
<>Branch if Handaxe Possessed
  <>Play Sound: Axe Swing
  <>Wait 1.0 Sec
  <>Play Sound: Axe Swing
  <>Wait 1.0 Sec
  <>Play Sound: Axe Swing
  <>Wait 1.0 Sec
  <>Play Sound: Tree Falling
  <>Switch Operation: [0001:Tree1] ON
  <>Message: You received some logs.
  <>Change Items: Logs 1 Add
  <>Variable Oper: [0001:Wood] + , 1
  <>
: Else Handler
  <>Message: You'll need a handaxe to chop this tree.
  <>
: End

On Page 2, set the first switch under "Preconditions" to 0001:Tree1 and the "Event Graphic" to that of a tree stump.

Repeat the steps for the other tree events, changing the name of the switch to match the name of the event, i.e. in event Tree2 the switch name would be Tree2, and so on.

Now, of course, since we only created four trees, but need 10 logs for the tutorial, the trees would need to regrow. For this, we need to create a simple variable-based timer. Set the "Trigger Condition" (on Page 2) to "Parallel Process". In the Event Commands, place the following:
<>Variable Oper: [0002:Seconds] Set , 0
<>Label:1
<>Wait 5.0 Sec
<>Variable Oper:[0002:Seconds] + , 1
<>Branch if Var [0002:Seconds is 5
  <>Switch Operation: [000:Tree1] OFF
  <>
: Else Handler
  <>Jump to Label:1
: End
<>
Repeat for the other Tree events, once again changing the Switch Operation to the corresponding event name.

When you've collected 10 logs, speak to the Woodcutter and demo over.

Poll Results - December 1-13

The results of December's first poll are in!

Voters opted for more RMXP stuff (windowskins, scripts and charsets). So, it looks like my copy of RMXP will need to come out of hibernation.

At the moment, my preference is RMVX as the RPG Maker of choice for my project, The Gladiator Project. The reason for that is because RGSS2 is much more versatile, with several additional features not available in RGSS, that suit my needs for the project.

That said, and with the poll results in mind, what I'll do for the next few entries is this:

  • RM2K/2 - A basic "woodcutting" tutorial, which I recently rediscovered from a Runescape type project I started making quite some time ago.
  • RMVX - Another few updates on The Gladiator Project, including a tailor-made Status screen, menus and a Dramatis Personae.
  • RMXP - A few more windowskins, some of which are converted from RMVX, and a few scriptlets to start with.

Thanks again to all who voted in this poll.
Related Posts with Thumbnails
Template Design "Perfect World" by SkinCorner