Three Way Conversation Tutorial

From GECK
Jump to: navigation, search

Getting Started

This tutorial will explain how to create a conversation between three NPCs. Note that it will be necessary to know how to create new NPCs and new topics as that will not be covered in the scope of this tutorial (in order to keep this one concise). Also, some scripting is involved; we will be using the functions Say and SayTo, and the blocktype SayToDone throughout the tutorial.

To start, you will need the following:

  • Three new non-playable characters (NPCs)
  • Topics (what the characters will say)
  • A way to set the StartTalking variable

Example

For the example, we're going to recreate a conversation from Three Amigos. Our three new NPCs are Lucky, Dusty and Ned, and here are the lines each has:

Line Topic
Dusty: Lucky. What are you gonna do with your share of the money? DustyTalk1
Lucky: A car. A big, shiny, silver car. I'll drive all over Hollywood... show Flugleman a thing or two. What about you? LuckyTalk1
Dusty: New York. Maybe Paris. A lot of champagne. Parties. Be a big shot for a while. DustyTalk2
Lucky: Yeah. How 'bout you, Ned? LuckyTalk2
Ned: I'm gonna start a foundation to help homeless children. NedTalk1
Dusty: That occurred to me to do that at one point too. DustyTalk3
Lucky: I meant I would do that first, and then I would get a big, shiny car. LuckyTalk3


Prior to Scripting

  • Open the editor.
  • Create three new NPCs: Dusty, Lucky and Ned.
  • Create the topics above on the conversation tab for the quest of your choosing.
  • Find Dusty in the list of NPCs in the Object Window and bring up its edit window.
  • Click the script button “…” to the right of the script dropdown list.
  • Open the Script dropdown menu and select New.


Dusty’s Script

ScriptName DustyScript

Short StartTalking

Begin GameMode
  If StartTalking == 1               ; 
    SayTo LuckyRef DustyTalk1        ; Dusty says the first line
  EndIf
End

Begin SayToDone DustyTalk1           ; When Dusty is finished saying first line…
  LuckyRef.Say LuckyTalk1            ; Lucky says his first line
End 

Begin SayToDone DustyTalk2           ; When Dusty is finished with second line…
  LuckyRef.SayTo NedRef LuckyTalk2   ; Lucky says line to Ned
End

Begin SayToDone DustyTalk3           ; When Dusty is finished with last line…
  LuckyRef.Say LuckyTalk3            ; Lucky says his last line
End

Some notes:

  • The “Ref” after each person’s name stands for reference, as it will be a reference speaking the line, not the base object itself.
  • The start of the conversation occurs in the GameMode block. In this case, Dusty starts the conversation by having his StartTalking variable set to one. When Dusty is done, his script triggers Lucky to speak. Each NPC triggers the next one to speak in a Begin SayToDone block.
  • Lucky always speaks after Dusty in this conversation, so Lucky appears in each of Dusty’s SayToDone blocks.
  • Both Say and SayTo functions are used in this script, depending on if the line is directed at someone in particular or not.

Lucky’s Script

ScriptName LuckyScript

Begin SayToDone LuckyTalk1     ; When Lucky is finished saying first line…
  LuckyRef.Say DustyTalk2      ; Dusty talks for his second time
End

Begin SayToDone LuckyTalk2     ; When Lucky is finished with second line…
  NedRef.Say NedTalk1          ; Ned gets to talk
End

Some notes:

  • Lucky doesn’t have a third SayToDone block because it is not necessary; nobody speaks after this line (well, in the movie they do, but we’ve stopped here).


Ned’s Script

ScriptName NedScript

Begin SayToDone NedTalk1       ; When Ned is finished with line…
  DustyRef.Say DustyTalk3      ; Dusty says his line
End


Conclusion

In general, you will have one of the characters in a group start the conversation via a script in their Begin GameMode block (with a Say or SayTo function). A SayToDone block will also appear in that character's script, and will be called as soon as the line is completed. The SayToDone block will instruct which of the other 2 conversation participants should talk next, and what they should say. It can then jump to that character's script and the applicable SayToDone block will be executed. This lets the user create a natural looking conversation with 3 or more NPCs without having to use any variables or timers.

There are several ways to create multiple NPC conversations. This is just one.

See Also

How_to_set_up_a_scripted_conversation_between_two_or_more_NPCs