Editing How to script conversation between two or more NPCs

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
__TOC__
A basic scripted conversation between two NPCs is fairly simple to set up. Getting three or more NPCs to talk to each other, particularly if you want them to do something besides stand still, is more complicated. We'll cover all of these possibilities, starting with the simplest.




A basic scripted conversation between two NPCs is fairly simple to set up. Getting three or more NPCs to talk to each other, particularly if you want them to do something besides stand still, is more complicated. We'll cover all of these possibilities, starting with the simplest.
'''Creating a basic scripted conversation between two NPCs.'''
 
==Creating a basic scripted conversation between two NPCs==


There are two simple ways to get NPCs to talk to each other:
There are two simple ways to get NPCs to talk to each other:
Line 11: Line 9:


* Use [[StartConversation]] to trigger the conversation. This can be useful if you want to start the conversation with a custom topic (i.e. something besides HELLO).
* Use [[StartConversation]] to trigger the conversation. This can be useful if you want to start the conversation with a custom topic (i.e. something besides HELLO).


In order to force the NPCs to have a particular conversation, you need to set up the dialogue infos that they will use so that they link together into a complete conversation. The basic principles are as follows:
In order to force the NPCs to have a particular conversation, you need to set up the dialogue infos that they will use so that they link together into a complete conversation. The basic principles are as follows:
Line 36: Line 35:
* Repeat this process for the rest of the conversation. The final info in the conversation should have its "Link To" field left blank, and have "Goodbye" checked to indicate that it serves as the end of the conversation (otherwise the game will automatically tack on a random GOODBYE).
* Repeat this process for the rest of the conversation. The final info in the conversation should have its "Link To" field left blank, and have "Goodbye" checked to indicate that it serves as the end of the conversation (otherwise the game will automatically tack on a random GOODBYE).


==Creating a speech by a single NPC==
 
 
'''Creating a speech by a single NPC'''


Setting up a "speech" by an NPC (where he is the only one talking) is actually a variant of the process given above. You can either use StartConversation to tell him to talk to himself (e.g. BurdRef.Startconversation BurdRef), or set up the conversation so that all the infos are "Next Speaker: Self" (e.g. you have a second NPC present, but he never speaks).
Setting up a "speech" by an NPC (where he is the only one talking) is actually a variant of the process given above. You can either use StartConversation to tell him to talk to himself (e.g. BurdRef.Startconversation BurdRef), or set up the conversation so that all the infos are "Next Speaker: Self" (e.g. you have a second NPC present, but he never speaks).


==Creating a conversation between multiple NPCs==
 
'''Creating a conversation between multiple NPCs'''


Getting more than two NPCs to talk to each other, or getting NPCs to talk and move at the same time, requires abandoning the game's conversation generator completely, and handling everything by script. The key commands here are [[Say]] and [[SayTo]], in combination with script timers which track when it is time for the next NPC to speak. All the NPC conversations in the character creation sequence were handled in this way.
Getting more than two NPCs to talk to each other, or getting NPCs to talk and move at the same time, requires abandoning the game's conversation generator completely, and handling everything by script. The key commands here are [[Say]] and [[SayTo]], in combination with script timers which track when it is time for the next NPC to speak. All the NPC conversations in the character creation sequence were handled in this way.
Line 47: Line 49:


  begin gamemode
  begin gamemode
  ; count down timer
; count down timer
  if convTimer > 0
if convTimer > 0
    set convTimer to convTimer - [[getSecondsPassed]]
set convTimer to convTimer - [[getSecondsPassed]]
  endif
endif
  end
  end


Line 68: Line 70:
  begin gamemode
  begin gamemode
   
   
  ; talk when it is time
; talk when it is time
  if CharacterGen.speaker == 3 && CharacterGen.convTimer <= 0
if CharacterGen.speaker == 3 && CharacterGen.convTimer <= 0
    set target to CharacterGen.target
set target to CharacterGen.target
   
   
    if target == 0
if target == 0
        set CharacterGen.convTimer to Say CharGenMain 1
set CharacterGen.convTimer to Say CharGenMain 1
    elseif target == 1
elseif target == 1
        set CharacterGen.convTimer to SayTo BaurusRef, CharGenMain 1
set CharacterGen.convTimer to SayTo BaurusRef, CharGenMain 1
    elseif target == 2
elseif target == 2
        set CharacterGen.convTimer to SayTo RenoteRef, CharGenMain 1
set CharacterGen.convTimer to SayTo RenoteRef, CharGenMain 1
    elseif target == 3
elseif target == 3
        set CharacterGen.convTimer to SayTo GlenroyRef, CharGenMain 1
set CharacterGen.convTimer to SayTo GlenroyRef, CharGenMain 1
    elseif target == 4
elseif target == 4
        set CharacterGen.convTimer to SayTo UrielSeptimRef, CharGenMain 1
set CharacterGen.convTimer to SayTo UrielSeptimRef, CharGenMain 1
    elseif target == 5
elseif target == 5
        set CharacterGen.convTimer to SayTo player, CharGenMain 1
set CharacterGen.convTimer to SayTo player, CharGenMain 1
    endif
endif
   
   
  endif
endif
  end
  end


Line 94: Line 96:
  set characterGen.speaker to 1 ; Baurus
  set characterGen.speaker to 1 ; Baurus
  set characterGen.target to 2 ; Renote
  set characterGen.target to 2 ; Renote


See the CharacterGen quest, CharGenMain topic for an extensive example.
See the CharacterGen quest, CharGenMain topic for an extensive example.


==See Also==
==See Also==

Please note that all contributions to the Fallout3 GECK Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see GECK:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)