Follower NPC

WOO GAMES LLC

New member
I apologise if this has already been addressed, but is it possible (in the Adventure Module) to script a nonplayable character to follow the player? I have several ideas for this function: escort missions, helper NPCs... etc.,

Thank you in advance
 

Bucket Mouse

Active member
Theoretically one of the four available monster slots could be used for this purpose. A new monster AI could be written that always generates the sprite a few steps behind the player sprite.

The closest thing to this sort of code is the "Monster moves toward player" AI by MistSonata; see this topic: http://www.nesmakers.com/viewtopic.php?f=3&t=746
I doubt it can be approached EXACTLY the same way, but it should provide some hints as to how to make this happen.
 

jorotroid

Member
Mist's code that Bucket Mouse mentioned should be sufficient. But there is a limitation to the AI scripts that might be relevant for this sort of behavior. As you probably already know, when you set an AI behavior for an object, you can set a timer that goes from 0 to 15. Setting it to 0 means that the timer will go off at a random time, which means that there is no way to have a timer go off every frame. It's been a while since I was playing around with this, but I think that I calculated that setting it to 1 one was equal to about a quarter of a second. Whatever it was, this means that occasionally you will observe the object with this AI Script taking a moment before it will update its movement. Again, this is probably not that big of a deal for how you want to use it (it might even add a bit of an impression of character to your NPC), but I thought you might want to know.
 
Top Bottom