Movement

Introduction

The  NPC's movement is handled via two main types of game level objects: covers of the “Human” type and objects of the “Patrol Point” type. It is also possible to make an NPC move to any selected object by using the “goto_target” Visual Script action.

To make an NPC move through the level, the following actions must be performed:

  • Create an AI in the location where the NPC is supposed to move. See Navigation.
  • Create a Visual Script that will control the movement of the NPC. See VS Editor.
  • Add objects (covers or patrol points) with the help of which the movement path and character animation will be controlled. See Entity List.

Movement With the “goto_target” Action

Let's take a look at the simplest type of movement, the “goto_target” action.

By using goto_target, you can make an NPC move to a specific object on a level.

Add the action “goto_target” into a Visual Script (actions → npc → goto target).

To see the Visual Script in action right from the start of the game, add the “Start Game” trigger (triggers → game → start) and check the “Active?” option.

 

The NPC's movement is using goto_target. The actor is the target and the green ellipse marks the distance to the target at which the NPC will stop moving.

  

A Visual Script using goto_target.


In the case of goto_target, the target to which the NPC will move is set at the “point” output, while the “target” is the NPC for which the Visual Script is created. In this example, the goal is the actor.

Movement with Patrol Points

First, one or more patrol points must be added in order to be used to control the path of the NPC.

The patrol point object can be found in the General section of the Entities menu (Spawn tab).

 

A patrol point.


The direction the patrol point flag is facing displays the direction where the NPC is going to move.

To link several patrol points, add the following patrol point to the previously highlighted patrol point. If no patrol point is selected, a new patrol point will not be linked.

To link the patrol points, select the patrol point where you would like the link to begin, then move the cursor to the next patrol point that you want to link, then right-click in the edit window. From the popup menu, select Selected → AI Point: Add Link to Highlighted.

Linked patrol points.

Creating a Visual Script Using Patrol Points

Now add a simple Visual Script so that the NPC can use the patrol point. The figure below shows an example of such a script, and its key elements are described below.

To see the Visual Script in action right from the start of the game, add the “Start game” trigger (triggers → game → start) and check the “Active?” option.

The “play patrol path” Action

Now, add the “play patrol path” action to the Visual Script (actions → npc → play patrol path). This will be responsible for moving the NPC along the chain of patrol points. In the “Start Point” field of the “play patrol path” properties, specify the patrol point from which the NPC will start moving. After that, the “play patrol path” will display all the patrol points that are linked to the start point.

The “movement type” Action

Another important action is the “movement type” (actions → npc → movement type). Its properties specify the type of movement used by the NPC by defining boundary values. For example, from “walk_slowly” to “sprint”.

The movement type can also be set in the “Movement Type” field of the patrol point properties, i.e. after passing through this patrol point, the NPC will start using the movement type specified there.

Another way to configure the NPC's movement type is via the NPC properties (Saved Params → Movement Type).

Note: the Visual Script settings take priority over object properties. Therefore, if the “run” movement type is specified in the patrol point “Movement Type” property, and the same is set to “walk” in the Visual Script’s “movement type” action, the NPC will walk slowly using the “walk” setting.

If the movement type is specified neither in the Visual Script nor in the patrol point properties, the NPC will strive to use the fastest movement type available (in most cases, running).

The “min mental state” Action

The NPC's mental state is set using the “min mental state” action (actions → npc → anim state). For example, setting this to “danger-danger” will make the NPC move in a constant danger state (with weapon ready).

 

A Visual Script using patrol points.

Play the Patrol Path Properties

Comments

The field containing user comments to be displayed below the “play patrol path” header which serves as a hint when editing the Visual Script.

Start Point

Starting the patrol point where the NPC will begin the “play patrol path” action (with the “Start From Nearest Point” function turned off).

Start From Nearest Point

When this option is checked, the NPC will move to the nearest patrol point (of the chain of patrol points specified in the “play patrol path” properties). If unchecked, the NPC will move to the first patrol point (specified in the “Start Point” field).

Cover-Based Movement

Unlike “play patrol path”, a cover-based movement can be made smoother and more spectacular by assigning specific motions to be used when moving between covers.

An NPC moves through a chain of linked covers.

Add the initial cover (General → cover) and select the “human” type in its properties. With the cover still selected, add another cover (to ensure the first cover is linked to the second).

Choosing an animation to play while the NPC is moving between covers.


The animation selection window opens, letting you choose the animation to play while an NPC is moving from the first cover to the second, or vice versa, depending on which option is enabled in the Tool tab of the Properties panel. 

When adding the next cover, you must choose an animation the beginning of which matches the end of the previous one. For example, if an NPC enters a cover with the left foot in front, then the next walking animation should begin with the left foot forward.

Autolink Forward and Autolink Backward Functions

If the Cover → Autolink Forward option is selected, a new cover will be added, taking into account the animation of movement from the selected cover to the new one.

If the Autolink Backward option is selected, a new cover will be added, taking into account the animation of movement from the new cover to the selected one.

When both options are disabled, a new cover is created without any relation to the selected one.

Auto Xform Function

With the Cover → Auto Xform checkbox turned on, a new cover will be created where the animation specified in the “Move Action” field of the cover properties ends.

If this option is disabled, the cover will be added to the cursor's current location. This will distort the animation and as a result the NPC may not move correctly. Still, sometimes this is necessary to adjust the movement on the account of level geometry.

 

Linked covers.

Creating a Visual Script Using Cover

In a Visual Script, when using cover chains, the key is the “play cover path” action.

The figure shows an example of such a Visual Script with its key elements described below.

The “min mental state” and “movement type” actions don’t have to be enabled in the Visual Script because when moving between covers the NPC will use animations that take priority over the Visual Script settings.

To see the Visual Script in action right from the start of the game, add the “Start Game” trigger (triggers → game → start) and check the “Active?” option.

A Visual Script using covers.

“Play cover path” Action

Add the “play patrol path” action to the Visual Script (actions → npc → play cover path).

Now, specify the start and end covers for the NPC movement.

The output “From” of the “play cover path” action is linked to the initial cover, the output “To” – with the final one. The covers between them are not indicated.

On this page:




Exodus SDK © 2005-2023, 4A Games Limited. Developed by 4A Games®.
4A Games® is a registered trademark, and 4A Games Limited, Exodus SDK and their respective logos are trademarks of 4A Games Limited.
Published by Deep Silver. Deep Silver is a division of PLAION GmbH, Austria. Deep Silver and Plaion are registered trademarks of PLAION GmbH.
Metro Exodus is inspired by the internationally best-selling novels METRO 2033 and METRO 2034 by Dmitry Glukhovsky.
All other trademarks, logos and copyrights are property of their respective owners. All rights reserved.
By using this site, downloading or using the Exodus SDK or related content, you are agreeing to be bound by the terms of the End User License Agreement.


EULA