Yandros on 2/3/2014 at 18:58
Tutorial: Conversation SubtitlesThis tutorial will show you how to put subtitles on the screen during conversations, and have the text tightly synchronized to the audio. Also things like coloured text, tailoring the onscreen time and splitting a long line into several texts will be covered. This tutorial utilizes Telliamed's (
http://dromed.whoopdedo.org/tnhscript/onscreentext) OnscreenText script, which is available in tnhScript.
One main particular benefit is that this allows you to have the .str files for your subtitles translated, and players get localized subtitles for conversations. As long as you keep the files named the same and in language subfolders, it will work with no other changes, just as book texts do. This adds a lot of value since in most FMs, the texts and objectives are translated but the voice acting is usually only in English.
Step 1 - Creating the .str fileYou need to create the .str file for your conversation's subtitles using a text editor; I use (
http://notepad-plus-plus.org/download/v6.5.4.html) Notepad++. In most cases, place one line per page. However, each page will be shown on screen in its entirety, so longer lines may need to be broken up to avoid having a huge block of text on screen at one time. You can do this even if the long line is a single WAV file, using a technique I'll outline in the Advanced section later.
First of all, the page_n descriptor is used just as with any other book text. You may want to prepend the speaker's name in front of the line, to make it clear to the player who is speaking, like so:
Code:
page_0: "Lord Bumbleson: Cookie? COOKIE! Where is my dinner?"
You need not name the speaker, it could simply be "A guard" or "A Hammerite priest", for example. You may also choose to put quotes around the spoken words, which can be done using either single quotation marks, or a backslash before a double-quote:
Code:
page_0: "Lord Bumbleson: 'Cookie? COOKIE! Where is my dinner?'"
page_0: "Lord Bumbleson: \"Cookie? COOKIE! Where is my dinner?\""
Next, if you wish to make the text coloured (perhaps using the same colour for a given character throughout the mission), use the page_n_color descriptor. The value, in quotes, is in the standard HTML format #RRGGBB, and simple HTML colors like "red" or "blue" may also work, I've not tried.
Code:
page_0_color: "#3050DD"
If you're unsure how to determine the #RRGGBB code for a given colour, look in your graphics editor at the colour selection tool, or use an online resource like (
http://www.colorpicker.com/) to choose your colours.
The script will automatically set the duration to leave the text on screen based on its length, but sometimes you may need it to be shorter or longer. You can manually set a specific duration by using the page_n_time descriptor, giving a time in milliseconds. So to make Lord B's line remain on screen for 10 seconds:
Code:
page_0_time: "10000"
In most cases, however, I've found I need not set the time manually. I recommend that you go without any time values initially until you've tested the full working conversation in game and then only add times as needed.
So altogether, the first block in my .str file, for Lord Bumbleson's line, might look like this:
Code:
page_0: "Lord Bumbleson: 'Cookie? COOKIE! Where is my dinner?'"
page_0_color: "#3050DD"
page_0_time: "10000"
Continue doing this for every line in your conversation. Be sure the .str file is in your
\books\English folder (or whatever your language is).
Step 2: Dromed workFirst, of course you need to load
tnhScript if you've not already done so in your mission. I like to create an archetype under TrapTrig called
SubtitleTrap, and add to it
Code:
Scripts: OnscreenText
Editor > Design Note: page=0;
but you don't have to. It's fine to just create a TrapTrig instance and add those properties to the concrete object.
Then, you only need to set the
Book > Text property to the name of your subtitles .str file.
Next, you need to make a button and
ControlDevice-link it to the subtitle trap. Go in game and frob it, and you should see the first line on screen. Successive frobs cycle through all the lines, and eventually wrap back to the first line and start over. Once you confirm the button works, you need to name it since you'll be referring to it in the conversation steps; for my example I'll just call it "BtnSubsC1701" since it's for conversation c1701. Then, you should move it outside of any roombrush so the player won't hear it clicking whenever an AI frobs it. I usually embed it in a wall nearby so I can find it if I need to.
All you need to do now is create your conversation, hook up the actors with
AIConversationActor links (set the data to actor number), and begin adding steps - find a basic tutorial on conversations if you don't know how to do that. I generally use one step per line of the conversation, and the first action in any step which will have an actor speaking a line should generally be to frob the button. In other words, the actor about to speak should frob the button just prior to using the Play motion/sound action to say the line and perform motions.
So Lord Bumbleson's actions in the first step might be:
Inline Image:
http://www.wearytaffer.com/tutorials/subtitles/images/subtitles01.jpgFirst, he frobs the button to put the text on screen, then he plays the line and a motion, followed by a second motion. That's just an example, you will of course use different values and motions. Continue adding additional steps to the conversation in this way, generally having one actor frob the button and then play one line and play one or more motions per step of the conversation.
Step 3: TestingGo into game mode and trigger the conversation (rigging a test button linked to it is the simplest way). You should see each subtitle on screen as the actor says the line. If you notice any lines that should be onscreen longer, go into the .str file and add the _time descriptor and play with its value until the duration is what you like.
By always frobbing the button once just before performing a Play motion/sound action, the text stays in synch with the audio.
Advanced Usage: Splitting linesSuppose Cookie's excuse-ridden reply to Lord B. is very long-winded, and the text would be best split over two or more onscreen lines. This is easily done without any further changes to Dromed, or editing of the WAV file into multiple parts. In fact, this can be adjusted only through manipulating the .str file and nothing else.
Let's say that Cookie's response, Line 2 of the conversation, is "But your Lordship, I cannot complete thy meal without carrots, and the market stall had no carrots today. I have sent Armand to Auldale on a carrot quest, telling him not to return without carrots. When he returns with said carrots, I shall present thee with a meal fit for a king... or at the very least, fit for a pompous lord." That's quite too much to show on screen at once, so to split it you only need to make it multiple pages in the .str file, like so:
Code:
page_1: "Cookie: But your Lordship, I cannot complete thy meal without carrots, and the market stall had no carrots today."
page_1_color: "#FFFF40"
page_1_auto: "6"
page_2: "Cookie: I have sent Armand to Auldale on a carrot quest, telling him not to return without carrots."
page_2_color: "#FFFF40"
page_2_auto: "4"
page_3: "Cookie: When he returns with said carrots, I shall present thee with a meal fit for a king... or at the very least, fit for a pompous lord."
page_3_color: "#FFFF40"
Note the usage of the page_n_auto descriptor on the first two lines. This tells the script to automatically advance to the next page after that number of seconds (note seconds are used here, whereas milliseconds are used for the "time" parameter... I'm not sure why Telliamed did that). So, the actor is still only frobbing the button once at the beginning of starting this long line, but all three parts of the line will be displayed in succession. Naturally, you will need to adjust the "_auto" values to fit the lengths of the audio that corresponds to each bit. Note also that you should NOT put a page_n_auto on the last page; you want the next line (presumably spoken by another actor) not to be shown until its actor frobs the button again.