BioWare Atari
Información sobre BioWare Juegos de BioWare Soporte Foros Visit the BioWare Store
Neverwinter Nights Home
Neverwinter Nights Home

How Do I Make My NPC's Initiate Dialogue On Their Own?

Intended Audience: For Builders
By David Gaider

[Printer Friendly / Syntax Highlight]

OK, first off: until you know EXACTLY what you are doing, do NOT alter the script that is normally in the OnPerception event ("nw_c2_default2"). Leave it alone. If anyone tells you to alter anything but the OnSpawn and OnUserDefined scripts for you NPCs and you aren't confident of doing so, tell them they're full of monkeypoo.

As mentioned earlier, here, regarding UserDefined events, the generic AI is set up to allow you to use these events without altering the default scripting.

Using the OnPerceive method of starting conversation

1) Go into your OnSpawn script. Save it under a new name. Then go down to the line where it says 'SetSpawnInCondition (NW_FLAG_PERCIEVE_EVENT);' and uncomment it (remove the '//' double slashes at the beginning of the line). Compile the new script.

2) In your NPC's dialogue file, go to the very first line where he starts his dialogue with the PC. If you only want him to start this with any given PC once, add the following script into 'Actions Taken':

NWScript:

This sets the variable that is used in the script you were using, so the dialogue isn't done more than once.

3) Now create a new script in the OnUserDefined event for your NPC. You can put that second script in here, as follows:

NWScript:

POSSIBLE DRAWBACK: Now... one reason why this may not work? If your PC starts the game visible to this NPC, there is no OnPerceive event. The event only fires if the PC was previously non-perceived and then became perceived.

Using the Trigger Method for starting a Conversation

This is the one we use in the official campaign. It allows you to control at which point the NPC will run up to the PC, and also determine how far the NPC will run after the PC before giving up.

To set this up, you need to do the following:

1) Like as in #2 above, in your NPC's dialogue file, go to the very first line where he starts his dialogue with the PC. If you only want him to start this with any given PC once, add the script from #2 above into 'Actions Taken':

NWScript:

2) Go into your toolset. Put down a waypoint at the spot where your NPC will return to. Label it "WP_RETURN_" + the tag of the NPC. (so if the tag is 'Fred', label it "WP_RETURN_Fred". Remember that all tags are case-sensitive!

3) While in the toolset, create a new generic trigger and draw a polygon around your NPC. When the PC crosses into this area, the NPC will start running toward the PC to talk. If the NPC leaves this area, he will stop chasing the PC and return to the waypoint.

4) Go to the trigger's 'Scripts' tab and include the following script under 'OnEnter':

NWScript:

5) Now you want to prevent the NPC from chasing after the PC. Enter the following under the trigger's OnExit event:

NWScript:

This method doesn't care if the PC is visible or not... crossing into the trigger will cause the NPC to initiate. If you want to make sure that the NPC sees the PC, add the following line immediately under 'if(GetIsPC(oPC) &&' in the OnEnter script:

GetObjectSeen(oPC, oNPC) &&

As well, in a multiplayer game, the NPC will attempt to talk to each and every player at least one with this method. If you only want him to run up to one PC EVER, then do the following:

1) In the dialogue script, replace 'GetPCSpeaker()' with 'OBJECT_SELF'.
2) In the OnUserDefined script (in the first method) or the OnEnter script (in the second method), replace the 'oPC' in the GetLocalInt command to 'oNPC'.

 

 

Dragon Age: Origins Preorder
Neverwinter Nights 2 Forums
Mostrar/Ocultar

English
Deutsch
Français
Español
Italiano

Mostrar/Ocultar

Ver las últimas pantallas 

Ver las últimas pantallas
Mostrar/Ocultar

Multiplayer Games at Neverwinter Connections

Today
Schedule a Game...



La hora actual es: (insertar hora)
dom, 22 noviembre 2009 12:25

Mostrar/Ocultar

Download Modules

Top NWN: HotU Modules:
1. Good vs Evil III
2. More...

Top NWN: SoU Modules:
1. Good vs Evil III
2. More...

Top CEP Modules:
1. The Lord of Terror The Diablo Campa...
2. More...

Top Modules - NWVault:
1. Hall of Fame
2. More...

Total Modules: 4423

Mostrar/Ocultar

5,048,601 usuarios de BioWare:
  71 conectados
  6 ocultos
  207 invitados

1363 Playing Online
  100% NWN
  98% NWN: SoU
  99% NWN: HotU

447 Registered Guilds

8,768,447 mensajes en los foros

Temas más recientes de los foros:
1. Weapons Of choice? (Jade Empire Xbox General Discussion (Spoilers Will Be Moved))

2. setting time in a script. did I... (NWN 1: Scripting)

3. Another update coming next week? (Mass Effect 2 General Discussion (No Spoilers Allowed))

4. Inferno armor available at Amaz... (Mass Effect 2 General Discussion (No Spoilers Allowed))

5. Will ME2 feature "ME1" or "DAO" ... (Mass Effect 2 General Discussion (No Spoilers Allowed))