Forum rules - please read before posting.

Keeping track of NPC paths and position from other scenes.

Hello again everyone. I just wanted to know if there's a simple way or if it's even possible to keep track of an NPC on other scenes, not so much to check what they are doing, but that they keep following their "Schedules"

If you need a bit more context, I made and NPC that goes around doing multiple tasks through the day, and dependending on the time of day he moves to different locations on a scene. I want a way to leave the scene and when I come back he will be performing the task that he is supposed to be doing.

If this is too hard to do I understand, I don't mind doing scripts, but, I dont have that much experience in that area. Anyways thanks in advance.

Comments

  • AC doesn't have a scheduling system, but it is able to move NPCs to other scenes, so that they appear in a specific location when the Player visits that scene.

    To do this, you'll want to rely on AC's "Player-switching" system, and convert your NPCs to Players that AC can then keep track of. You can still only rely on your regular Player as the only "player-controller" character - inactive Players will continue to behave like NPCs.

    An overview video of AC's Player-switching system can be found in this tutorial.

    You can convert an NPC into a Player via the cog menu to the top-right of the NPC Inspector. Once made into a Player prefab, assign them in the Settings Manager, and click the cog to the right of them to supply the details of where they should begin the game. AC will then keep track of their scene-presence, so you'll need to be sure to remove them from the scene files.

    You can then move these characters to other scenes using the Player: Teleport inactive Action. You can also affect these characters (talking, animating etc), by checking the "Player" box in Character Actions: when Player-switching is enabled, you'll then be shown a dropdown list that you can use to select which Player character is affected.

    Further work - either with variables or custom scripting - may be necessary to get such characters to e.g. animate when in a certain scene at a certain time, but give the above a try first.

  • Well, it took me a while but I mostly got the hang of it, it works pretty well, my only problem is I didn't found a way to keep track or move the NPCs while on another scene.

    I did think of a solution that worked for me, but I have a problem, I added the DontDestroyMe to the paths folder and to the ground collision, that way the NPC can still perform his schedule while I'm on another scene, but AC doesn't keep the NPC when it's also a player. It does keeps the regular NPCs.

    Is there a way to tell AC to not destroy the Player NPCs or does it conflicts with the way it works?

  • edited March 2023

    I'm afraid it would create a conflict. If a Player isn't in the scene, AC will see it removed.

    What you can do, however, is rely on "true" NPCs for the movement / scene placement that you are in full control of. These could feasibly even be invisible - just reference points for the characters that AC does control. When you enter a scene that such a character is in, you can update their Player character equivalent's position - either with the Player: Teleport inactive Action, or through script:

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.