KENTONA'S COOLER CATERPILLAR SYSTEM
A Caterpillar System for RM2K3 but requires more code
kentona- 03/10/2010 05:41 PM
- 42721 views
After reading Calunio's Caterpillar System I implemented it into my game, but noticed a few quirks. For example, when the Hero is up against an obstacle and faces down without moving down (or any direction), the behavior of the followers is not ideal. They will position themselves behind the Hero regardless of passibility and the fact that the hero hasn't actually moved. Plus, I expanded it to include 3 followers behind the Hero and included the auto-start positioning logic for when you enter a new map.
I have also made a template project!
DOWNLOAD TEMPLATE PROJECT
http://rpgmaker.net/users/kentona/locker/Caterpillar.rar
Update (Jan/23)
Converted to the current official version of RM2k3, but lazily just dumped the old RTP into the resources of this project:
https://rpgmaker.net/users/kentona/locker/Caterpillar2.zip
VARIABLES, SWITCHES AND EVENTS
You will need 18 variables and 3 switches and 4 events on every map to make this tutorial work.
The gist of this caterpillar system is that the Follower follows the Hero, the Third follows the Follower, and the Rearguard follows the Third. The followers (Follower, Third and Rearguard) are all parallel processes, same layer as Hero, with Phasing ON. They will only move if the person they are following change position on the map. (Thus they won't move if the person they are following simply changes facing direction without actually moving). Being in phased mode means that you can freely walk through them so you won't get stuck in narrow areas.
Now, on to the events...
Event ID:0001: Positioning
The auto-start Positioning event moves all the followers to the same location as the hero, just to start things off.
By erasing the event it ensures that this event is only run once BUT will re-run if the player leaves the map and then returns later. It saves having to track variables and whatnot.
The Positioning event also initiallizes a few positional tracking variables for use in the followers events.
Event Graphic: invisible
Trigger: Auto-Start
Event Layer: Below Hero
Event ID:0002: Follower
This event is the dude immediately after the hero.
The logic is straigtforward: track the location of the Hero, test to see if the Hero has changed position, and if he has move This Event accordingly.
Event Graphic: charset of the second playable character
Trigger: Parallel Process
Event Layer: Same layer as Hero
Event ID:0003: Third
This event is the dude third in line in the caterpillar, following the Follower event.
It is very similar to the Follower event, except that the Third tracks the position of the Follower event rather than the Hero.
Event Graphic: charset of the third playable character
Trigger: Parallel Process
Event Layer: Same layer as Hero
Event ID:0004: Rearguard
This event is the dude last in line in the caterpillar, following the Third event.
Same as the Third event, except tracking the Third's position (obviously).
Event Graphic: charset of the fourth playable character
Trigger: Parallel Process
Event Layer: Same layer as Hero
...and there it is!
NOTES
-You cannot allow the player to change the order of the party (unless you somehow track the order manually and change charsets and event graphics accordingly)
-This caterpillar assumes that you have only 4 playable characters (if you have more, you will have to add logic for event graphics)
-The leader of the caterpillar will be the Hero, ie- whoever happens to be first in the party order.
-Since Phasing Mode is ON for the followers, other events can walk over them (Unfortunately, Forbid Event Overlap doesn't work on Phased events)
-It is critical that the event IDs are consistent! RM2k3 references other events by their Event ID, so if you don't have these events as 0001, 0002, 0003, and 0004 make sure to edit the follower events accordingly to reference the correct events. Honestly, it is easiest just to create a template map with these four events ready to go to use for every time you want to make a new map in your game. Copy the template map, paste it to where you want it and then add mapping and other events after. That way the event IDs are always 0001~0004 and you don't have to muck around with anything.
-In the Template project I also added special world map logic for riding in vehicles like boats and airships.
I have also made a template project!
DOWNLOAD TEMPLATE PROJECT
http://rpgmaker.net/users/kentona/locker/Caterpillar.rar
Update (Jan/23)
Converted to the current official version of RM2k3, but lazily just dumped the old RTP into the resources of this project:
https://rpgmaker.net/users/kentona/locker/Caterpillar2.zip
VARIABLES, SWITCHES AND EVENTS
You will need 18 variables and 3 switches and 4 events on every map to make this tutorial work.
Event ID:0001: Positioning
Event ID:0002: Follower
Event ID:0003: Third
Event ID:0004: Rearguard
[0101:HeroX]
[0102:HeroY]
[0103:SecondX]
[0104:SecondY]
[0105:FollowerX]
[0106:FollowerY]
[0107:ThirdX]
[0108:ThirdY]
[0109:NextX]
[0110:NextY]
[0111:FourthX]
[0112:FourthY]
[0113:PreviousHeroX]
[0114:PreviousHeroY]
[0115:PreviousSecondX]
[0116:PreviousSecondY]
[0117:PreviousThirdX]
[0118:PreviousThirdY]
[0098:ThirdMoved]
[0099:SecondMoved]
[0100:HeroMoved]
The gist of this caterpillar system is that the Follower follows the Hero, the Third follows the Follower, and the Rearguard follows the Third. The followers (Follower, Third and Rearguard) are all parallel processes, same layer as Hero, with Phasing ON. They will only move if the person they are following change position on the map. (Thus they won't move if the person they are following simply changes facing direction without actually moving). Being in phased mode means that you can freely walk through them so you won't get stuck in narrow areas.
Now, on to the events...
Event ID:0001: Positioning
The auto-start Positioning event moves all the followers to the same location as the hero, just to start things off.
By erasing the event it ensures that this event is only run once BUT will re-run if the player leaves the map and then returns later. It saves having to track variables and whatnot.
The Positioning event also initiallizes a few positional tracking variables for use in the followers events.
Event Graphic: invisible
Trigger: Auto-Start
Event Layer: Below Hero
<> Variable Oper: [0101:HeroX] Set, Hero X Coord
<> Variable Oper: [0102:HeroY] Set, Hero Y Coord
<> Variable Oper: [0113:PreviousHeroX] Set, Hero X Coord
<> Variable Oper: [0114:PreviousHeroY] Set, Hero Y Coord
<> Variable Oper: [0115:PreviousSecondX] Set, Hero X Coord
<> Variable Oper: [0116:PreviousSecondY] Set, Hero Y Coord
<> Variable Oper: [0117:PreviousThirdX] Set, Hero X Coord
<> Variable Oper: [0118:PreviousThirdY] Set, Hero Y Coord
<> Change Event Location: Follower (V[0101], V[0102])
<> Change Event Location: Follower (V[0101], V[0102])
<> Change Event Location: Follower (V[0101], V[0102])
<> Erase Event
Event ID:0002: Follower
This event is the dude immediately after the hero.
The logic is straigtforward: track the location of the Hero, test to see if the Hero has changed position, and if he has move This Event accordingly.
Event Graphic: charset of the second playable character
Trigger: Parallel Process
Event Layer: Same layer as Hero
<> Comment ---------------------- INITIALIZE VARIABLES
<> Move Event: This Event, Phasing Mode ON
<> Variable Oper: [0101:HeroX] Set, Hero X Coord
<> Variable Oper: [0102:HeroY] Set, Hero Y Coord
<> Variable Oper: [0103:SecondX] Set, This Event X Coord
<> Variable Oper: [0104:SecondY] Set, This Event Y Coord
<> Comment ---------------------- TEST TO SEE IF HERO MOVED
<> Branch if Var [0113:PreviousHeroX] is V[0101:HeroX] Not
<> Switch: [0100:HeroMoved] ON
<> End if
<> Branch if Var [0114:PreviousHeroY] is V[0102:HeroY] Not
<> Switch: [0100:HeroMoved] ON
<> End if
<> Comment ---------------------- IF HERO MOVED, MOVE FOLLOWER
<> Branch if Switch: [0100:HeroMoved] is ON
<> Switch: [0100:HeroMoved] OFF
<> Variable Oper: [0113:PreviousHeroX] Set, V[0101:HeroX] Value
<> Variable Oper: [0114:PreviousHeroY] Set, V[0102:HeroY] Value
<> Branch if Hero Up Facing
<> Variable Oper: [0102:HeroY] + 1
<> End if
<> Branch if Hero Down Facing
<> Variable Oper: [0102:HeroY] - 1
<> End if
<> Branch if Hero Left Facing
<> Variable Oper: [0101:HeroX] + 1
<> End if
<> Branch if Hero Right Facing
<> Variable Oper: [0101:HeroX] - 1
<> End if
<> Comment ---------------------- MOVE FOLLOWER
<> Branch if Var [0103:SecondX] is V[0101:HeroX] Less
<> Move Event: This Event, Move Right
<> End if
<> Branch if Var [0103:SecondX] is V[0101:HeroX] Greater
<> Move Event: This Event, Move Left
<> End if
<> Branch if Var [0104:SecondY] is V[0102:HeroY] Less
<> Move Event: This Event, Move Down
<> End if
<> Branch if Var [0104:SecondY] is V[0102:HeroY] Greater
<> Move Event: This Event, Move Up
<> End if
<> End if
Event ID:0003: Third
This event is the dude third in line in the caterpillar, following the Follower event.
It is very similar to the Follower event, except that the Third tracks the position of the Follower event rather than the Hero.
Event Graphic: charset of the third playable character
Trigger: Parallel Process
Event Layer: Same layer as Hero
<> Comment ---------------------- INITIALIZE VARIABLES
<> Move Event: This Event, Phasing Mode ON
<> Variable Oper: [0105:FollowerX] Set, Follower X Coord
<> Variable Oper: [0106:FollowerY] Set, Follower Y Coord
<> Variable Oper: [0107:ThirdX] Set, This Event X Coord
<> Variable Oper: [0108:ThirdY] Set, This Event Y Coord
<> Comment ---------------------- TEST TO SEE IF FOLLOWER MOVED
<> Branch if Var [0113:PreviousHeroX] is V[0105:FollowerX] Not
<> Switch: [0099:SecondMoved] ON
<> End if
<> Branch if Var [0114:PreviousHeroY] is V[0106:FollowerY] Not
<> Switch: [0099:SecondMoved] ON
<> End if
<> Comment ---------------------- IF FOLLOWER MOVED, MOVE THIRD
<> Branch if Switch: [0099:SecondMoved] is ON
<> Switch: [0099:SecondMoved] OFF
<> Variable Oper: [0115:PreviousFollowerX] Set, V[0105:FollowerX] Value
<> Variable Oper: [0116:PreviousFollowerY] Set, V[0106:FollowerY] Value
<> Branch if Follower Up Facing
<> Variable Oper: [0106:FollowerY] + 1
<> End if
<> Branch if Follower Down Facing
<> Variable Oper: [0106:FollowerY] - 1
<> End if
<> Branch if Follower Left Facing
<> Variable Oper: [0105:FollowerX] + 1
<> End if
<> Branch if Follower Right Facing
<> Variable Oper: [0105:FollowerX] - 1
<> End if
<> Comment ---------------------- MOVE THIRD
<> Branch if Var [0107:ThirdX] is V[0105:FollowerX] Less
<> Move Event: This Event, Move Right
<> End if
<> Branch if Var [0107:ThirdX] is V[0105:FollowerX] Greater
<> Move Event: This Event, Move Left
<> End if
<> Branch if Var [0108:ThirdY] is V[0106:FollowerY] Less
<> Move Event: This Event, Move Down
<> End if
<> Branch if Var [0108:ThirdY] is V[0106:FollowerY] Greater
<> Move Event: This Event, Move Up
<> End if
<> End if
Event ID:0004: Rearguard
This event is the dude last in line in the caterpillar, following the Third event.
Same as the Third event, except tracking the Third's position (obviously).
Event Graphic: charset of the fourth playable character
Trigger: Parallel Process
Event Layer: Same layer as Hero
<> Comment ---------------------- INITIALIZE VARIABLES
<> Move Event: This Event, Phasing Mode ON
<> Variable Oper: [0109:NextX] Set, Third X Coord
<> Variable Oper: [0110:NextY] Set, Third Y Coord
<> Variable Oper: [0111:FourthX] Set, This Event X Coord
<> Variable Oper: [0112:FourthY] Set, This Event Y Coord
<> Comment ---------------------- TEST TO SEE IF THIRD MOVED
<> Branch if Var [0113:PreviousThirdX] is V[0109:NextX] Not
<> Switch: [0098:ThirdMoved] ON
<> End if
<> Branch if Var [0114:PreviousThirdY] is V[0110:NextY] Not
<> Switch: [0098:ThirdMoved] ON
<> End if
<> Comment ---------------------- IF THIRD MOVED, MOVE REARGUARD
<> Branch if Switch: [0098:ThirdMoved] is ON
<> Switch: [0098:ThirdMoved] OFF
<> Variable Oper: [0117:PreviousThirdX] Set, V[0109:NextX] Value
<> Variable Oper: [0118:PreviousThirdY] Set, V[0110:NextY] Value
<> Branch if Third Up Facing
<> Variable Oper: [0110:NextY] + 1
<> End if
<> Branch if Third Down Facing
<> Variable Oper: [0110:NextY] - 1
<> End if
<> Branch if Third Left Facing
<> Variable Oper: [0109:NextX] + 1
<> End if
<> Branch if Third Right Facing
<> Variable Oper: [0109:NextX] - 1
<> End if
<> Comment ---------------------- MOVE REARGUARD
<> Branch if Var [0111:FourthX] is V[0109:NextX] Less
<> Move Event: This Event, Move Right
<> End if
<> Branch if Var [0111:FourthX] is V[0109:NextX] Greater
<> Move Event: This Event, Move Left
<> End if
<> Branch if Var [0112:FourthY] is V[0110:NextY] Less
<> Move Event: This Event, Move Down
<> End if
<> Branch if Var [0112:FourthY] is V[0110:NextY] Greater
<> Move Event: This Event, Move Up
<> End if
<> End if
...and there it is!
NOTES
-You cannot allow the player to change the order of the party (unless you somehow track the order manually and change charsets and event graphics accordingly)
-This caterpillar assumes that you have only 4 playable characters (if you have more, you will have to add logic for event graphics)
-The leader of the caterpillar will be the Hero, ie- whoever happens to be first in the party order.
-Since Phasing Mode is ON for the followers, other events can walk over them (Unfortunately, Forbid Event Overlap doesn't work on Phased events)
-It is critical that the event IDs are consistent! RM2k3 references other events by their Event ID, so if you don't have these events as 0001, 0002, 0003, and 0004 make sure to edit the follower events accordingly to reference the correct events. Honestly, it is easiest just to create a template map with these four events ready to go to use for every time you want to make a new map in your game. Copy the template map, paste it to where you want it and then add mapping and other events after. That way the event IDs are always 0001~0004 and you don't have to muck around with anything.
-In the Template project I also added special world map logic for riding in vehicles like boats and airships.
Posts 

I'm sorry, but where did I say that if someone lifts a scripted/evented system from somewhere that it inherently makes their game worse? What I said is that it makes their game inherently less individual than if they had written a script/event themselves.
I can see this to a point with people who don't go through any lengths to make the script fit the game, but it's really a matter of how it's used in the end.
A good parallel would be a tileset. A publicly available tileset might be used to just as good an effect than a custom one, in less time, and add just as much flair. Whether or not that is the case falls on the user, not the resource.
...and bringing the argument full circle I think it is retarded to knock a tutorial for RM2k3 on the basis that it isn't a RMVX script.
War...huh...yeah
What is it good for?
Absolutely nothing
Uh ha haa ha
War...huh...yeah
What is it good for?
Absolutley nothing...say it again y'all
War..huh...look out...
What is it good for?
Absolutely nothing...listen to me ohhhhh
Let's go back to discussing music theory. It was interesting.
What is it good for?
Absolutely nothing
Uh ha haa ha
War...huh...yeah
What is it good for?
Absolutley nothing...say it again y'all
War..huh...look out...
What is it good for?
Absolutely nothing...listen to me ohhhhh
Let's go back to discussing music theory. It was interesting.
comment=23848
Your title is mean.
But my intention was "A simple Caterpillar System for RM2K3 with very little code", so your is cooler, mine is simpler. :D
Anyways, good job. There's an easy way to fix this "You cannot allow the player to change the order of the party" though. That's the beauty of RM2K3... you can do almost anything if you use variables enough.
Except in battle. If anyone makes a new update to 2k3, I'd suggest adding about a page or two to the battle commands, including in-battle weather (which shuts off when you leave the battle), and a couple pages to the Conditions (there's only one page, and the conditions are rather limited, to do anything beyond that, you need a common event). Oh, and Local Events, because not being able to do treasure chests without using 1 billion switches is painful, especially if the game itself has several events that need switches.
comment=24929
Except in battle. If anyone makes a new update to 2k3, I'd suggest adding about a page or two to the battle commands, including in-battle weather (which shuts off when you leave the battle), and a couple pages to the Conditions (there's only one page, and the conditions are rather limited, to do anything beyond that, you need a common event). Oh, and Local Events, because not being able to do treasure chests without using 1 billion switches is painful, especially if the game itself has several events that need switches.
use vx
comment=24929
Except in battle. If anyone makes a new update to 2k3, I'd suggest adding about a page or two to the battle commands, including in-battle weather (which shuts off when you leave the battle), and a couple pages to the Conditions (there's only one page, and the conditions are rather limited, to do anything beyond that, you need a common event). Oh, and Local Events, because not being able to do treasure chests without using 1 billion switches is painful, especially if the game itself has several events that need switches.
Yeah, to be completely honest the "use VX" argument holds full weight here.
Okay, I recently started a project on RPG Maker 2003 because I enjoy having to think how to make my game work, but I don't have time to learn a whole coding language like C++ just to make a game. RPG Makers after rm2k3 are too easy (IMO) and it just becomes copying scripts into your own game. So I find rm2k3 perfect for me. So what if doing certain systems on rm2k3 is complicated, or even a bit unpractical? It just creates challenge. :)
I have been trying to create a working caterpillar system for my game for god knows how long, without ever succeeding. Thanks to this article, I can get a perfect caterpillar for my game. Thank you VERY VERY MUCH kentona, I'll give you credit in my game for this caterpillar system.
PS. I was going to register here after I have finished my game, to put it here, but reading all the BS comments in this article I just had to register early just to let kentona know atleast someone appreciates the work he/she has done. If you wanna use VX, then keep to VX articles and don't come here bashing people who find another engine better suited for them.
I have been trying to create a working caterpillar system for my game for god knows how long, without ever succeeding. Thanks to this article, I can get a perfect caterpillar for my game. Thank you VERY VERY MUCH kentona, I'll give you credit in my game for this caterpillar system.
PS. I was going to register here after I have finished my game, to put it here, but reading all the BS comments in this article I just had to register early just to let kentona know atleast someone appreciates the work he/she has done. If you wanna use VX, then keep to VX articles and don't come here bashing people who find another engine better suited for them.
I don't know how it's possible, I did everything you did, my events are exactly the same as yours, yet all of the characters following me move around when the hero faces another direction, leading to the followers sometimes appearing in rocks or houses or anything.
Have you downloaded the demo project? Also, it is very important that the IDs of the events for this are 0001, 0002, 0003.
Failing that, you could also upload your project somewhere or take a screenshot of your code and I can take a look.
Failing that, you could also upload your project somewhere or take a screenshot of your code and I can take a look.
Well I used the events from the demo project and switched the variables / switches with mine. Now it seems to work alright.
I don't know what was going on, but at least it works now.
I don't know what was going on, but at least it works now.
I'd worked with this amazing engine, and I have a way of change order,
its support add a chara and that it can be appear based in the menu position,
and remove every chara
its support add a chara and that it can be appear based in the menu position,
and remove every chara
There's a small issue with this awesome tutorial :)
When you get in the airship sometimes you can't land because the "followers" get under the airship.
To fix this simply replace the "move toward hero" with "change event location" to a place where the airship actually can't land on the "ShipAirship" action.
When you get in the airship sometimes you can't land because the "followers" get under the airship.
To fix this simply replace the "move toward hero" with "change event location" to a place where the airship actually can't land on the "ShipAirship" action.





















