So you want to learn your ways around Strife's Conversation System. This tutorial will help you with just how you can spice up your map with RPG elements identical to those found in Strife. Something that took me about 2 hours of research just to find out how the conversation system worked in UDMF will be explained here and then some.
If you're already familiar and know how to set up a simple conversation you can jump down to Additional content
and check if there's stuff you might not know.Tools used:
- Doom Builder (Not required)
Prepared map if you decide not to go with Doom Builder: Click here-Introduction-
To start off, we need a map with a simple room and some monsters. Something like this.
Since we're using Doom don't forget to tick the Stand still
Simple as that. We can now use SLADE to open up our Wad file and add a file called DIALOG01
. This will tie a Dialogue file to our MAP01. Let's give our Shotgun guy some random dialogue and turn the Revenant into a shopkeeper.
If you have meddled with ACS before you can see we need to add some lines to specify namespace and included files. We also have the following:Conversation blocks:
Conversation blocks contain one actor, either a ConversationId or a classname.Page blocks:
Page blocks contain the meat of the dialogue. Pages are numbered in order from top to bottom, so you can have several pages to make an entire row of dialogue. Holds initial dialogue for the actor and a name for the actor inside the conversation.Choice blocks:
Choice blocks are options for the players to pick inside the conversation. This can either advance the conversation, give the player an item or call a special (Like ACS_Execute to call a script).
You can now run it in game since dialogue in UDMF does not need to be compiled, so save and try it in game. Congratulations! Your first step into the world of RPG-themed maps have just begun!-Additional content-
Just like in Strife you can do more than just simple conversations and shopkeepers. Following is some more things you can do to add variety and life to your map.Random phrases
Perhaps the most interesting and complex feature of the dialogue system. Using a LANGUAGE lump you can randomize pieces of dialogue to have that extra variation and characteristic your actor/map could use.
Aside from the simple LANGUAGE setup, we have 10 lines for the Shotgun guy to utter when engaging in conversation with him. We also need to make a change in our DIALOG file.
This seems like magic, so how does all this work? Well the way LANGUAGE and presumably the Dialogue system work is that they go by semantics instead of defined syntax. This means if you know the magic words you can take advantage of the features. In our LANGUAGE lump we actually NEED to start our lines with "TXT_RANDOM_" to let the game know the line is part of a series of randomized responses. We also have precisely 10 responses, what gives? The exact number of random responses characters in Strife can give is 10, so that means we are limited to 10 random pieces of dialogue, no more and absolutely no less. If you specify less than 10 responses the game will automatically fill out the rest with responses consisting of "Go away!", if you specify more they will simply not be used.
Likewise in DIALOG we start off with the case-sensitive "RANDOM_" to tell the game we want to lookup a set of responses and pick one.
If you need more information you can click here to check out a draft of the system
In the old days of being tied to ConversationId, two actors of the same actortype/class could not have their own unique conversations, hence why Strife has like 30 types of Peasants if you take a gander at ZDoom Wiki's classes page. However, with UDMF you can! By restricting a conversation to an actortype/class instead of a number and setting a unique id number to the conversation:
Like so! We can now have two Revenants with their own pieces of dialogue, eliminating the need to create several identical classes. Don't forget to set the ConversationId to the id you specified.
Doing so we now have two Revenants with uniquely bound conversations to them. Using ACS you can also change their ConversationId on the fly! You can also do that directly using Linespecial 79.If-Player-Carries-Item
In lack of a better name, you can also check if the player carries an item/weapon and initiate a different piece of dialogue based on that. Let's make our bragging bonebag comment our newly acquired Rocketlauncher we got from his friend.
By adding an additional page, a link to that page's index number and a "ifitem" condition, we will get a different response out of him. Talking to him without the Rocketlauncher will make him brag about his height, talking to him with the Rocketlauncher makes him brag about his shoulder launchers. Nifty! [Updated: 2017-03-07]
Another update with more explained goodies? Yes indeed, continue reading below as we delve into:
-Include/Exclude ChoicesBye Choices
Probably one of the most desired features, to change the elusive Bye choice into something more fitting. After all, you don't say "Thanks, bye!" when a stranger threatens to gouge your guts out.
By defining a "goodbye" string we can turn that around into something more desireful. Let's turn the goodbye for the Skeleton Shoppe into something more casual.
Alternatively, if we're feeling more adventurous, we can also randomize these responses as well!
Just follow how we previously did for randomizing the responses for our bored Shotgun guy.
Voila, random bye responses, now you can fit appropriate goodbye messages for the right context.Costs
So you want to force the player to actually pay for the items? Well you're in luck because we can do that too. By defining a "cost" block inside our choice block we can tell the game what type of currency we desire and how much of said currency we want.
For simplicity's sake, the Rocketlauncher now costs 1 Shotgun.
"displaycost" as the comment mentions, just adds additional text in the conversation telling you how much that specific item costs.
"nomessage" is the message printed if the player selects the option but does not have the required money/items to buy it.
Sadly this means the poor Shotgun guy will have to perish if we want our shiny rocketlauncher, oh well.Include/Exclude Choices
These extra blocks reside inside the choice blocks. They work just like costs, by specifying an item and the amount of said item the player needs. Here's how each of them works:
-"require": If the player meets said requirements, we will display a new choice for them!
-"exclude": If the player meets said requirements, we will remove this choice for them!
Let's start by going to our bragging bonebag and switching the current choice into two new ones that specify a "require" and an "exclude" block respectively.
Only one of the choices we defined is displayed, specifically the one conditiong if the player isn't carrying a shotgun. Let's pick up a shotgun and see what happens.
Now we have a new choice! This feature certainly opens up many possibility scenarios for a mod. [Updated: 2019-04-06]
Two whole years since the last update, time sure flies fast. Not much new this time around but we will look into something that wasn't brought up before:
-Drop ItemNext Page
I for some reason forgot to include one of the most basic things when handling dialogues and conversations, the ability to advance a conversation to a new page.
Luckily this isn't too complicated, but you need to keep count on the amount of pages you have, and their order in code.
As you can see, we've now redefined our Shotgunguy to have a new page, where we ask for a red keycard.
There isn't really any index or ID definitions for the pages so it's something you need to keep tabs of yourself, where the most available solution being making a comment with the page number.
This also ties us into the next feature on the list ...Drop Item
Instead of defining new actors, messing with thing specials, or writing messy ACS scripts to drop items, you have a solution right at your fingertips if you're implementing conversations.
We can start by modifying our Shotgunguy again.
Our shotgunner now has a red keycard tied to his conversation page, and shooting the poor sod sure enough makes him drop one.
Easy access to making a specific character dropping an item. However this feature has it's limits, a keen eyed reader would notice that the shotgun doesn't drop now, and it is true since specifying a drop item overrides whatever drop definitions the actor has. Even more unfortunate is that you cannot specify multiple drops and thus only the last drop is recognized, in these cases you are forced back to thing specials or ACS solutions.
As you may also have noticed is that the drop is tied to a page, this means we can tie different drops to different pages.
To get the keycard we would now have to advance the conversation to the next page if we want the keycard to drop. The result is that if we shoot the shotgunner before the next page, he will drop a shotgun, otherwise if we have talked to him and advanced to the next page, he will drop a keycard! [Updated: 2019-12-06]
Eight months later and the xmas gift this year is another batch of dialogue goodies! This time we will look into the following:
-Shared dialogue files between mapsPanels
Panels are images that you can display in the center of the conversation, these are just simple image files stuffed into the WAD or PK3.
For starters, if you don't happen to have any on hand, you can download these two images of one of the panels from Strife
One grumpier than the other, though there is a reason for it that we will soon discover.
Panels are defined on the page block, which means you can change panels on the go.
Unfortunately there isn't any support for animated graphics, so only static images for now.
The following image is how it should look like in SLADE once you import the images. Note the offsets marked in red at the bottom, since the engine doesn't auto align your image to the center this is something you will have to manage yourself.
And now we can attach these images to our Shotgunguy.
We should see the following in-game when speaking to the Shotgunguy:
Now you can put a face on your character while also socially interacting with them!Pagenames
Are you tired of keeping track of the amount of pages you have and their supposed IDs? Well fret no longer as you can now refer to them by name.
Let's create a fireboy to demonstrate this on. But first we have to use the new "GZDoom" namespace, so either delete or comment out the old "ZDoom" one.
Throw together a simple line of dialogue for the Archvile, linking the pages to each other using the pagename and nextpage properties.
Since we also linked it back to page one we have now created a loop. Now you can create a myriad of complex conversations without needing to do the math!Conversation States
There are a few states reserved purely for moments in a conversation, these are Yes, No, and Greetings, though they are mostly tailored to a shopkeeper role.
For reference, you can check out Strife's Merchant actor on the wiki: https://zdoom.org/wiki/Classes:Merchant
For now we will be using DECORATE and the Zombieman as a base and add these states onto him. But in this context we've renamed him to ConversationMan
Let's set up the states like the following image.
So what have we done here?
In the Greetings state we have just set the "Zombieman" to aim his weapon and face the player.
In the Yes state he will run through his pain frames 3 times.
In the No state he will briefly go into pain before sending him to his XDeath state.
We also have to add some dialogue to him, note that we've swapped out the actor name to our custom actor.
And now we can add him into our map! (Don't forget the Friendly and Stand Still flags)
Here's how the eager fellow should look like in-game.
He aims at us, he endures pain and he gibs when presented with negative feedback in true artist spirit.
These states allows extra depth to your character when interacting with the player.
The one setback is that you cannot call or enter these states as you please; the Greetings state will always be entered when engaging the conversation, the Yes state will only be entered when a yesmessage property is present, and likewise the No state will only be entered with a nomessage property present AND the player not meeting a cost criteria.Shared Dialogue between Maps
In true programmer fashion you can recycle and re-use Dialogue files, most use cases for this is when you have generic conversations for a set of actors, like our Shotgunguy actor.
Consider the following dialogue file for Map02, note how it is completely empty save for a namespace and the inclusion of DIALOG01.
Let's save that and produce our next map, doesn't have to be anything spectacular but remember to put in the actors we used before along with the same flags.
As a bonus you will be taught how to save maps into the same WAD file as the first map. Assuming you created this as Map02, open the File tab and hit Save Map Into and select the WAD file we're working with.
We should now have two maps if we re-open the WAD.
We can also set Map Teleporters on the doors, that way we can move back and forth between the two maps.
And here is our second map, let's talk to the Shotgunguy and see what's up.
Just as displeased as he was in the first map. By sharing dialogue files you save yourself time and effort by keeping everything nice and tidy in one place, if it is used more than once that is. [Updated: 2020-04-18]
Almost four years since this thread saw light and there is still stuff to explain and add onto it. Hope people have found good use of this tutorial!
For this update we will look into two things that has been brought up in this thread, as follows:
-DIALOGUE in Map LumpVoices
Using the Voice property we can assign soundfiles to play on certain pages in our conversations.
The sound is even emitted locally by the actor, and can be heard by nearby players! If multiplayer support is of interest to you.
The setup for the soundfiles differs depending on the archive format you're using.
For WADs, put the soundfiles below a V_START and above a V_END.
For PK3s, create a folder, name it Voices and put your soundfiles in there.
These sounds will be automatically detected and registered by the game, so no need for you to define them in the SNDINFO.
The game will instead know them as svox/*
. In the case of my PICKCAN sound, the game will know it as svox/PICKCAN.
But when defining the Voice property in a conversation page, you can omit the svox/
Our shotgunner will now tell us to pick up that can.DIALOGUE in Map Lump
An alternative way of defining the DIALOGxx textfile is to create it inbetween MAP Markers. While there is no "best practice" of whether to use DIALOGxx or DIALOGUE, using DIALOGUE lets you create conversations for maps that doesn't follow the usual MAPxx naming formula.
In the screenshot below, we can see a DIALOGUE file sitting below the MAP02 Map Marker, and above its ENDMAP Marker.
We can also see a new conversation defined for the Shotgunguy actor, and the DIALOG01 file being included at the same time!
Firstly, the conversations from the DIALOG01 file will be included, this includes the conversations for Revenants, Zombieman, and of course the Shotgunguy.
Though by defining a new conversation for the Shotgunguy actor, we will effectively replace the previous Bored Shotgunner dialogue, while importing the other actors dialogue into our MAP02 at the same time.
This map's shotgunner will now be grumpy instead of bored.
That is all for now. Thank you for reading this tutorial! Let's wrap it up with some imaginary Q&A that I anticipate might get asked.-Q&A-Q: What does include = "SCRIPT00" mean?
A: This part is not necessary if you're making dialogue for any game other than Strife. This just makes sure the random dialogue you can have with Acolytes, Peasants and Templars in Strife gets included in your map if you want to have it.Q: What about that "bye" response? Can we change that?
No. As far as I know it has not been touched to avoid breaking compatibility with regular Strife. A draft that I listed under references at the bottom of this post specifies "byechoice", though it does not seem functional it might have a chance of being implemented in the future. Let's hope.
A: Yes! You can finally define your bye responses! Check above in the Additional Content section.Q: Can I make the player get crushed if he picks the wrong choice?
A: Yes! As mentioned earlier, using the "special" field your sadistic outcome for the poor player is fully doable.
Let's do an example:
text = "Don't crush me";
special = 42; // This would be Ceiling Crusher Start
arg0 = 1; // First argument of the function, the Sector Tag
arg1 = 16; // Second argument is Movement Speed, we want it nice and slow
arg2 = 4; // Third argument is Crush Damage, a slow crush to death
After picking this option the player will set off a crusher in the sector tagged 1, which hopefully isn't the same sector he's standing in.Q: Is it possible to randomize the text for the "choice" options the players get?
A: No. The game will not do string lookups for choice text.-References-
Here are some links explaining more stuff about the Conversation System that you can look at for reference.
Last edited by Zergeant on Sat Apr 18, 2020 11:19 am, edited 4 times in total.