Gw Temp


Tutorial - 'Caterpiller System Part 1' by Guest

An item about RPGMaker 2000 posted on


A tutorial that demonstrates the basics of a caterpillar system - a simple following algorithm for your other heroes.


Hi there, as you know a "caterpillar" system is one where the heroes follow behind your main character. To tell the truth, not many are both easy and effective. But hey, this one is. Also, I will only do this with one hero "hero2". So read up! This tutorial requires knowledge of variables, x/y coordinates, and fork conditions.

Ok, to start off with, you will need one more hero so do that in your database now. Next you need to make 2 maps but DO NOT add any events yet. You will also need 4 variables listed here.

You also need two events
Ev1-Set Hero2

Now, set each one to a parallel process and check "If hero whoever(hero2 in this case) is in the party". Now this first
event sets the hero to your position. Also if hero2 is in the party on the first event only works if hero 2 is in the party. Now for the code. First go to variable operations and set HeroX to Sprite Hero X Coordinate. Now set HeroY to Sprite Hero Y Coordinate. Now after that have a move event for your Hero2 event that has phasing mode on. Now have a change Event location hero2 to the location referenced in variables HeroX and HeroY. Now have erase event.So what does this do? Simple. The Set Hero X/Y coordinates to the variables tracks the hero. The phasing mode acts as so the Hero2 can be on your hero and not freeze. The change event role is key in this because you have to change the event location to hero and you do not want it to freeze. The change event location just sets Hero2 to your location.The erase event, well erases the event. Why not a switch? Because with an erase event the event automatically brings the event back when you leave so basically it is reset.
Now here is what the code should look like.

<>Variable Oper:[????:HeroX] Set, Hero X Coord.
<>Variable Oper:[????:HeroY] Set, Hero Y Coord.
<>Move Event: Hero2, Phasing Mode ON
<>Change Event Location: Hero2,(V[????],V[????])
<>Erase Event

This is what the code should look like. Now, the ???? represents the variable value of whatever number you used.
Now on to the second event which is your hero2. The box if hero2 is in the party should be checked. Also parallel process and same layer as hero. Also MAKE SURE that the move frequency is Normal. This is so when he follows the hero, that he can keep up with him. Now for the event part.
You first need to set the coordinates again. HeroX equals Hero X Coordinate and HeroY equals Hero Y Coordinate. Now do the same with Hero2. Hero2X Set Hero2 X Coordinate and Hero2Y set Hero2 Y coordinate. Now you need to set it so the event knows where to walk and how to follow the hero. This part is important so listen well. Oh and first I tell what it does, THEN I explain. Now click on a fork conditon that states if HeroX is greater than Hero2X. No else case for any of these forks BTW. Now INSIDE the fork have a move event for Hero2 that has Phasing Mode OFF then Move Right.
Now lets have another fork for if HeroX is less than Hero2X.
In the fork have a Phasing Mode OFF and move left. Now for the up and down forks. Have a fork now that states if HeroY is greater than Hero2Y,inside the fork have phasing mode OFF and move down for Hero2 again. Now, the last fork, have one that says if HeroY is less than Hero2Y then Hero2 moves Phasing mode OFF and Up. That is the end!! Now for an explanation......First the Setting the variables(X and Y coordinate variables) to the Hero and Hero2 simply tracks them. Now for the forks. The If Hero X is greater, which means he is too the right of Hero2, then Hero2 moves right.
Now the opposite applies for the others, if HeroX is LESS than Hero2X which means that he is too the left then Hero2 moves left. Now the HeroY is greater means he is below hero2
so Hero2 moves down. Finally if HeroY is less than Hero2Y then he is above and Hero2 moves up. Oh, and the phasing mode turned OFF means so you can not walk over him anymore.
Now for the actual code

<>Variable Oper: [????:HeroX] Set, Hero X Coord.
<>Variable Oper: [????:HeroY] Set, Hero Y Coord.
<>Variable Oper: [????:Hero2X] Set, Hero2 X Coord.
<>Variable Oper: [????:Hero2Y] Set, Hero2 Y Coord.
<>Branch if Var [????:HeroX] is V[????] Greater
<>Move Event: Hero2, Phasing Mode OFF, Move Right
<>Branch if Var [????:HeroX] is V[????] Less
<>Move Event: Hero2, Phasing Mode OFF, Move Left
<>Branch if Var [????:HeroY] is V[????] Greater
<>Move Event: Hero2, Phasing Mode OFF, Move Down
<>Branch if Var [????:HeroY] is V[????] Less
<>Move Event: Hero2, Phasing Mode OFF, Move Up

Now you are "ALMOST" done!! So, now you got your two events.
Let me say this clearly "THESE EVENTS SHOULD BE THE FIRST EVENTS WHERE YOUR CATERPILLAR SYSTEM IS AT" If not then the events will be messed up. NOW, after the first map, the Hero2 Event should be FIRST, followed by the Set Hero2 event. Now that is all for the events.

I will later have how to implement more than one Hero and even have a sample game In part 2 of the caterpillar system.Best of luck with your game and oh yeah, if you use this then please give credit where it is due.Oh and please, if you see a bug or this tut does not work then please post a comment saying so. Thanks and the best of luck with your game!!