POINT N' CLICK GAME!

Make a point n' click adventure game in RM2k3 with Powermode! (minimal knowledge required)

This tutorial will explain how to make a working point n' click game (or other game with a working mouse-controlled cursor) in RPG maker 2003, using Powermode. If you haven't used Powermode before, open the spoiler below.


Download Powermode.
http://www.mediafire.com/download/xtitiguyzdj/pm2003.zip
The download here comes with instuctions, here's what you need for now:
- replace your project's exe with powermode's exe. The only difference between the two powermode exes are the fonts used.
- reserve variables 0001 to 0008. These are used by Powermode. 0002 and 0003 store cursor X and Y positions, 0004 stores the keys pressed (powermode supports all keys). You can name them accordingly.


First, we'll make a displayable cursor graphic. The pointing part of the cursor should be in the center of the picture. If it's not, you should add an equal amount of blank space on the opposite sides. You can see how my cursor is made:

...or maybe not, because I made the background white. But you can open the picture and see for yourself.

Now we can start something in RM.

Make a blank, 20x15 map. all your maps should be 20x15 in size so they will fit. I suppose bigger maps might be possible with some more coding, but I won't deal with it now.

Give your hero an invisible sprite and set a phasing mode to him with some auto-starting event that executes once and gets removed. A hero walking around the map interacting with stuff is not desirable here, and doing the above will ensure that he won't be getting in our way.

Time for the coding.
Make a common event - parallel process called "cursor movement". Then add the following commands:

<>Variable oper: [0002: Cursor X] Set, 5
<>Variable oper: [0003: Cursor Y] Set, 5

cursor position variables are updated if you set them to non-zero. I set them to 5 in above example.

<>Show picture: 50, <your cursor graphic>, (V[0002], V[0003])

I gave the picture an ID of 50 so even if I used some other pictures on my maps, the cursor will stay on top.

<>Wait 0.0 sec

Waiting 0 seconds for the RM means waiting one tic - this can really improve performance.

And that's the code. Basically, Powermode does everything for us, and here we have a cursor...


that doesn't do anything. Well, it does swing around the screen neatly. But something more would be nice.



So let's make our cursor activate events by clicking on them.

Add some commands to your first common event to make it look like that:


Variable oper: [0002: Cursor X] Set, 5
Variable oper: [0003: Cursor Y] Set, 5
Show picture: 50, <your cursor graphic>, (V[0002], V[0003])
Variable oper: [0011: Gridcursor X] Set, Var [0002]'s value
Variable oper: [0012: Gridcursor Y] Set, Var [0003]'s value
Variable oper: [from 0011 to 0012] / 16
Wait 0.0 sec


The variables 2 and 3 return us pixel coodrinates of the screen (0 to 319 or 0 to 239) allowing our cursor to move smoothly. Now, our new two "Gridcursor X and Y" variables are pixel coords divided by 16 (size of one tile), resulting in tile coords (0 to 19 or 0 to 14). These will correspond to event positions, which are tile-based.

By the way, tutorials for Action Battle Systems and such often fiddle with coordinates, and at some point you may be asked to do something like this:

if projectileX = monster1X AND projectileY monster1Y, play SE: "ouch".
if projectileX = monster2X AND projectileY monster2Y, play SE: "ouch".
if projectileX = monster3X AND projectileY monster3Y, play SE: "ouch".
if projectileX = monster4X AND projectileY monster4Y, play SE: "ouch".
if projectileX = monster5X AND projectileY monster5Y, play SE: "ouch".

it's not cool, to say the least. Fortunately, we can avoid it completely here by searching and calling events.

"Store Event ID" checks coordinates (specific or from variables) and saves event ID to another variable.

If there's no event here, it returns 0. Then you can Call Event - we want it to call a local event, with coords and page specified by variables.

So let's make another parallel process common event, it will deal with key input processing. We don't need Powermode extended key support here, because in Powermode the left mouse button doubles as Decision Key anyway.

So select "Key Input Processing" with the following options: Store Key Code in (or whatever variable you prefer for storing the keys), Wait Until Key Pressed, Keys to Process: Decision Key (5).
Make a Conditional Branch and if = 5, Store Event ID.
In "Store Event ID" window, select Location Referenced from Variables: X from , Y from

. Store Event ID in new variable, such as .
Event ID is now saved, and since the player just pressed the mouse button, let's try to activate this event. Make another Conditional Branch inside the current one, and if is not 0, Let's Call Event

: Select "Event Referenced From Variables", Event Number from, of course, and Page Number from yet another variable: . There's no point to call more than one page ("Preconditions" would be ignored anyway), so you can open your autostart event on the first map and set the to 1 there.

These are all Common Events you need, just ensure that the second one looks like this:

<>Key Input Proc: [0013:Buttons]
<>Branch if Var [0013:Buttons] is 5
<>Store Event ID: 9V[0011],V[0012]), [0014:Event ID]
<>Branch if Var [0014:Event ID] is 0 Not
<>Call Event: V[14][V15]]
<>
:End
<>
:End
<>Wait: 0.0 Sec
<>


Now the fun part. Put some events on your map and make them do something! You know, sounds, hello world etc.

Yay! How cute. Now when you start a game, you can click on them with your cursor and they will do their stuff.

You can also make them move around and you will see how the coordinates are updated. That's almost all, enjoy clicking on your events!

A few more important things to know when making your events:

- you can still make multiple pages with preconditions, but that would only affect the event's appearance. The only page activated will be the first one, so use Conditional Branches accordingly.

- Erase Event wouldn't work as well anymore. The event will disappear, but you will still be able to click on the empty space and activate the erased event. Again, use pages with preconditions for appearance and Conditional Branches on the first page.

- you can make more than one page without preconditions to ensure that your hero will never ever be able to activate events the usual way.



That's all! You can easily make your own adventure game in RM2k3 this way.