FREQUENTLY ASKED QUESTIONS Making the sidekicks follow the hero in RPGMaker 2000 by Jason Godding, 5/11/2002 Ever since I released my RM2K game, Jay's Journey, I've been getting lots of questions about how to make the sidekicks follow the hero ("caterpillar", as it's called by some.) So this FAQ will tell you the necessary steps. First of all, you need to play Jay's Journey. Don't ask why. Just play it! You can find it at http://www.geocities.com/jaycrono/jj/ or http://www.angelfire.com/rpg2/jay/ Okay, okay, shameless plug over. All events in coding will be between sets of six stars. ---GETTING STARTED--- The REAL first thing you'll need is a new game. Yes, you can implement this in an already-started game, but it'll be MUCH easier to insert into a new one. If you've already made your game partway, you'll have to remake the events on every map to compensate, which is a bit of a hassle. Start with a "dummy" (player never enters) map. We're going to use this as a test map. For right now, put your Party Start event here. Now make one (and only one) event, right next to the Start Position. Make it look like a character. It's going to be Parallel Process, Same Level as Hero, movement type Stay Still, Movement speed Normal, Animation Common/Without Stepping. Call it "First Tagalong" Now assign some variables: HeroX HeroY Follow1X Follow1Y Distance1X Distance1Y Now for some coding! ****** {First Tagalong; Page 1; Parallel Process} Move Event: This Event - Start Slipthru Variable Change: HeroX, Hero's X coordinate, Set Variable Change: HeroY, Hero's Y coordinate, Set Variable Change: Follow1X, This event's X coordinate, Set Variable Change: Follow1Y, This event's Y coordinate, Set Variable Change: Distance1X, HeroX, Set Variable Change: Distance1X, Follow1X, Subtract Variable Change: Distance1Y, HeroY, Set Variable Change: Distance1Y, Follow1Y, Subtract ****** First, we make sure the hero can walk through the tagalong if need be. Then we set those variables. The only ones directly important to the rest of the code, though, are the Distance variables. These variables denote the signed distance between the hero and the tagalong. We want these to always be either one or zero. Soooo... ****** {First Tagalong; Page 1; Parallel Process, cont.} Fork: Distance1X is above 2 - Move this event Right End Fork Fork: Distance1X is less than -2 [note the minus] - Move this event Left End Fork Fork: Distance1Y is above 2 - Move this event Down End Fork Fork: Distance1Y is less than -2 [note the minus] - Move this event Up End Fork ****** That takes care of that. There's still one problem, though. We want the tagalong to follow the hero's movements pretty closely. As is, it will just stand when the hero is at an angle to it. So, let's take care of that one. ****** {First Tagalong; Page 1; Parallel Process, cont.} Fork: Distance1X = 1 - Fork: Distance1Y = 1 - - Fork: Hero is facing Right - - - Move this event Down - - Else - - - Move this event Right - - End Fork - End Fork End Fork Fork: Distance1X = 1 - Fork: Distance1Y = -1 - - Fork: Hero is facing Right - - - Move this event Up - - Else - - - Move this event Right - - End Fork - End Fork End Fork Fork: Distance1X = -1 - Fork: Distance1Y = 1 - - Fork: Hero is facing Left - - - Move this event Down - - Else - - - Move this event Left - - End Fork - End Fork End Fork Fork: Distance1X = -1 - Fork: Distance1Y = -1 - - Fork: Hero is facing Left - - - Move this event Up - - Else - - - Move this event Left - - End Fork - End Fork End Fork ****** Okay, now that we have that done, save it and play. Wheeee, your hero is being followed! If you're getting a lag, try putting a "Wait 0.0" command after the variable assignments Actually, you might want to do that anyway. Oh, but I'm afraid we're far from done. Make a second event, which we'll call "Second Tagalong", and make it as such (you'll need a few more variables of course: ****** {Second Tagalong; Page 1; Parallel Process} Move Event: This Event - Start Slipthru Variable Change: Follow2X, This event's X coordinate, Set Variable Change: Follow2Y, This event's Y coordinate, Set Variable Change: Distance2X, Follow1X, Set Variable Change: Distance2X, Follow2X, Subtract Variable Change: Distance2Y, Follow1Y, Set Variable Change: Distance2Y, Follow2Y, Subtract Fork: Distance2X is above 2 - Move this event Right End Fork Fork: Distance2X is less than -2 - Move this event Left End Fork Fork: Distance2Y is above 2 - Move this event Down End Fork Fork: Distance2Y is less than -2 - Move this event Up End Fork Fork: Distance2X = 1 - Fork: Distance2Y = 1 - - Fork: First Tagalong is facing Right - - - Move this event Down - - Else - - - Move this event Right - - End Fork - End Fork End Fork Fork: Distance2X = 1 - Fork: Distance2Y = -1 - - Fork: First Tagalong is facing Right - - - Move this event Up - - Else - - - Move this event Right - - End Fork - End Fork End Fork Fork: Distance2X = -1 - Fork: Distance2Y = 1 - - Fork: First Tagalong is facing Left - - - Move this event Down - - Else - - - Move this event Left - - End Fork - End Fork End Fork Fork: Distance2X = -1 - Fork: Distance2Y = -1 - - Fork: First Tagalong is facing Left - - - Move this event Up - - Else - - - Move this event Left - - End Fork - End Fork End Fork ****** Yup, it's just like the last event with some minor changes. Now do it again with the third character: ****** {Third Tagalong; Page 1; Parallel Process} Move Event: This Event - Start Slipthru Variable Change: Follow3X, This event's X coordinate, Set Variable Change: Follow3Y, This event's Y coordinate, Set Variable Change: Distance3X, Follow2X, Set Variable Change: Distance3X, Follow3X, Subtract Variable Change: Distance3Y, Follow2Y, Set Variable Change: Distance3Y, Follow3Y, Subtract Fork: Distance3X is above 2 - Move this event Right End Fork Fork: Distance3X is less than -2 - Move this event Left End Fork Fork: Distance3Y is above 2 - Move this event Down End Fork Fork: Distance3Y is less than -2 - Move this event Up End Fork Fork: Distance3X = 1 - Fork: Distance3Y = 1 - - Fork: Second Tagalong is facing Right - - - Move this event Down - - Else - - - Move this event Right - - End Fork - End Fork End Fork Fork: Distance3X = 1 - Fork: Distance3Y = -1 - - Fork: Second Tagalong is facing Right - - - Move this event Up - - Else - - - Move this event Right - - End Fork - End Fork End Fork Fork: Distance3X = -1 - Fork: Distance3Y = 1 - - Fork: Second Tagalong is facing Left - - - Move this event Down - - Else - - - Move this event Left - - End Fork - End Fork End Fork Fork: Distance3X = -1 - Fork: Distance3Y = -1 - - Fork: Second Tagalong is facing Left - - - Move this event Up - - Else - - - Move this event Left - - End Fork - End Fork End Fork ****** Now save again and play again. Whee! Now you've got four characters in a nice neat line. ---WHEN CHARACTERS ARE AND AREN'T ACTIVE--- What happens when you don't have a character available? Okay, first of all, you need a switch for each character (preferred only there are only four characters total) OR you need a set of variables meant to keep track of your whole team's lineup. You should use the latter if you have a variable party, and I will assume from here on out that that's the case. Here's a rundown of what I mean: Variables: Chara1 - holds the character number of the character in the first position OR zero if the party is empty. (This one won't affect the follow system in any way) Chara2 - holds the character number of the character in the second position OR zero if there isn't a second character. Chara3 - holds the character number of the character in the third position OR zero if there isn't a third character. and so on... Now, first of all, open up your First Tagalong event. Copy the first page, and paste it. On the FIRST of your copied pages, make it invisible (a blank sprite) and change it as follows: ****** {First Tagalong; Page 1; Parallel Process} Move Event: This Event - Start Slipthru Variable Change: HeroX, Hero's X coordinate, Set Variable Change: HeroY, Hero's Y coordinate, Set Variable Change: Follow1X, This event's X coordinate, Set Variable Change: Follow1Y, This event's Y coordinate, Set Variable Change: Distance1X, HeroX, Set Variable Change: Distance1X, Follow1X, Subtract Variable Change: Distance1Y, HeroY, Set Variable Change: Distance1Y, Follow1Y, Subtract Fork: Distance1X is above 1 - Move this event Right End Fork Fork: Distance1X is less than -1 - Move this event Left End Fork Fork: Distance1Y is above 1 - Move this event Down End Fork Fork: Distance1Y is less than -1 - Move this event Up End Fork Fork: Distance1X = 1 - Fork: Distance1Y = 1 - - Fork: Hero is facing Right - - - Move this event Down - - Else - - - Move this event Right - - End Fork - End Fork End Fork Fork: Distance1X = 1 - Fork: Distance1Y = -1 - - Fork: Hero is facing Right - - - Move this event Up - - Else - - - Move this event Right - - End Fork - End Fork End Fork Fork: Distance1X = -1 - Fork: Distance1Y = 1 - - Fork: Hero is facing Left - - - Move this event Down - - Else - - - Move this event Left - - End Fork - End Fork End Fork Fork: Distance1X = -1 - Fork: Distance1Y = -1 - - Fork: Hero is facing Left - - - Move this event Up - - Else - - - Move this event Left - - End Fork - End Fork End Fork ****** Now let's alter the condition on the second page to Variable: Chara2 = 1. Make the sprite look like whichever character is the first in the character database. Now make a new page, make its condition Chara2 = 2, and alter the sprite to look like the second character in the database. Now give it these commands: ****** {First Tagalong; Page 3; Parallel Process; when Chara2 = 2} Call this event, Page 2 ****** In other words, it will just do whatever is on the second page. Which is exactly what you want. Copy/paste this page one time for every character, changing the conditions and sprites accordingly. Now alter the other two tagalong events in similar ways. Now we're going to create a test. Make a new event, and give it these commands: ****** {TempTest; Page 1; Auto-Start} Variable Change: Chara1, 1, Set Variable Change: Chara2, 2, Set Variable Change: Chara3, 3, Set Variable Change: Chara4, 4, Set Turn Switch TestOff on {TempTest; Page 2; Push key; when TestOff is on} {nothing} ****** Now, if you've done it correctly, the second, third, and fourth characters in the database should be following you around. Change the numbers to get different characters, and remember to try zeroes (remember, though, what Chara1 is won't change anything in this system.) ---CUTSCENES--- What happens if you want the characters to move on their own in cutscenes? Now we need a switch to tell it what is and isn't a cutscene. We'll actually use three switches: CharaWalk, CharaMove, CharaHidden. CharaWalk, when turned on, will cause the characters to "walk into" the hero. The first page already has the necessary coding for this. Select the second page of First Tagalong, and make a new page (no copy/pasting), which should appear as the third. Leave its sprite and other similar details alone. Make it as follows: ****** {First Tagalong; Page 3; Parallel Process; when Chara2 = 1 and when CharaWalk is on} Call this event, Page 1 ****** Repeat for every character and for all three events. Remember to change sprites and conditions appropriately. This system will prevent regular movement commands from working properly on the tagalongs. Therefore, CharaMove will change that. Select Page 3 and make a new page (4). Make it Push Key. ****** {First Tagalong; Page 4; Parallel Process; when Chara2 = 1 and when CharaMove is on} {no commands} ****** Repeat as necessary. Finally, CharaHidden will hide all of the tagalongs from view. Select the very last page (there will be a lot of them now) and make a new page. Make the sprite a blank one. ****** {First Tagalong; Page something; Parallel Process; when CharaHidden is on} Call this event, Page 1 ****** ---BOATS--- Okay, put a little water on your dummy map and put a boat in it. Ride it. What happens? The characters follow the boat over water. Not good. First of all, make an even dummier dummy map. Start the boat and ship here. So, let's try an event. Make it Push Key, and make it look exactly like the boat. (BoatDouble) Make a ShipDouble too. First, let's alter our TempTest event here. ****** {TempTest; Page 1; Auto-Start} Variable Change: Chara1, 1, Set Variable Change: Chara2, 2, Set Variable Change: Chara3, 3, Set Variable Change: Chara4, 4, Set Variable Change: BoatMap, Hero's Map, Set Variable Change: BoatX, BoatDouble's X-coordinate, Set Variable Change: BoatY, BoatDouble's Y-coordinate, Set Turn BoatAvail (switch) on [we will use BoatAvail in the next part] Variable Change: ShipMap, Hero's Map, Set Variable Change: ShipX, ShipDouble's X-coordinate, Set Variable Change: ShipY, ShipDouble's Y-coordinate, Set Turn ShipAvail (switch) on Turn Switch TestOff on ****** Now to our boat event. ****** {BoatDouble; Page 1; Push Key; when BoatAvail is on} Fork Option: Boat Riding Else Fork Option: Ship Riding Else [I'm not going to indent everything here] Fade Out BGM, 1 second [just a little special effects magic] Turn CharaWalk on Wait 0.5 Place Boat at BoatMap, BoatX, BoatY Ride Vehicle Wait 0.2 Turn BoatCheck (switch) on Turn BoatAvail off End Fork End Fork {BoatDouble; Page 2; Parallel Process; when BoatCheck is on; make it blank} Call event First Tagalong, page 1 [yes, you read that right] ****** Now, let's make another event. Yes, there's a point. Call it VehicleTrack. ****** {VehicleTrack; Page 1; Parallel Process; when BoatCheck is on} Fork: Boat Riding Else - Turn BoatSet (switch) on - Turn BoatCheck off End Fork ****** And another! This one we'll call SetScreen, and with good reason. In the next step, that's exactly what it'll do. But for right now... ****** {SetScreen, Page 1, AutoStart, when BoatSet is on} Variable Change: BoatX, Boat's X-coordinate, Set Variable Change: BoatY, Boat's Y-coordinate, Set Place boat on the map it started on (any coordinates will do) Set event's place, BoatDouble, BoatX, BoatY Turn BoatSet off Turn CharaWalk off Turn BoatAvail on ****** Now repeat with the ship. (In my game, you cannot ride the airships on a map that has the follow system, so this does not include airships.) ****** {ShipDouble; Page 1; Push Key; when ShipAvail is on} Fork Option: Boat Riding Else Fork Option: Ship Riding Else [I'm not going to indent everything here either] Fade Out BGM, 1 second Turn CharaWalk on Wait 0.5 Place Ship at ShipMap, ShipX, ShipY Ride Vehicle Wait 0.2 Turn ShipCheck (switch) on Turn ShipAvail off End Fork End Fork {ShipDouble; Page 2; Parallel Process; when ShipCheck is on; make it blank} Call event First Tagalong, page 1 {VehicleTrack; Page 2; Parallel Process; when ShipCheck is on} Fork: Ship Riding Else - Turn ShipSet (switch) on - Turn ShipCheck off End Fork {SetScreen, Page 1, AutoStart, when ShipSet is on} Variable Change: ShipX, Ship's X-coordinate, Set Variable Change: ShipY, Ship's Y-coordinate, Set Place boat on the map it started on (any coordinates will do) Set event's place, ShipDouble, ShipX, ShipY Turn ShipSet off Turn CharaWalk off Turn ShipAvail on ****** We also need a common event. We'll call it SetScreenCheck. ****** {SetScreenCheck; Common Event; Parallel Process} Fork: Boat Riding - Turn OnABoat on Else - Turn OnABoat off End fork Fork: Ship Riding - Turn OnAShip on Else - Turn OnAShip off End fork ****** And, add to the very end of all three tagalong events, two more blank sprite pages. ****** {First/Second/Third Tagalong, Page whatever, Parallel Process, when OnABoat is on} Call this event, Page 1 {First/Second/Third Tagalong, Page something else, Parallel Process, when OnAShip is on} Call this event, Page 1 ****** You CAN have more than two boats! Just put in a "Change vehicle graphics" and "Change System BGM" right before you teleport the boat in. You may also want to change chipsets around if you don't want the vehicles to be clones of each other (change them back in the SetScreen events.) You'll need a different set of switches and variables for each one, EXCEPT in the case of OnABoat and OnAShip MULTIPLE MAPS This is the big one. How do we get these characters to properly follow the hero through all of the various maps you may make? Let's add to SetScreen, shall we? ****** {SetScreen; Page 3 (assuming you didn't add more boats); AutoStart; when SetScreen (switch) is on} Variable Change: HeroX [use the same one as before], Hero's X-cooridinate, set Variable Change: HeroY, Hero's Y-coordinate, Set Set Event Place: First Tagalong, HeroX, HeroY Set Event Place: Second Tagalong, HeroX, HeroY Set Event Place: Third Tagalong, HeroX, HeroY Fork: Ship Riding - Variable Change: ShipMap, Hero's Map, Set - Set Event Place: ShipDouble, HeroX, HeroY Else - Fork: ShipMap = NewMap (variable, will be defined later) - - Turn ShipAvail on - - Set Event Place: ShipDouble, ShipX, ShipY - Else - - Turn ShipAvail off - End Fork End Fork Fork: Boat Riding - Variable Change: BoatMap, Hero's Map, Set - Set Event Place: BoatDouble, HeroX, HeroY Else - Fork: BoatMap = NewMap - - Turn BoatAvail on - - Set Event Place: BoatDouble, BoatX, BoatY - Else - - Turn BoatAvail off - End Fork End Fork Variable Change: OldMap, NewMap, Set Turn SetScreen off Show Screen with any effect you wish ****** And SetScreenCheck... ****** {SetScreenCheck; Common Event; Parallel Process} Variable Change: NewMap, Hero's Map, Set Fork: NewMap = OldMap - Turn SetScreen off Else - Turn SetScreen on End fork {everything already in SetScreenCheck} ****** Now, copy/paste your dummy map. Include some kind of teleports between them. BUT make them like this: ****** {Teleport, probably page 1, whatever type you want} Erase Screen Teleport ****** DO NOT use a Show Screen command. Doing so will cause a short pause before the tagalongs and boats appear, and it will look sloppy. Trust me, the SetScreen event already shows the screen, you don't need to do it twice. Now test. Make it so your boats can teleport too! ---ACTUALLY USING THIS IN YOUR GAME--- Okay, last step. Delete TempTest and your teleports, plus that last map we used as a teleport test. All maps, except those where you don't want tagalongs, will be copy/pasted versions of this map. Drag (DON'T cut and paste) the events to more convenient locations (like out of the way). Enjoy! To see some examples, play Jay's Journey or the demo of Jay's Journey 2, or download http://www.angelfire.com/rpg2/jay/tut.zip *********************************************************************** Well, that's all for now. If your question has not been answered yet, leave a message on my messageboard and I'll try to get to it. 2002, Jason Godding This may not be reproduced, in full or in part, without the author's permission. This cannot be posted on any website except http://www.geocities.com/jaycrono/jj/FollowFAQ.txt and its mirror at http://www.angelfire.com/rpg2/jay/FollowFAQ.txt You heard me. Don't make me hunt you down. I know Ultima Sword and I'm not afraid to use it! Go ahead and link to it though. Or, better yet, link to one (or both) of the J'sJ mirrors!