Event Followers

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

eventFollowers1

This script allows events to designate a “leader” that another character will
follow. This could be the player, the current event, or any other event.

Any characters following a leader will follow that leader until they are told to stop following.

 

Download

Script: download here

Installation

Place this below Materials and above Main

Usage

The following method call is defined in Game_Character.

follow(event_id)
stop_follow

This can be called by any character object such as players or events.
In a move route, if you make a script call and just say

follow(event_id)

Then the event specified by the move route will follow that character.
You can also say things like

$game_player.follow(event_id)
$game_map.events[3].follow(event_id)

eventFollowers2

If the event_id is -1, then the character will follow the player.
otherwise, it will follow the specified event on the current map.

To stop following a character, use the script call

stop_follow

Again, remember from whose perspective the script is being called from.

Help spread the word!Share on FacebookShare on TumblrTweet about this on TwitterShare on Google+Share on LinkedInShare on RedditFlattr the author

You may also like...

58 Responses

  1. Dungeonmind says:

    Is there any possible way we can have it so the events do follow the player to other maps? I really really need this to work this way and I’m counting on this script for a party system in my game where you can talk to party members interactively.

    • Hime says:

      This script does not provide support for moving events from map to map. If there was a script that provided such functionality I could write a plugin. The main issue with such events is that it becomes a bit more complicated for eventing since the ID’s are no long known beforehand.

  2. Lordlink13 says:

    Hey, I’m having this issue when it is first calling the script to work. The popup is this:
    https://www.dropbox.com/s/ckfqq2ehr7z9djq/EventFollowersIssue.jpg?dl=0

    I’ve put the follow script command in the move route of the events I want to follow the player. I’ve copied the script in just as is, no modifications.

    • Hime says:

      It looks like you have a script that adds something called “Fake Followers” that seems to be causing compatibility issues.

  3. Anoushka says:

    I keep getting an error saying:
    Script ” line 98: NoMethodError occurred.
    undefined method ‘move’ for nikNilClass

    Something like that…

  4. Rumanshi says:

    ‘Scuse me, I’m getting a strange error:

    Script ‘Game_Interpreter’ line 14411: NoMethodError occurred.

    undefined method ‘follow’ for #

  5. Yin says:

    Hi again Tsukihime. Is there a way to have this code make the event follower follow diagonally like the normal followers?

  6. Fuffydud says:

    Whenever I load a save file that’s on a map with my event follower, the event flies away diagonally instead of following the player.

    • Hime says:

      Can you reproduce that in a new project and then send it to me?

      I have an event follower the player, and then I save the game. Then I load the game, and the event is still following the player.

  7. Fuffydud says:

    After adding the script (in the correct location, of course) whenever I launch my game I get this error:

    Script ‘Event Followers’ line 96: NoMethodError occurred.

    undefined method ‘move’ for nil:NilClass

    This is line 96, but I lack the skill to diagnose the issue:

    @event_followers.move if passable?(@x, @y, d)

    I have the entire script and haven’t modified it in any way. I’ll try linking an image in case it helps:

    http://i.imgur.com/RUDB8Qj.png

  8. Magi says:

    Hi, I installed it between Materials and Main Process, but whenever I try to start playing it just says

    “Script ” line 2: SyntaxError occurred.

    unexpected ‘=’
    = end”

    What am I missing?

    • Hime says:

      The first line of the script should be =begin. If it’s not there you have missed a bunch of lines or you have deleted the header.

  9. Spearnear says:

    Is there a way to disable the "Through" setting in this script without having to create an entirely new parallel process to get around it? I want to be able to have an NPC follow the PC around and also have them to be able to be "talked to" with the action button (similar to an RPG like Rune Factory).

    I see the run speed settings have been fixed since last year though, awesome! 🙂

    (Sorry if this posted twice. if this doesn't show again, I'm assuming there is a pre-approval setting for comments to post.)

  10. Spearnear says:

    Is there a way to disable the "Through" setting in this script without having to create an entirely new parallel process to get around it? I want to be able to have an NPC follow the PC around and also have them to be able to be "talked to" with the action button (similar to an RPG like Rune Factory).

  11. Nesokas says:

    Hello,
    I have a problem with this script and I don't know why.
    If the player is in the map when the game starts, the event has no problem following it, however if I change map with an event and create a new event to follow the player on the new map, the follow behavior just continuous going up diagonally no matter the direction the player is moving.
    Does anyone know why this might happen?

    • Hime says:

      Does this occur in a new project with only event followers?

      • Nesokas says:

        Sorry, I kind give up hope on this one, but this is really what :s
        It works in a new project, however I comment all the other scripts and the problem is still there on my game.

        • Hime says:

          Consider adding each script one by one to the new project. It's possible that you might have events set up that may also conflict with it (which would be strange but possible I guess)

          • Anonymous says:

            Ok this stops happening if i remove the event from the previous map. When I remove the event that follows from the map and transferred the player to the next map with the new event that follows, the behavior stops happening. Maybe that helps figuring out what the problem might be…

          • Anonymous says:

            If I remove the event from the initial map the second one on the other map works perfectly… Maybe that can give you a clue on what the problem might be.

  12. Max says:

    Ummmmm…. I know this is late but I just started learning how to make games, I'm still pretty new to this stuff, what does this mean?

    Script " line 84: NameError occurred.
    uninitialized constant Object::Game_CharacterBase

    I'm lost.

  13. tsubasani says:

    really nice script, and found a bug, in the function move_behind_leader, the y's(y+=1, y-=1) are in reverse,
    it should be:
    def move_behind_leader
    x = @leader.x
    y = @leader.y

    case @leader.direction
    when 2
    y -= 1
    when 4
    x += 1
    when 6
    x -= 1
    when 8
    y += 1
    end
    x = [[1, x].max, $game_map.width-1].min
    y = [[1, y].max, $game_map.height-1].min
    moveto(x, y)

    end

  14. Campo says:

    I’ve incountered an error, that i’ve solved, and another that i can’t solve. The first error is that in line 94 is defined a “event_followers.move” instead of “event_followers_move”. The second problem is: this script is ok with rpg maker ace? I cant use on it

  15. Lick says:

    The script won’t seem to work- It says something like “undefined method ‘move’ for nil:NilClass ( http://i.imgur.com/OpGj4Fb.jpg )
    I have no idea what this means- My deadline is in a couple of days so I probably won’t have time to wait- I’ll just do something else here. Thought I’d let you know though..

  16. X says:

    Wow, if I knew about this script earlier! XD Great job.

  17. Tsukihime says:

    Script updated to correct all follower behavior when following another character.

  18. Tsukihime says:

    Script has been updated to correctly match event follower speeds with the leader’s speed under any circumstances.

  19. Spearnear says:

    The event doesn’t seem to match speeds with the player when it runs. Do I have to set something manually to make it work? I set a custom move route to an event with only the script follow(-1) added, and the event just keeps walking even when I push A (shift) to run.

  20. Oriceles says:

    Will they follow the player to other maps too?

Leave a Reply

Your email address will not be published.

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax