This module allows you to have characters follow the player character from behind, walking exactly in the player character's footsteps and changing rooms with them, forming a 'caterpillar' system. It is basically a smoother version of Bernie's FolEx old module (see http://www.adventuregamestudio.co.uk/yabb/index.php?topic=25121.0 ).
It was primarily designed for RPGs using keyboard controls (in particular, the KeyboardMovement module by Rui "Brisby" Pires & strazer). It currently does not work well with mouse controls because the KeyboardMovement is strictly 8-directional whereas mouse movement is, well, 360-directional.
Note that if your player character has MovementLinkedToAnimation = true, the characters who follow him must also have that parameter true and the same AnimationSpeed as him. If he has MovementLinkedToAnimation = false, the characters who follow him can have different AnimationSpeed values. In both cases, the characters's WalkSpeeds will be aligned with that of the player (including if you have implemented a custom "running" feature for your player's movement).
This is my first module ever, so sorry if there are bugs or if the code is awkward. Suggestions/comments are of course welcome.
Functions:
Disable();
Disables caterpillar movement.
Enable();
Enables caterpillar movement. By default, the module is automatically enabled at game start.
Status();
Returns whether caterpillar movement is currently enabled.
Set(int spot, Character* name);
Adds a character to the specified spot in the caterpillar (spot 0 is the first character that follows the player's character, spot 1 is the second, etc.). Note that adding a character makes them become non-solid.
To remove a character from a spot, just set name to null. The character's original solid property will be restored.
Get(int spot);
Returns the ID number of the character in the specified spot.
Version history:
v0.1 (November 21, 2011) First release by Daniel Eakins
License:
This module is released into the public domain.
Download (https://www.dropbox.com/s/lwdsl95xk5xkikk/Caterpillar010.zip?dl=1)
This module sounds good! i know the post is a couple of months old, to bad it´s not avaible for download anymore. was looking forward to trying it out in my project..
cheers!
Oh do reupload this please.
That module is very interesting. Bad that it isn't available :'(.
Hi ! I'm really interested, is the module available? Thank you !
Hello, sorry for replying so late (almost two years later!). I kind of left the forum at some point :sad:
The module has now been reuploaded.
Sorry for digging up an old thread, but this module is rather useful, yet I found a bug.
This bug seems to have been introduced after an unfortunate last-minute modification.
Current code :
static function Caterpillar::Set(int spot, Character* name) {
// If 'name' is already at 'spot' or is the player, do nothing
int n;
while (n < NMAX) {
if (name == follower[n] || name == player) {return;}
n++;
}
// If 'name' is null, remove current character from 'spot'
if (name == null) {
...
follower[spot] = null;
}
...
As you can see, the function is broken. The end-used is supposed to use "null" value for parameter "name" in order to remove that value from array "follower".
But before "if (name == null)" occurs, there is that loop which does "if (name == follower[n] ...) {return;}". If name==null, then name==follower[n] can be true! Therefore you never get to reach if (name == null)
Unless I'm overlooking something obvious, the correct code should be :
static function Caterpillar::Set(int spot, Character* name) {
// If 'name' is already at 'spot' or is the player, do nothing
if (name != null) { // !!!!!!!!!!!!!!!!!!!
int n;
while (n < NMAX) {
if (name == follower[n] || name == player) {return;}
n++;
}
} //!!!!!!!!!!!!!!!!!!!!
// If 'name' is null, remove current character from 'spot'
if (name == null) {
if (follower[spot] != null) { // !!!!!!!!!!!!!!!!
follower[spot].StopMoving();
follower[spot].Solid = originalsolid[spot];
} //!!!!!!!!!!!!!!!!!!!
follower[spot] = null;
}...
Hey, what a coincidence, I was cleaning up my Dropbox folders just now and so I had to log in the forum to check some old links, after months of inactivity. I do not have AGS installed on this computer anymore so I can't check your edit Monsieur OUXX but I'm trusting your expertise :)
this will go well with my "conga dance animations"
The broken link has been corrected (again).