Help - Search - Members - Calendar
Full Version: How do you get an NPC to follow you?
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
bl0gmonkey78
Yes, I am very knew to RPG Maker XP and I can't even do my own sprites or scripting, but that is beside the point. I'm making a fan-base game and I would like to know who to get an NPC to follow the main character

The main character touches a horse and wants to lead it in the village, but I don't know how to get it to do that. I hope to get the horse to follow it until a cutscene, but I feel as if this program is too limited for that. Somebody help! I've been trying to get it for like two hours because I'm a total noob.
Logan110
Since you want it to stop following at a cutscene you'll probably want to use a switch.
Make the horse event - Activated by Action Key
Switch 1 On

Make a new tab that has a custom move route
The move route will be - Move towards player.
When your cutscene is activated Turn Switch 1 off.
bl0gmonkey78
QUOTE (Logan110 @ Mar 24 2010, 07:19 AM) *
Since you want it to stop following at a cutscene you'll probably want to use a switch.
Make the horse event - Activated by Action Key
Switch 1 On

Make a new tab that has a custom move route
The move route will be - Move towards player.
When your cutscene is activated Turn Switch 1 off.


On the second tab, I had to change the character actor graphic because I no longer had any control on the character and he was just kinda stuck there. But the horse is still not following me. Are there any scripts that might work?
bulmabriefs144
QUOTE (Logan110 @ Mar 24 2010, 05:19 AM) *
Since you want it to stop following at a cutscene you'll probably want to use a switch.
Make the horse event - Activated by Action Key
Switch 1 On

Make a new tab that has a custom move route
The move route will be - Move towards player.
When your cutscene is activated Turn Switch 1 off.


That's only part of it. You'd also need for the next screen (and however many it followed you) an event directly behind the teleport in location, which was set to switch on and appear. And you'd need a variable to determine which entrance you can in to make it so that character isn't across the screen when you double back. Typically this is why caterpillar things involve the whole variable thing, but if you just want it to be a simple follow character, you need the following code at every screen exit:

<->Hide Screen
<->Teleport (ScreenName X, Y position)
<->Variable Entrance number Set, (whatever number you choose)
<->Show Screen

Note: Don't worry about continuing to number all the way up from 1 to 1200 or whatever, just use 1 (north entrance), 2 (south entrance), 3 (west), 4 (east) or some similar system.

Then when activating the follower position, checkbox IsFollowing ON, and checkbox Entrance is (the number you chose).

This should work from anything 2k onward (not sure about VX since I don't use that) but you have to do two things as well, make sure the character is same level as the character (as in not below or above), and goto the movement customs and tell it to ignore impossible moves (if the character is stuck it might be because it lagged-jammed from following too closely or when you stopped), make sure the speed is right, and the processs repeats.
bl0gmonkey78
QUOTE (bulmabriefs144 @ Mar 24 2010, 07:55 AM) *
QUOTE (Logan110 @ Mar 24 2010, 05:19 AM) *
Since you want it to stop following at a cutscene you'll probably want to use a switch.
Make the horse event - Activated by Action Key
Switch 1 On

Make a new tab that has a custom move route
The move route will be - Move towards player.
When your cutscene is activated Turn Switch 1 off.


That's only part of it. You'd also need for the next screen (and however many it followed you) an event directly behind the teleport in location, which was set to switch on and appear. And you'd need a variable to determine which entrance you can in to make it so that character isn't across the screen when you double back. Typically this is why caterpillar things involve the whole variable thing, but if you just want it to be a simple follow character, you need the following code at every screen exit:

<->Hide Screen
<->Teleport (ScreenName X, Y position)
<->Variable Entrance number Set, (whatever number you choose)
<->Show Screen

Note: Don't worry about continuing to number all the way up from 1 to 1200 or whatever, just use 1 (north entrance), 2 (south entrance), 3 (west), 4 (east) or some similar system.

Then when activating the follower position, checkbox IsFollowing ON, and checkbox Entrance is (the number you chose).

This should work from anything 2k onward (not sure about VX since I don't use that) but you have to do two things as well, make sure the character is same level as the character (as in not below or above), and goto the movement customs and tell it to ignore impossible moves (if the character is stuck it might be because it lagged-jammed from following too closely or when you stopped), make sure the speed is right, and the processs repeats.


It's still a little hard to understand, do you think you could show me what kind of variable and where at to put the event?
Fixxxer4153
It might be easier if you found a caterpillar script that allows party members to follow the main character.
Then you'd just have to make a new actor, the horse, and add it to the party to make it follow. Of course any other party members will also be on the map and follow the controlled character, and, unless you've changed the max party members, if there are already four members to your party, you won't be able to add the horse to the group.
Remember when you add the horse, you also have to erase the event that showed the horse in the first place, or you'll have two of the same horse on the map.
The only real issue with this, is if you have any battles in the area in question, the horse will be in the battle with you.
Other than that, it should work the way you want it to.
Then, during your cut scene sequence, remove the horse from the party, at the same time, activate an event that becomes the horse that doesn't need to follow you anymore. It's actually a lot simpler than it sounds.

Hope this helps! smile.gif
bl0gmonkey78
QUOTE (Fixxxer4153 @ Mar 24 2010, 01:25 PM) *
It might be easier if you found a caterpillar script that allows party members to follow the main character.
Then you'd just have to make a new actor, the horse, and add it to the party to make it follow. Of course any other party members will also be on the map and follow the controlled character, and, unless you've changed the max party members, if there are already four members to your party, you won't be able to add the horse to the group.
Remember when you add the horse, you also have to erase the event that showed the horse in the first place, or you'll have two of the same horse on the map.
The only real issue with this, is if you have any battles in the area in question, the horse will be in the battle with you.
Other than that, it should work the way you want it to.
Then, during your cut scene sequence, remove the horse from the party, at the same time, activate an event that becomes the horse that doesn't need to follow you anymore. It's actually a lot simpler than it sounds.

Hope this helps! smile.gif


Hmm...every time I add a script and try to run it, i get an error saying that it a certain file cannot be found or there is a programming error. Already done it like who knows how many times? I just want to find a really good script that won't fail on me cuz I can't program to save my life lol.
Logan110
QUOTE (bl0gmonkey78 @ Mar 24 2010, 08:32 AM) *
On the second tab, I had to change the character actor graphic because I no longer had any control on the character and he was just kinda stuck there. But the horse is still not following me. Are there any scripts that might work?



I have no idea what you did because I just did it in a test project and it worked fine. If you still dont understand by the time I get home from work I'll just make the event and screen shot it for you.
stripe103
I would make an actor for the horse, use a caterpillar script and then just add the horse to the party. If you dont want a such script trough the game, most of them can be turned off.
Logan110
This was just with a simple self switch but it works exactly the same as a global switch.
[Show/Hide] pictures



bl0gmonkey78
QUOTE (Logan110 @ Mar 24 2010, 11:12 PM) *
This was just with a simple self switch but it works exactly the same as a global switch.
[Show/Hide] pictures





Thanks! It worked! You guys are such a big help! Seriously, I wouldn't be able to do all this by myself lol.
stripe103
That is what this site is for.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.