Friday, November 7, 2014

Building a Canoe

Vehicles in RPG Maker VX Ace (without scripts) behave in a certain way. This post is concerned primarily with the "boat", which is not to be confused with the "ship". The ship is the typical RPG ship vehicle, which moves at double speed over ocean tiles (shallow or deep). Unlike in Final Fantasy (the first one), though, ships can dock anywhere on land - not just at ports - and it can also sail up rivers, basically making the boat obsolete once you get the ship.

The boat, on the other hand, instead of just paddling up rivers, can also traverse shallow ocean tiles. This can be an advantage or a disadvantage depending on what your game requires. But also depending on your RPG experience, it can be a little counter-intuitive (I'm finding that RPG Maker VX Ace is a bit of an amalgam of different RPG conventions from various sources, which is good in that it's not just a duplicate of one particular game, but can be frustrating if you're trying to model your own game after certain conventions you're used to from a particular title).

Anyway, I was wondering if I could build a canoe that works like the one in Final Fantasy, which doesn't act like a vehicle in that it sits on the map in one place and you board it, move around, and then disembark. The Final Fantasy canoe is more like an item you carry in your inventory: once you have it, previously impassable rivers are now passable. You don't need to find your canoe and board it first - you already have it with you. You just step onto the river, and your player graphic changes to the canoe, and once you step off, it changes back to your character.

Well, the RMVXAce "boat" doesn't work that way - it's a full-on vehicle, like the ship. But, as an exercise to demonstrate how to manipulate certain aspects of the game (in this case, without using scripts), let me describe a workaround I've come up with. To start with, the default settings ensure that the player can not simply walk over river tiles. This is easy enough to change, by navigating to the tileset tab of the Database, and changing the passage setting of the river tile on the "Field" tileset (second row, first column) from an X to an O.

Presumably, though, there'll be a point in your game before your character acquires the canoe. So, what you can do is copy the Field tileset and paste it onto another line (you may have to increase the maximum). On one of them, the river tile should be set to impassable, and on the other one (you should name it differently so you can tell the difference), it should be set to passable. Then, all you need to do is use the "Change Tileset" Event Command once your player acquires the canoe, on any maps with rivers, to change it from the default Field tileset to the new one with the rivers set to passable!

But, there's something you still need to account for. When you change a map's tileset via the Change Tileset Event Command, it resets whenever you leave that map. Furthermore, I don't think you can change the tileset of any other map than the one you're on when the Event triggers - which wouldn't work if you acquire the canoe in a town, and the rivers are all on the world map.

Well, here's what you can do: on any maps that have rivers, create an autorun event. It should trigger only once the player has acquired the canoe (you can check this with a switch, or else by whether the player has the canoe item, if you want to treat it that way). It should change the tileset of the map as discussed above and then erase itself (Erase Event). That way it will fix the map every time you enter it after acquiring the canoe, so that you will be able to walk over the rivers.

Now, then, you're going to need another event on the same map - a Parallel Process that runs only when the player has the canoe. This event is going to check the player's map position (by storing them in variables), and then determine the terrain tag (by storing it in another variable) of the tile the player is currently standing on (with the "Get Location" command). Of course, you'll have to go back into the Database and give the river tile (on the passable version of the Field tileset) a terrain tag (and make sure it doesn't conflict with any other terrain tags you might be using on the same map).

In the Parallel Process event, you'll want to run a conditional branch that checks whether the terrain tag of the tile the player is standing on (which you stored in a variable) matches the one you gave the river tile in the Database. If it does, use a Set Move Route command and change the player's graphic to the boat graphic, and then turn a self-switch on. Now you're in river mode.

Create a new page in the same event (also triggered by parallel process), with the conditional being the self-switch you just turned on. Now, you're going to do the same thing as before (get the player's position, store the terrain tag in a variable, then check that variable), but this time you want the conditional to run only when the terrain tag is NOT equal to the one you gave the river tile in the Database. When that happens, simply change the player's graphic back to what it was using another Set Move Route command, and then turn off the self-switch. You're back in land mode!

You can do all sorts of things now, like disable the save function when the player is on a river tile, by adding the appropriate commands to the event in the same place where you changed the player's graphic. You also may need to run a conditional branch when changing the player's graphic back, to determine which party member is at the head of the party. In fact, you'll probably want to disable Formation Access while the player is in the canoe as well, so the player doesn't switch out the canoe graphic for a different character. And, graphically, this canoe feature doesn't work well if you're using "Player Followers" (which I don't like anyway).

Those are the basics. It seems to work pretty well for me so far - I've even managed to get a waterfall cave (map transfer from river tile to dungeon, and back again) working. You can even dock the ship at a river mouth, too! Just like in the first Final Fantasy. I rigged up a nice little tutorial (like I've seen users do on the RPG Maker forums) that demonstrates how my FF canoe works - you can download it here and play it like any other RPG Maker game. Also, it's unencrypted, so you can open the project file up in RPG Maker and see just how all the events work. It's a lot like my Prefab Smithy, but taken just one more step further!

No comments:

Post a Comment