Forum rules - please read before posting.

Is it possible to "Move To" an NPC to a moving marker...?

Hi,

I need that an NPC moves in front of the player, so I've created a marker and make it a child of the player object in Unity, so this marker moves with the player at all times.

Then I've created a cutscene so the NPC moves to that marker. It works as intended and the NPC ends in front of the player.

The problem arises when I create an event in which the player also moves to a specific position. The player also has a "move to" action that executes at the same time as the "move to" action of the NPC, so the NPC ends near the location where the player WAS when the actions were executed.

So... I really need that the NPC ends in front of the player, even if he didn't reach his target location yet. He should move to where the marker was going to end when the player stops, not where it is when the action runs.

Is there any way to easily assign a move-to target to an NPC, without the need of creating a marker on the fly?

I'm using a visual scripting plugin in Unity and I'd very much prefer to not resource to exec-time created objects... :-/

Thank you.

Comments

  • Just so I understand you correctly, the problem is that if the Player moves while the NPC is also moving, the NPC ignores the new position and instead goes to their original target, correct?

    You could get around this by having a looping ActionList/Cutscene (set to Run In Backround so that it doesn't interrupt gameplay) which is just a cycle of a Character: Move to point Action followed by an Engine: Wait for a brief time before looping back in on itself.  This would cause the NPC to recieve repeated calls to the Marker - so even if the Marker moves, they'll just get another call with the update position.

    This could also be done through a custom script by calling the NPC's MoveToPoint function.  Also know that there is a Character: NPC follow Action if you just need the NPC to be nearby the Player rather than directly in front.
  • Thank you for your reply Chris! Helpful as always. ;)

    I can't use the Follow command because I have very strict positioning needs (both characters start a synchronized animation between them), but I'll be sure to try that background process method and see if it works for me.

    As long as I can deactivate it on demand, so I don't end up with dozens of NPCs chasing the player off, it it be fine. :-*
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.