NWN2 Scripting.




Simulation Training.

Introduction
Home
First Program
Seeing Results
Variables and Data Types
Comments
Functions
Data Conversion
Random Numbers
Concatenation
Arithmetic Operators
Compound Assignments
One More or Less
Precedence
Relational Operators
The Open Branch
The Closed Branch
Logical AND
Logical OR
Compound Statements
ELSE If
Switch Case
The ? Operator
The for Loop
The while Loop
The do while Loop
Introduction to Functions
Passing Values
Passing Multiple Values
Multiple Functions
Simplifying Functions
TRUE/fALSE Conditions
Return Values
Setting Global Variables
Getting Global Variables
Setting Local Variables
Getting Local Variables
WayPoints Introduction
Static Waypoint Sets
Dynamic Waypoint Sets
Dynamic WP Cycles
Input Output

Static Waypoints

NWN2 Static Waypoint Sets offers a way of giving life to your module by having characters walk along a pre-determined path called a Waypoint Set. A Static Waypoint Set is a Waypoint Set where the waypoints (hence the path taken by teh NPCs assigned to that Set) is always the same (static).


Creating a Static WP Set

A Static Waypoint Set is a numberical sequence of a series of NWN2 Waypoints connected to each other by a common Identifier for the purpose of providing a pathway for one or more NPCs to traverse. The common Identifier for each Waypoint in the Static Waypoint Set is any legal C++ identifier.


Static WP General Form:

The general form for the tags of a Static Waypoint Set is:

                           WP_Identifier_nn

Where:

  WP is required prefix for a Waypoint Set.

  Identifier is any legal C++ identifier.

  nn  any number sequence such as: 01, 02, 03...0n


Example

A Static Waypoint Set consisting of three waypoints could be created with the following tags for each of the waypoints:

  Tag for Waypoint 1: WP_MyWP_01

   Tag for Waypoint 2: WP_MyWP_02

   Tag for Waypoint 3: WP_MyWP_03


Creating a Static Waypoint Set

  1. Create an Area in a given Module.
  2. Create three Waypoints, randomly spaced in the area in the form of a triangle.
  3. Use the following sequence.
  4. Blueprints/Waypoints/Empty/Wapoint
  5. For each of the Waypoints created assign the Waypoint of each individual Tag as follows:
  6. Properties/General/Tag
  7. First Waypoint Tag: WP_MyWP_01
  8. Second Waypoint Tag: WP_MyWP_02
  9. Third Waypoint Tag: WP_MyWP_03
  10. You should now see a series of white arrows connecting the three Waypoints together.
  11. This is now your Waypoint Set identified as MyWP
  12. Create a Creature to walk the Static Waypoint Set. For this example we chose an Elf.
  13. Go to the Properties for the Elf and select the following.
  14. Properties/Scripts/Variables
  15. Clicking on this box will make a small button with three dots appear. Click on the button to bring up the Collection window.
  16. Click the Add button on the Collection window.
  17. On the right side of the Collection window a Name and a VariableType will appear, with None as the default.
  18. Change the VariableType from None to String.
  19. You will now see a new box called ValueString.
  20. In the box labeled Name put: WP_TAG (must all be in caps).
  21. In the box labeled ValueString put the identifier. "MyWP" (must have quotes since this is a string).
  22. Click on the OK button.
  23. You will now see under Properties/Scripts/Variables for the Elf the forumal:
  24. WP_Tag="MyWP",
  25. Save the module and run it to test it.
  26. You will now see the Elf walk the three Static Waypoint Set

To create a new Static Waypoint Set just place new Waypoints in the area and name the set with a different identifier from the previous set. For a new Waypoint set consisting of three more Waypoints, the Tags could be:

WP_MySet2_01, WP_MySet2_02, and WP_MySet2_03.

You can have more than one creature assigned to the same Static Waypoint Set. Just follow the same direction given above for the Elf example, and apply them to the creatures you wish to traverse the given Waypoint set.


Where do we go from here

In the next section you will see how to create Dynamic Waypoint Sets.

 

 

Nwn2Scripting provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 2008 by Adamson House, Ltd. All Rights Reserved.

Questions or Comments: EMail Webmaster

Donations are to Adamson House, Ltd who maintains this site.
All donations go the the improvement of this site.