Forum rules - please read before posting.

NPC Follow

This may be a stupid question, but I am struggling to find documentation on it. Maybe I overlooked something, but I can't find any way to turn an NPC into a follower of the player.

Is there a component for it?

Comments

  • edited December 2018

    Welcome to the community, @DeadDev.

    No additional components are necessary - this can be done with the Character: NPC follow Action. More details can be found in the Manual's "Standard Actions" chapter.

  • Thanks for the welcome!

    I'm not very experienced with AC. I moved my project to AC because it handled navmesh navigation, among many more benefits.

    I know you said no additional components were necessary, but I couldn't find any actionsLists that could trigger when the MC moved.

    I added an action list to my player character and set up the NPC follow action. But I've found two problems.

    The action will not play unless I activate it manually from the actionList component.
    The second is that the NPC sprites will not activate when moving.

    Am I going about this the wrong way, or is there something more I need to do before the sprites will activate?

    Thanks!

  • The action will not play unless I activate it manually from the actionList component.

    When would you like it to play? If it should run when the scene begins, you can place the Action in your OnStart Cutscene, which you can assign in your Scene Manager. ActionLists generally shouldn't go on the Player, since object references will be lost when the Player changes scene.

    The second is that the NPC sprites will not activate when moving.

    What do you mean by "activate"? If you're talking about animation, you'll have to have animations defined in his Animator component, and then configure his NPC component to play them back. I'd need to see some screenshots of your NPC's Inspector, and Animator, as well as more detail about what you mean in order to give more specific advice. The Manual's "Character animation" chapters can also guide you on this.

  • The issue with the animation was a simple misnaming problem. It's sorted now.

    I've taken the actionlist out of the main character and will assign one to an onstart cutscene. I want the NPC to follow the player throughout the game. I also plan on adding a player switch function to allow the player to change between characters at any time. I spent a long time trying to find documentation on the best method for implementing NPC following but I couldn't find any.

  • A tutorial on switching the active Player can be found here.

    I spent a long time trying to find documentation on the best method for implementing NPC following but I couldn't find any.

    What is it in particular you're looking for information on? The NPC won't follow the Player across scenes - but if you make the NPC a prefab, you can place an instance of him in each scene to have him locally follow the player per-scene.

    To set his initial position, you can use the Object: Teleport Action in your scene's OnStart Cutscene - and precede this with a Scene: Check Action to vary his position according to which scene that Player entered the scene from.

  • I was looking for a way to make an NPC follow you, and the best method for it. I have it now,

    I didn't know that I needed to set the action in the OnStart action list for the following to work as soon as the characters were in the scene. I'm still learning how to use AC effectively to recreate a demo I made in Game Maker.

    https://www.saxonsoftwaregames.com/

    I have some more questions, but I'll ask them in another thread.

    Thanks!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.