User Tools

Site Tools


hpl3:game:dialoghandler

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:game:dialoghandler [2012/12/12 13:02]
thomas
hpl3:game:dialoghandler [2015/09/17 10:18]
ian.thomas
Line 5: Line 5:
 The dialog handler is a used to create dialog that support basic branching behavior. If you want to do straight forward dialogs that have no branching at all, you might as well just call the Voice Handler directly. But if there are some branching, even simple like breaking the dialog if the player stop looking at a character, then the Dialog Handler is what you want. The dialog handler is a used to create dialog that support basic branching behavior. If you want to do straight forward dialogs that have no branching at all, you might as well just call the Voice Handler directly. But if there are some branching, even simple like breaking the dialog if the player stop looking at a character, then the Dialog Handler is what you want.
  
-===== Basic functioning ​=====+===== Basic functionality ​=====
  
 The dialog is setup just before it is a about to get played, so there is not special init (other than what you do for the [[hpl3:​game:​voicehandler|voice handler]]). You begin by calling Dialog_Begin() which makes the initial preparations and allows you to call the other functions. After that it is time to add a branch using Dialog_AddBranch. You can then use Dialog_AddSubject to add voice subjects to that branch. Once you add a new branch, then those subjects will belong to the newly added branch. When all branches and subjects are added, call Dialog_End to run the dialog. Dialog_End will also check which characters are used in this dialog, and by using Dialog_CharacterIsActive you can check which are currently in the middle of a dialog. The dialog is setup just before it is a about to get played, so there is not special init (other than what you do for the [[hpl3:​game:​voicehandler|voice handler]]). You begin by calling Dialog_Begin() which makes the initial preparations and allows you to call the other functions. After that it is time to add a branch using Dialog_AddBranch. You can then use Dialog_AddSubject to add voice subjects to that branch. Once you add a new branch, then those subjects will belong to the newly added branch. When all branches and subjects are added, call Dialog_End to run the dialog. Dialog_End will also check which characters are used in this dialog, and by using Dialog_CharacterIsActive you can check which are currently in the middle of a dialog.
Line 30: Line 30:
 ===== Branch Events ===== ===== Branch Events =====
  
 +==== Overview ====
 These events are needed in order to get the branching behaviors you are after. Events are added after having added subject and will belong that subject. They can in two types ''​LineEvents''​ and ''​EndEvent''​. The first type is checked after each voice line has completed playing. The second is checked when the entire subject is over.  These events are needed in order to get the branching behaviors you are after. Events are added after having added subject and will belong that subject. They can in two types ''​LineEvents''​ and ''​EndEvent''​. The first type is checked after each voice line has completed playing. The second is checked when the entire subject is over. 
  
Line 41: Line 42:
 Note that if asNewBranch is "",​ then the dialog does not jump to a new branch but just stops. Note that if asNewBranch is "",​ then the dialog does not jump to a new branch but just stops.
  
 +==== Conditions ====
 The different conditions available are:\\ The different conditions available are:\\
  
Line 70: Line 72:
 </​code>​ </​code>​
  
 +==== Example ====
 Now for some full test source. Lets say that we have a dialog that should stop playing whenever the player stops looking at the character, then we do like this: Now for some full test source. Lets say that we have a dialog that should stop playing whenever the player stops looking at the character, then we do like this:
  
Line 150: Line 153:
  
 When the selection is done, the implementation must call ReturnResponseSelectChoice in cLuxDialogHandler with the selected option. If time has run out, then -1 shall be sent as argument. When the selection is done, the implementation must call ReturnResponseSelectChoice in cLuxDialogHandler with the selected option. If time has run out, then -1 shall be sent as argument.
 +
 +===== Locking the player into a conversation =====
 +
 +There are a few cases in SOMA where we lock the player into a conversation i.e. they can't move their feet while it's happening.
 +
 +''​Dialog_StartConversation''​ is the simplest form of this; it just locks the player where they'​re standing right now.
 +''​Dialog_StartConversation_PosBased''​ actually moves the player'​s viewpoint to a specified position before starting the conversation,​ which is useful if you're worried about eyelines etc.
hpl3/game/dialoghandler.txt ยท Last modified: 2015/09/17 10:18 by ian.thomas