This tutorial will show you how to create an in-game jump event that can be used at any time, without causing the game to freeze, as is normally the situation in 2k3. This will allow you to jump any time, and will automatically recognise if the player is trying to jump to no-go zone, such as an ocean, a cliff-face, or a non-walking tileset. This was completed in 2k3, but I assume it can be adapted for XP and VX.
Make yourself a map first, that will give you something to jump around. Include some no-go areas, like cliff or water. Here's my attempt:
Create a new common event, and make it a parallel processing event.
First, create a conditional branch to check that jumping is enabled. You can then turn this off whenever you deem appropriate, such as in buildings, where you may not want the character to leap around, but remember to turn this switch back on later. Create a Key Input Processing event, set a key to press to allow jumping (such as shift, "0" and so forth), then run a conditional branch event that checks that the key input variable is equal to that number.
Check the sprite’s facing through conditional branches, and for each possibility, set the X Coord and Y Coord. YOU NEED TO SET EACH INDIVIDUALLY THROUGH VARIABLE OPERATIONS INSTEAD OF USING THE EVENT “MEMORISE POSITION.”
I have emphasised this heavily because the event will not work if you do not do this. For some reason, setting the coordinates through Memorise Position does not work, so set it through variable operations. For the Hero facing up, take two from the y coordinate (if your jump event is to move two spaces). When facing right, add two to the x coordinate, when facing down, add two to the y coordinate, and when left, take two from the x coordinate.
On the second page, bottom of the left column is an event called “Terrain ID.” Set this to the X and Y coordinates. Create a conditional branch if this variable is 10 (Or create a custom terrain number for this, if you wish.) For every tileset which you do not wish a character to land on, set this to 10 in the tileset screen.
If the conditional branch is met, leave it blank. If it is not met (you can move on the tile in some way), set the jump event – Move Event > Hero > Begin Jump, Move [Direction], Move [Direction], End Jump. You can also set conditional branches for other numbers, such as swamp, if you feel players should not be jumping in these areas.
This is an example of the coding, and shows the events required for two different sprite facings. The rest of the code is nearly identical, apart from the modifications I outlined earlier.
Now, your jump system should be complete. You should be able to jump around freely without causing the game to freeze, and your character will not jump into no-go areas. The game should automatically stop you if you try and jump over a cliff or into water. Here is an example of the event in action.
Hopefully, this will help you implement a jumping system into your game. I hope people can find a use for this. Please feel free to leave feedback or comments if parts need clarification or you feel that there need to be modifications made to this tutorial.
EDIT: Pictures not displaying properly.