• Register

The spin-off to Starpoint Gemini 2 introduces coveted strategic elements into the tactical space simulation that is the Starpoint Gemini franchise. Conquer territory, conduct research, scavenge for resources and defeat your enemies. In Warlords, think BIGGER! Bigger universe, bigger ships, bigger stations. Expect many tweaked features; the community has decided on what they want and now they are getting it!

Post tutorial Report RSS Using the Dialogue Editor

Learn how the dialogue system works in SG Warlords and how to best utilize the Dialogue Editor that comes with the game.

Posted by on - Basic Other

Contents

  1. The rundown
  2. The nodes that maketh the tree
  3. Using the editor
  4. Dialogue loops or Let me ask you something else
  5. How do I get out of this!?
  6. What does that Condition script do?
  7. What about the Action script?

Dialogue EditorThe most common way to make choices in the game is through branching dialogues and to create branching dialogues in an easy way, you basically need a dialogue editor. We've got you covered...



1. The rundown

Dialogues are saved as .dia files. They can be saved anywhere inside the game folder and they can of course be retreived, loaded and accessed through scripts in the game itself. The editor provides everything you need to make or edit a fully working dialogue with an unlimited number of nodes / lines. Really... there are no limitations (within sense and reason of course. Don't go recreating the Epic of Gilgamesh in it. It's not meant for that.)

2. The nodes that maketh the tree

The dialogue is represented simply as a tree, which is the most common way to do it. It's easy to read, assembly and edit. Each node or branch holds the required data. These nodes are then saved into the .dia file. So what does a node have?

  • Node Id is a unique identifier the games uses to know what node we're talking about. This ID HAS TO BE unique. The editor takes care of that on its own, but if you tweak a dialogue manually, take care that these IDs are not all jumbled up
  • The text keyname parameter is referencing a text line entry in the Data\Texts\dialogs.txt. That file has 2 important bits for every entry: a unique keyname identifying the text line and the text itself that is displayed in the game.
  • The speaker keyname is referencing Data\Base\Portraits.wdt. The name of the parameter says it all. This is where you assign who will speak the line in the game.

These are the fundamentals. Every node has to have these to at least appear properly in the game. There's a number of other parameters linked to each node, but these aren't that important at the moment. We'll cover the more advanced ones a bit later.

3. Using the editor

It's simple really. All the available actions that you can do on the dialogue tree are available as buttons on the left toolbar: adding new nodes, cut/paste, link to other nodes etc.. This is the only way to change where a node will appear, what other node it is linked to and so on.

To change things for an individual node (its specific parameters), you have to use the bottom part of the editor. On the bottom left, you can find the Character tab. Simply click on a character to set him/her as the designated speaker of the last selected node in the tree. Adding a new node to the tree automatically sets the currently selected character as the speaker to make things a bit easier.

The Console tab is mostly for debugging purposes and you can easily ignore it. The bottom right is reserved for the actual text that will be used and the potential Condition and Action scripts (you can find more info on these last two later in the article).

To assign a text, you can simply double-click on the text line there and it will appear on the last selected dialogue node.

4. Dialogue loops or Let me ask you something else

You've likely seen something like the text in the title lots of times in other games. The principle is simple: once you're done asking all the questions in a group, you loop back to a previous part of the dialogue. In our case, this is called linking instead of looping, because we're not forcing this to be used only for loop-backs. You can easily link a node to jump ahead if you wish.

Since all nodes are referenced by unique IDs, one might think I have node 8 linked to node 7. If I delete node 6, then node 7 will become node 6. What happens to my precious link?. No worries, the editor handles this on its own and no further action is required on your part. If a node jumps to another node, this will be displayed as (>>#) on the node itself, with the # being the Id of the target node.

5. How do I get out of this!?

Ending the dialogue is also simple. Any node that triggers the dialogue to end must be flagged as end node. Once more, this is handled automatically by the editor. If a node doesn't lead anywhere, meaning it has no child nodes nor is it linked to any other node, it will be flagged as end node. And, in-game, once the dialogue comes to such a node, the dialogue will shut down.

If for some reason, while testing your latest literary wonder, you realize you just got stuck in a dialogue and can't get out, check out the nodes and make sure there's an end node somewhere. If a node is an end node, this will be displayed as [END] on the node itself.

6. What does that Condition script do?

In some cases, you don't want to show a specific option to the player, or make it greyed out. This is achieved through the condition script. Before a dialogue node is presented to the player, the dialogue engine runs through the condition script (if there is any) and gets the resulting flag. The flag tells the game whether the node is visible, greyed out or completely invisible. What exactly you do in the script is of no consequence to the dialogue. It only looks for the node state flag. Here's an example where the node will be available to the player to choose only if he has the Hacking_I Perk. If not, the node will be visible, but greyed-out (unclickable). If there is no condition script, the default node state is used, which is to display the node properly.

/* CHECK HACKING I PERK */
int perkState = 0 ;
str perkKN = hack1 ;
perk GetPerkVal perkKN perkState ;
int nodeState = 1 ;
if perkState == 0
   nodeState = 0 ; /* node will be clickable */
else
   nodeState = 1 ; /* node will be greyed out */
endif
scriptvar SetValue int 0 nodeState ; /* set node state */

The last line is crucial. If a node has a condition script assigned, the condition script MUST provide the node state, otherwise the node will NOT show properly. Only change the nodeState function parameter and nothing else. You can find more info on this and all the other script functions in the Scripterion (game root directory).

To get a bit more technical, the script passes the nodeState to the dialogue engine through the internal variable stack. More precisely, an integer type, on slot 0. ... I know; rivetting. You can find a number of some common checks in the Data\Scripts\DialogChecks folder. The names of the scripts should tell you what they do. If a node has a condition script attached, this will be displayed as [C] on the node itself.

7. What about the Action script?

If the condition script is run before the node is displayed, then you can imagine what the action script does. It runs its course after the node is displayed OR clicked on. This is important to notice. An action script can be attached to a node spoken by an NPC, where the player didn't have to click on anything. Once the node is shown on screen, as spoken, the action script is triggered. But when the player has several choices, the action script is triggered ONLY for the node that the player clicks on!

Another VERY important thing to remember when linking scripts to dialogues. The game is paused during a dialogue. NEVER use the pause function in these scripts as these scripts WILL NOT EXECUTE properly! If a node has a condition script attached, this will be displayed as [A] on the node itself.


For further information, please feel free to contact us: modding@starpointgemini.com

For more information about SG Warlords check out these links:
Starpoint Gemini Warlords homepage
Starpoint Gemini Warlords forum
Starpoint Gemini Warlords Steam store page
LGM Games dev-blog
Follow us on Facebook
Follow us on Twitter

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: