Difference between revisions of "NPC Patrols"

From Divinity Engine Wiki
Jump to: navigation, search
(Changed format slighting and added different patrol types)
(Undo revision 3228 by Xephael (talk))
Line 1: Line 1:
= Overview =
+
== Overview ==
This page will guide you through the process of implementing NPC pathing and patrols. It's assumed that you know how to do things such as creating a level and using the Root Template Panel. It's recommended you get a feel for the engine by looking through some pages in the [[Community:_Getting_Started|Getting Started]] section.
 
 
<br />
 
<br />
== Different Patrol types ==
+
This page will guide you through the process of implementing basic NPC pathing and patrols using splines. It's assumed that you know how to do things such as creating a level and using the Root Template Panel. It's recommended you get a feel for the engine by looking through some pages in the [[Community:_Getting_Started|Getting Started]] section.
=== SplinePatrol ===
 
A spline patrol is the simplest form of patrol. It uses a spline to create a pathway that and character will walk along. There's a basic spline patrol creation guide included below.
 
 
<br />
 
<br />
=== Patrol ===
+
== Creating the Static NPC ==
A patrol set up using triggers. This type of patrol has more control than a spline patrol however it is limited in length to 7 waypoints.
 
<br />
 
=== PatrolOrdered ===
 
 
 
<br />
 
=== PatrolRandom ===
 
 
 
<br />
 
=== PatrollingGuard ===
 
 
 
<br />
 
= Guide - Basic Spline Patrol =
 
 
 
 
<br />
 
<br />
== Creating the Static NPC ==
 
 
To get started, place a character on your level using a character root template. For this tutorial, I've made a dog.
 
To get started, place a character on your level using a character root template. For this tutorial, I've made a dog.
 
<br />
 
<br />
Line 29: Line 12:
 
<br />
 
<br />
 
== Creating the Patrol Route ==
 
== Creating the Patrol Route ==
 +
<br />
 
In the Root Templates, right-click the Spline section and add a Spline to the level.
 
In the Root Templates, right-click the Spline section and add a Spline to the level.
 
<br />
 
<br />
Line 46: Line 30:
 
<br />
 
<br />
 
== Adding the Patrol Script to Your NPC ==
 
== Adding the Patrol Script to Your NPC ==
 +
<br />
 
The Divinity Engine 2 comes with quite a few premade scripts you can add to your characters and items. Select your NPC and find the scripts option in the sidebar under the Character section. It should look something like this:
 
The Divinity Engine 2 comes with quite a few premade scripts you can add to your characters and items. Select your NPC and find the scripts option in the sidebar under the Character section. It should look something like this:
 
<br />
 
<br />

Revision as of 15:06, 23 September 2017

Overview


This page will guide you through the process of implementing basic NPC pathing and patrols using splines. It's assumed that you know how to do things such as creating a level and using the Root Template Panel. It's recommended you get a feel for the engine by looking through some pages in the Getting Started section.

Creating the Static NPC


To get started, place a character on your level using a character root template. For this tutorial, I've made a dog.

Create a Character


Select your character and edit it however you like. We'll come back to it a bit later.

Creating the Patrol Route


In the Root Templates, right-click the Spline section and add a Spline to the level.

Spline.png


Select it and you will have a new tool on the left.

Add Spline Point.png


Select the tool, click the spline, and click the point that you want the patrol to begin. Continue adding points to make the patrol route. (You'll be able to make your NPC pause at each of these points if you wish, so keep that in mind when placing them.)

Spline Route.png


When you're done, select the spline once more and copy the GUID value.

Copy GUID.png


Adding the Patrol Script to Your NPC


The Divinity Engine 2 comes with quite a few premade scripts you can add to your characters and items. Select your NPC and find the scripts option in the sidebar under the Character section. It should look something like this:

Scripts in Sidebar.png


Open it and find GEN_SplinePatrol. Assign it to the NPC using the arrows in the middle. Select it and change the SplineGUID to the value we copied earlier. SleepAtNode and SleepOnEveryNode can be used to make the NPC pause along the patrol route.

Spline Patrol Settings.png


Click "Ok" and playtest the level. The NPC will follow the route of the spline.