RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[2k3/XP/VX]How to: An Easy Caterpillar System

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 76
I was the first Corlen.
Here I made a quick and easy caterpillar system in RPG Maker 2003 through events (and it could probably be adapted for XP and VX) and decided to share it with you guys since I noticed people have trouble making one of these things, I hope I typed it out correctly, I double checked my event with what I typed and didn't see any typos but you never know.

Be sure at the start of every map before the screen fades in you set the party members to the player's X and Y coordinates.  This is only for two party members (counting the main hero itself) but with a little tweaking and copying of the code, you can do it for as many members as you want.  Party order will not work with this code as well, the party members will always show up in the order you put them in, in the caterpillar system itself...

Also, other events will be able to walk through the party members but meh, if you turn off the phasing mode crap, then you can't walk onto the tiles the second party member is on and could eventually become trapped if you have like 5 or 6 party members.  This event has to be a parallel process, and the "Member2" event who follows the hero around doesn't have to be anything in particular.  Also, it's a good idea to have the second party member be event 1 on every map you want it to appear on for compatibility reasons.  To make the hero not show up when he/she is not present in the party, just make a precondition that states that hero has to be in the party for the member2 event.

Also in the same event that sets the member2 position to the hero's X and Y coordinates, be sure to set PM2X and PM2Y to the hero's coordinates or else member2 will take a step suddenly when you enter a new map.

<>Branch if Switch [Hero Steps] is ON
  <>Branch if Var [PM2X] is V[HeroX] Equal
    <>Branch if Var [PM2Y] is V[HeroY] Equal
      <>Switch Operation [Caterpillarposition] OFF
      <>
    : Else Handler
      <>Switch Operation: [Caterpillarposition] ON
      <>
    : End
    <>
  : Else Handler
    <>Switch Operation [Caterpillarposition] ON
    <>
  : End
  <>
: Else Handler
  <>Switch Operation: [Caterpillarposition] OFF
  <>
:End
<>Branch if Switch [Caterpillarposition] is ON
  <>Variable Oper: [PM2X] Set, Member2 X Coord.
  <>Variable Oper: [PM2Y] Set, Member2 Y Coord.
  <>Variable Oper: [HerocaterpillarX] Set, Hero X Coord.
  <>Variable Oper: [HerocaterpillarY] Set, Hero Y Coord.
  <>Branch if Hero Up Facing
    <>Variable Oper: [HerocaterpillarY] + , 1
    <>
  : End
  <>Branch if Hero Right Facing
    <>Variable Oper: [HerocaterpillarX] - , 1
    <>
  : End
  <>Branch if Hero Down Facing
    <>Variable Oper: [HerocaterpillarY] - , 1
    <>
  : End
  <>Branch if Hero Left Facing
    <>Variable Oper: [HerocaterpillarX] + , 1
    <>
  : End
  <>Branch if Var [PM2Y] is V[HerocaterpillarY] Less
    <>Move Event: Member2, Phasing Mode ON, Move Down
    <>
  : End
  <>Branch if Var [PM2Y] is V[HerocaterpillarY] Greater
    <>Move Event: Member2, Phasing Mode ON, Move Up
    <>
  : End
  <>Branch if Var [PM2X] is V[HerocaterpillarX] Less
    <>Move Event: Member2, Phasing Mode ON, Move Right
    <>
  : End
  <>Branch if Var [PM2X] is V[HerocaterpillarX] Greater
    <>Move Event: Member2, Phasing Mode ON, Move Left
    <>
  : End
  <>
: End
<>Wait: 0.0 Sec
<>
« Last Edit: January 23, 2011, 04:33:47 PM by grafikal »

**
Rep: +0/-0Level 76
I was the first Corlen.
Next, you need to make this a parallel process common event:

<>Variable Oper: [Hero X] Set, Hero X Coord.
<>Variable Oper: [Hero Y] Set, Hero Y Coord.
<>Branch if Var [Hero X] is V[Hero Last X] Equal
  <>Branch if Var [Hero Y] is V[Hero Last Y] Equal
    <> Switch Operation: [Hero Steps] OFF
    <>
  : Else Handler
    <>Switch Operation: [Hero Steps] ON
    <>
  : End
  <>
: Else Handler
  <>Switch Operation: [Hero Steps] ON
  <>
: End
<>Variable Oper: [Hero Last X] Set, Var [Hero X]'s Value
<>Variable Oper: [Hero Last Y] Set, Var [Hero Y]'s Value
<>Wait: 0.0 Sec
<>

And that's all you have to do, it should work this way.  It works for me.
« Last Edit: November 13, 2010, 07:43:16 AM by corlenbelspar »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Looks good. Thanks for sharing!