Dialogues

From Wolfire Games Wiki
Revision as of 22:37, 27 December 2009 by Spinnacre (talk | contribs)
Jump to: navigation, search

Beware. Dialogue editing may be incorrectly documented in the DebugReadme and some older threads in the forum. NOTE: Dialogue editing does not work in Windows wersion. Use hex editing instead.

You should first be familiar with the map editor: see Map_Editing.


The Dialogue File

You can write your dialogue following the patterns of the dialogue files found in "Dialogues", inside the "Data" folder located within your Lugaru folder. There are plenty of examples.

Try opening "Example.txt", for instance. You'll get:

Dialogue boxes: 7

Box 1:
Location: 1
Color: 0.0 0.0 0.0
Name: Turner
Text: Hi, Skipper!
Sound: 7

Box 2:
Location: 2
Color: 0.0 0.0 0.2
Name: Skipper
Text: Hey, Turner!
Sound: 7

Box 3:
Location: 2
Color: 0.0 0.0 0.2
Name: Skipper
Text: What's all this talk about hiring guards?
Sound: 1

Box 4:
Location: 2
Color: 0.0 0.0 0.2
Name: Skipper
Text: There's never been any trouble here while I've been in\charge!
Sound: 4

Box 5:
Location: 1
Color: 0.0 0.0 0.0
Name: Turner
Text: The raiders are getting more confident... you never\know.
Sound: 1

Box 6:
Location: 2
Color: 0.0 0.0 0.2
Name: Skipper
Text: I've seen you when you get mad; I think you could\take care of yourself.
Sound: 6

Box 7:
Location: 1
Color: 0.0 0.0 0.0
Name: Turner
Text: It's not me that I'm worried about.
Sound: 4

Just write your own dialogue using the precise same format. Here is a description of the different attributes:

  • Dialogue boxes: n- number of panes in your dialogue.
  • Box n:- pane number n.
  • Location: n"- 1 = on top of screen, 2 = on bottom.
  • Color: r g b- each number r, g, b corresponds to the amount of red, green, and blue. It should be a number between 0.0 and 1.0, written in the format of 0.2, for example.
  • Name: Whatever- Name of the speaker.
  • Text: Whatever- The text itself. Must never be longer than 128 characters, and should include a "\" (backslash) every 50 or so characters to create a line break.
  • Sound: n- Quote David: "I think 1-2 are chitter sounds, 3-4 are pain, 5-8 are attack, or something along those lines".

Here's a kind of guide:

-0 Silence
-1 chitchat, mountingdescending
-2 Very similar to above
-3 Scroosh, plain and short
-4 Screech! pain!
-5 truhu, short chatter
-6 Creetsh, attack!
-7 aha, short banter
-8 Scroosh, short, affirmative tone
-9 Wolf growl
-D Wolf casual bark
-F Wolf bark
-10 Wolf chitchat bark


BUG!: 'Text' fields that are either 10 or 13 characters long make the map crash. For example:

Text: You knew him?

won't work because 'You knew him?' is 13 characters. To solve the problem, add a '#' at the end of the string, like this:

Text: You knew him?#

The '#' won't appear in the actual dialogue.


Then, save your dialogue as, say, "YourDialogue.txt" in the aforementioned Dialogues folder.

Adding a New Dialogue

Activating the Dialogue in the Map

Open the map you want to put the dialogue in, position yourself and all other characters that partake in the dialogue at the right position. They will be teleported there every time the dialogue is activated, and won't budge until the dialogue is over. Beware sands and snow maps where the ground level can change: this can mess up your camera angles. Look in the troubleshooting section for workarounds.

Once everybody is at the right place, enter the console and type:

dialogue n yourdialogue

where "yourdialogue" is whatever name you gave to your dialogue file, minus the ".txt", and n is the dialogue type. Quoting David:

The type value is what specifies how the dialogue functions. For example, if dialoguetype is 1, you activate the dialogue by approaching player 1 and pressing attack (if hostile is 0)

  • If it is 11, you just move near player 1 and the dialogue plays automatically (and then functions the same as 1).
  • 21 is the same as 11, except after the dialogue, hostile is set to 1
  • 31 is the same as 11, except after the dialogue, you win
  • 41 is the same as 11, except it can occur during combat
  • 51 is the same as 21, except every character is alerted to your presence.

A couple small tricks:

  • Dialogues that are triggered only once can be cumulated on the same character, in such a way that the dialogue is different when you go see him again (ie you can put two dialogues of type 11, or one of type 11 then one of type 21).
  • 41 is always triggered from the start of the level; at the end of the dialogue the camera travels from the position you were when you saved the level to the position you've been teleported to for the dialogue. Use this to your advantage.

Once you have typed in the above command, you enter dialogue-editing commands to set the camera views:

Dialogue-editing Mode

Quoting David:

"This is much like the mode when you watch a dialogue scene, except you can control the camera. You can use the numpad to set which direction characters' heads are facing (i.e. numpad zero sets Turner's head to point in the same direction the camera is facing, numpad one does this for player one, and so on). Then you press the number key (not on the numeric keypad) that corresponds to who is the speaker, and go to the next dialogue box. For example, pressing '0' assigns Turner to be the speaker, and then goes on to the next dialogue box."

Small technical detail: every character whose head you set to a fixed direction at some point will be considered as being part of the dialogue, and will be teleported to its current position at the beginning of the dialogue.

Bug: sometimes Lugaru may crash once you've just finished editing the dialogue. However you can still call the console and save the level. Then, quit and restart Lugaru, and your dialogue works fine.

Modifying Existing Dialogues

Deleting a Dialogue

The command "ddialogue" deletes the last dialogue you created, in stack order.

Updating an Existing Dialogue

If you want to change camera angles, you have to delete the dialogue and restart the whole process. Except than:

Small trick: the "immobile" command prevents a character from being teleported at the beginning of a dialogue, so you can slightly move him with respect to the camera angle.

You may want to change the content of the dialogue because you updated the corresponding dialogue file (the one in the "Dialogues" folder), without having to set all camera angles again. Use the command:

fixdialogue n yourdialogue

where once again "yourdialogue" is whatever name you gave to your dialogue file, minus the ".txt", and n is the dialogue number.


Troubleshooting FAQ

  • I edited the map, and at some random point, Lugaru began crashing when I try to load it! [curses]

There's a trick to fix this (yes there is) provided:

-You have a reasonably recent, working backup. You should :P

-You know how to use a hex editor. If not, you can try using this "MapFix" program for OS X: http://rapidshare.de/files/18252652/MapEdit.zip.html The link may or may not still be available. In case not, the ANSI-C source is also stored here: MapFix.

I'm not talking about a level crashing after you hex-edited it, because in that case, you're the bug. I'm talking about a level that has ceased to work after you modified it with the map editor.

In my experience, this actually only happens when the original level contained dialogue, and all you need to do is restore the dialogue data from your backup. Open your hex editor, and copy everything from the beginning of the backup until 3 bytes before the first occurence of the string "Data:". Select the same data (from the beginning of the file until 3 characters befor the first "Data:" string) in your crashing level file. If the length is the same, you win. Just paste the data you've copied from the backup. Otherwise, that backup was too old, and you lose.

As strange as it may sound, this has always worked for me, ie if "you win" then the level does work again.

  • I edited the map, and at some random point, the dialogue started refusing to trigger when I reload the map!

First, check that you saved the map with hostile set to 0. Most dialogues won't work otherwise. If the dialogue should start immediatly, also check that your character is at the right place (usually, near the person he's supposed to talk to). If the dialogue still doesn't work, go on.

There's a trick to fix this if:

-You have a reasonably recent, working backup. You should :P

-You know how to use a hex editor. If not, you can try using this "MapFix" program for OS X: http://rapidshare.de/files/18252652/MapEdit.zip.html The link may or may not still be available. In case not, the ANSI-C source is also stored here: MapFix.

Open your hex editor, and copy-paste the bytes from address 2F to 41 from the backup to the current level. Among other things, this sets the main character to the right place.

Check: the number before the 'B' character on the very first line of the file is the same as in the backup, probably a 0.

Either everything crashes (backup is too old), or the dialogue works again.

  • Lugaru crashes when I try to load my dialogue file.

Make sure that no box text is longer than 128 characters.

  • Lugaru crashes every time after I add my dialogue to the map.

This will happen if a string in your dialogue is exactly 10 or 13 characters long. For example:

Text: You knew him?

won't work because 'You knew him?' is 13 characters. To solve the problem, add a '#' at the end of the string in your dialogue file, like this:

Text: You knew him?#

The '#' won't appear in the actual dialogue.

  • The ground level is changing, and camera angles are messed up!

-Tactic 1: Change terrain type to grass (I *think* they don't have this problem).

-Tactic 2: Create you dialogue above ground level. Place your character on rocks or platforms. They won't be dependant on ground level.

  • Lugaru crashes right after I edit camera angles.

You can still call the console, save the level, and restart Lugaru. You'll be fine.