How to Make a Swinging Vine event(s)

Alright everyone. I spent a lot of time trying to figure out a way to do an event where a character jumps on a vine, swing across it, and jumps to the other end. I'm still tweaking things but I pretty much figured out the basics and figured this would be a great opportunity to give back to the community. To help with this little tutorial (and since I'm using it in my game anyway and I'm lazy) I've enlisted the help of Will from my own game to help guide us. Will, how do you feel about this tutorial?

1705823491758.png


Most likely, but I'm sure you'll be a good sport.

What you will need:

- RPGmaker MV (or anything compatible with Yanfly's Move Route Core Plugin)
- Yanfly's Move Route Core plugin

So the first thing you need is an event that records the player location and also the location of the vine. Some people have a common event for this already to record general movement for things like bridges, general movement tracking etc.

For me, I really only needed it for this one thing, so I made it an event on the map itself. so what you do is you create an event, make it a parallel in that event, set 4 variables, You can name them whatever you want, but for the sake of sanity, I'll name mine player x, player y, vine x, vine y like this.

1705823710134.png


when you set your x and y variables, you want to go to game data

1705823839811.png


Click game data on left and it will pull the window on right. For player x, set to map x. Player y set to map y. This will make it so it's constantly recording the horizontal and vertical location of your main character.

For vine x and y variables, you want to set it to the name of whatever you name your vine event to be. So lets say I have a vine sprite and I name it Vine1A, well then I'd go in this same window and set "Vine1A" under character and set to Map x for the Vine X variable, and then do the same thing for the Y, set map Y to Vine1A for VineY variable.

1705824347850.png


You may be wondering why I have a vine1A. Well, basically vines are long, right? So I actually have a vine that's 2 tiles long. They both move in sync with each other as part of this. Within reason you can make your vine longer. Regardless of how many tiles long your vines are, you only need to get the x and y of one of those tiles. Once you have the parallel event grabbing the x and y locations of both player and vine, then it's time for step 2.

1705824542393.png


Oh I'm dead serious.

1705824980834.png


So the layout I have is these three events. Our player is going to jump on the vine. The two (or three or however many you want) vine events will swing back and forth in tandem, and the player can hit a button at any time to jump off of it. If they hit the button at the wrong time, the fall will miss and the player will hit the ground. If they succeed they make it over to the vine on the other end. Let's look under the hood at these events in detail.

First we have our invisible event on the left. Page one looks like this:
1705825213033.png

So we set page one to touch. we set the choice to if they want to jump or not. If they do, then gather followers and turn followers off temporarily, (that way your followers aren't trailing behind while you swing) and then we do the movement route for the jump. Then we wait, then we turn on the vine switch. The vine switch is what will trigger the vine to do the swinging motion. Since nobody is on it up until that point, it isn't swinging then. Page 2 of this event is the one doing the lion's share of the work. Before I show page 2 for this, let's look at the vine events real quick:

1705825519463.png
This leads us to
This is page one of the bottom part of the vine. This is the vine when it's not moving. Page two looks similar except for a few things.

1705825661057.png


1) The trigger is set to parallel. 2) The "On Vine" switch triggered from the invisible event is a requirement here. 3) the vine is set to do a repeated custom route. For the top half of the vine, you basic repeat both of those two prior event pages. The final step is the second event page for our invisible event, which is where all the fun eventing and coding goes in. Before I continue, I'm going to break this up into a multi post thing, because I don't know if there's a post size or image limit per thread post or not...
Okay, so for the next part, let's go back to our invisible event, page 2. You know how I said I did my x y variable gathering just for this one map? well, I actually put that on the same page as the rest of the event. Probably a less sloppy way to do that, but it works. So here's what page 2 of that event looks like: I'll post all the images and then break down step by step:

1705826143890.png


1705826173176.png

1705826214015.png

Okay, so the top, as I mentioned before, is how the parallel event is constantly grabbing the location of both the player and the one of the vine events. It only turns on when the switch is selected by the player agreeing to jump on page 1. Next we have a conditional. This conditional says if the player hits the ok button, they jump 2 to the right. After that, the event gets the new x coordinate of the player. If that coordinate is less than what the coordinate for the vine on the other side, then it triggers the fall. In my case the coordinate is 20.
1705826564621.png

You can get that coordinate by looking at the bottom right corner. The first coordinate is the x, the second the y.
After you have you if condition, you set the player to through so they fall "Through" the wall, crank up the speed, and change your player image to whatever the "dead" image is for your player (they're falling after all) Usually if they're falling down, it will show that image by default anyway. I have some fun text and banter after the player falls, then I turn the through back off (So the player can't walk through walls, change the speed back to normal, change the main character image back and then walk down a bit.

1705826800384.png

This section here, is more scene management stuff. We fadeout the screen after the player has moved, turn followers back on (otherwise they just appear out of nowhere, and then we make sure the variable for vine x is set back to the actual location of the vine event. This next if statement is there to reset the vine. The if statement checks to see if the vine is in the correct location. If it's not, it moves the location. This is where the Yanfly plugin comes in. The first one goes into Movement: and uses the yanfly script "teleport" to reset the vine back to it's original location before it moved. The second does the same but for the other half of the vine. Once the vine resets, then you fade in screen so it doesn't look weird.

The next section is the else. So earlier we did an if to check to see if the player had reached the x coordinate we were wanting, the else is if the player meets that requirement and jumped to the correct coordinate.
1705827198471.png

In this case, once we've confirmed the player has safely made it to the other side, we need to reset their speeds to the correct speed and turn through off so the player doesn't move through walls. We also change the followers on here as well. Like previous, we recheck the variable of vine x and make sure it maps to the actual x of the vine event. Like before, if the vine was not reset, we check for that with the next if/then statement and then teleport. since the player was brought to the other side, we want to reset the vine within jumping distance of the player.

Finally after all these conditions, we last check for the condition that keeps the player swinging on the vine.

1705827515425.png

First it checks to see if the player x coordinate matches the vine. If it does not, it turns through on, walking and stepping are turned off so it doesn't look like the player is walking while they swing. Yanfly plugin script is put in in the move menu. Make sure when you do MOVE TO: EVENT that you put in the event ID, not the event name, or it won't work. Each event id will show listed on top of the event page itself. Finally, you have through turn off and walking animation back on
1705827658338.png
And there you have it, when you finish it should look something like this:

1705827794090.png


If missed:

1705827889669.png
1705827859720.png
1705828040592.png

If landed

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-swinging-vine-event-s.164986/