NWN2 TOOLSET HOWTO - TRIGGERS
In this HowTo, you will be introduced to triggers, and you will learn how to
place them in the game. You will also gain a more detailed understanding of
two specific types of triggers: speak triggers and area transitions.
TABLE OF CONTENTS
- What is a Trigger?
- Placing a Speak Trigger
- Area Transition Triggers
- Conclusion
WHAT IS A TRIGGER?
Unlike most objects that are placed in the game world, triggers are usually
invisible to players. They behave as their name suggests � when a PC crosses
the border of a trigger, something happens. A trigger might activate a dialog,
spring a trap, or spawn a gang of monsters.
If you have played the Sample Module, �Uninvited Guests,� then you have
already encountered a simple trigger. When you first approached Pitney
Lannon, your PC entered an invisible speak trigger. This trigger caused Pitney
to run toward you and opened his dialog window.
The toolset provides a set of pre-made triggers for quick and easy use.
More advanced modders will probably make extensive use of the �generic�
trigger, which can activate custom scripts and is highly versatile. For the
purposes of this tutorial, however, we will focus on some simple pre-made
triggers.
PLACING A SPEAK TRIGGER
A speak trigger opens the dialog window and launches a Conversation file.
To place a speak trigger in the world, first open an Area in your module. Then
locate the �Blueprints� panel, and select the �Triggers� tab.
Click �SpeakTrigger,� and move your mouse pointer into the Area Viewer. Note
that the mouse pointer looks like a crosshairs, instead of an arrow.You will
now define the borders of a new SpeakTrigger.
Click once in the Area Viewer to set the first corner of your trigger. Then
click another point nearby � a line will be drawn, connecting the two points.
Click two more points to define a square or rectangle. Press F2 (or right-click
once), and your mouse pointer will return to default mode. A trigger can be
any shape. You set as many corners as you like, and the toolset will adjust
your trigger�s shape accordingly.
Once you have created a trigger, you can move it around the Area, just
like any other placeable object. Click your trigger once, and click-and-drag it
wherever you want.
Advanced Topic: Reshaping Triggers
If you don�t like the current shape of a trigger, you can right-click it and
select �Repaint Trigger� from the Dropdown Menu. This turns your mouse
pointer back into a crosshairs. As soon as you click once in the Area Viewer,
your old trigger shape will disappear, and you�ll be able to set a new one.
When you Repaint a trigger, any properties that you have already set on that
trigger remain unchanged.
Your trigger is now placed in the world, but you will need to set its
properties before it will have any in-game effect. Start by selecting (clicking)
your trigger. Then take a look at the Properties Panel.
First, be sure that the �Properties� tab is selected. Scroll down to the �Scripts�
section. Notice that the On Enter Script is already set to gtr_speak_node. Do
not change or delete this script � it provides the basic functionality for a speak
trigger.
At the bottom of the �Scripts� section is a line labeled �Variables.� Click the
field to the right of the �Variables� label (you should see some boldfaced black
text in this field), and a browse button (labeled with ellipses) should appear.
Click the browse button to open the Variables window.
You should see nine variables listed in the new window, labeled 0 through 8.
Click on each of these to view its settings on the right-hand side of the
window. We�ll review the most important of these variables, in turn.
- NPC_Tag. Determines the NPC who will be initiating conversation with
the player. Enter this character�s tag in the �ValueString� field. In the sample
module, ValueString is set to 01_pitney, which is Pitney Lannon�s tag.
- Conversation. The most important field � your trigger will do nothing if
this field is left blank. This field specifies the tag of the conversation launched
by your trigger. Enter this conversation�s tag in the ValueString field. In the
sample module, ValueString is set to 01_pitney, which is the tag of Pitney�s
conversation.
- Run. Determines whether the NPC will approach your character when the
dialog begins. If you set the ValueInt field to 1, the NPC will run to your
character. If you set ValueInt to 0, the NPC will walk. If you set ValueInt to -1,
the NPC will remain where he is. In the sample module, this variable is set to
1, so that Pitney comes running over to your character as his dialog
begins.
- TalkNow. Determines whether the dialog starts before the NPC
approaches your character. Set the ValueInt field to 1 if you want the dialog to
start immediately. Set ValueInt to 0 if you don�t want the dialog to start until
the NPC reaches your character. In the sample module, this variable is set to 0,
so that Pitney�s dialog doesn�t open until Pitney runs over to your
character.
- MultiUse. Determines whether the trigger will fire every time a PC enters
it, or if it fires only once per game. Set ValueInt to 1 if you want the trigger to
fire every time a PC crosses its border. If you leave ValueInt set to 0, the
trigger will only fire once. In the sample module, this variable is set to 0, so
that Pitney only initiates his conversation the first time the player enters the
speak trigger.
Advanced Topic: Speak Triggers and Combat
CombatCutsceneSetup. This special variable is useful when a speak trigger is
placed in a dangerous area. If there is a chance that hostile enemies might be
nearby when a player enters the speak trigger, set this variable to 1. This will
cause all hostile creatures to disappear for the duration of the triggered
conversation (and prevents your player from being attacked while stuck � and
helpless � in dialog). In the sample module, there is no chance of any hostile
creatures attacking the player in the Lannon Farm area, so this variable is set to
0.
After the conversation, the hostile creatures will be returned and game
play will continue normally.
If you have assigned a conversation tag to the Conversation variable, assigned
an NPC tag to the NPC_Tag variable, and made sure that this NPC is placed in
your Area, then your speak trigger is ready to test in game!
Now that you have learned the basics of placing a trigger, we will discuss
another trigger type: the area transition.
AREA TRANSITION TRIGGERS
An area transition allows the player to move from one area to another by
walking over a trigger. They are useful in situations where a door is
inappropriate (for example, if you want the PC to leave an area by walking
down a road). This section explains the basic functionality of area transition
triggers, defines parameters that need to be set, and notes how they differ
from speak triggers.
Place an area transition in the same way as a Speak Trigger. To properly
set an area transition so that it will transport players to the area of your choice,
first select your area transition trigger, and look at the Properties panel and
tab.
Locate the �Behavior� section, and set the following fields:
- Link object type. Determines whether your area transition will send the
player to a door or a waypoint. From the dropdown menu, select �Transition to
a door� if you want the player to be sent directly to a door object.
Select �Transition to a waypoint� if you want the player to be sent to a
particular placed waypoint. (If you select �No Transition,� then your area
transition will do nothing.)
- Linked to. Sets the tag of the door or waypoint destination. [Note: You
must be certain that this tag matches the tag of your door or waypoint exactly,
and that this door or waypoint is actually placed somewhere in your
module.]
- Party Transition. Determines whether the entire party is sent to the
destination door or waypoint. If this field is set to true, the entire party will be
transitioned to the new area when any one member of that party enters the
area transition trigger.
If this field is set to false, and a member of the party enters the area transition
trigger, that member will be sent to the new area, but the other party
members will be left behind. In general, it is a good idea to set this field to
True.
- Localized Name. You can use this field to remind yourself of an area
transition�s purpose and/or destination. It is not displayed to players.
If you have set the properties described above, and made certain that your
destination door or waypoint is placed somewhere in your module, then your
area transition is ready to test in game!
Advanced Topic: World Map
It is also possible to set up transitions that bring the player to a World
Map. The world map is an image that you create that depicts an abstracted
map of your entire game world. You can place map points on the map, with an
image (such as a city or dungeon icon) associated with each.
When the player goes to the World Map, they can just select their desired
destination and they will transport there instantly. You can even set-up scripts
to cause special events to occur when the player travels to certain areas at
different points in the adventure.
To experiment with the World Map Editor, go to Plugins World Map
Editor.
The global script gtr_world_map_en is used in the Official Campaign as an
OnEnter script for all triggers that serve as World Map transitions.
CONCLUSION
Triggers are a useful tool in area design and allow you to create events that
happen based upon the location of the player. Now that you�ve completed this
HowTo, you should know:
- How to place a trigger in the game world, and how to redraw it, if
necessary.
- How to trigger a dialog from a trigger.
- How to use triggers to transition from one Area to another.
|