![]() |
![]() |
|||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
How Do I Make My NPC's Initiate Dialogue On Their Own? Intended Audience: [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': 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: 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': 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': 5) Now you want to prevent the NPC from chasing after the PC. Enter the following under the trigger's OnExit event: 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'.
|
|||||||||||||||||||||||
|
|
||
|
Multiplayer Games at Neverwinter Connections
|
||
|
Buy Premium Modules
|
||
|
4,060,570 BioWare Users:
|
||