Page 1 of 6

Strife's Dialog System - UDMF Flavor

PostPosted: Fri Jul 01, 2016 12:15 pm
by Zergeant
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:
  • SLADE
  • 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.

Image

Since we're using Doom don't forget to tick the Stand still and Friendly flags.

Image

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.

Image

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!

ImageImageImage


-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.

Image

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.

Image

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.

Unique conversations

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:

Image

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.

Image

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.

Image

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:
-Bye Choices
-Costs
-Include/Exclude Choices


Bye 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.

Image
Image

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.

Image
Image
Image

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.

Image

"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.

Image
Image

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.

Image
Image

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.

Image

Now we have a new choice! This feature certainly opens up many possibility scenarios for a mod.


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?
A: 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:
choice
{
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.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Fri Jul 01, 2016 12:39 pm
by Jimmy
Awesome work with this! I need to harness this thing myself at some point, honestly have been amazed at the idea of having this system so available and customisable for a long time. Thanks so much! :D

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Fri Jul 01, 2016 12:45 pm
by Zergeant
No problem. Was pretty hard for me to pick up because there was no tutorial readily available. I decided to put one together though since it was a pretty hefty research to figure it all out on your own.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Fri Jul 01, 2016 1:05 pm
by Gez
Zergeant wrote: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.

Alternatively, and more generally, since you're using UDMF, you can put a DIALOGUE lump inside the map lumps (before ENDMAP). That way it'll work even if your map is not named MAPxy.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Fri Jul 01, 2016 1:47 pm
by Zergeant
Gez wrote:
Zergeant wrote: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.

Alternatively, and more generally, since you're using UDMF, you can put a DIALOGUE lump inside the map lumps (before ENDMAP). That way it'll work even if your map is not named MAPxy.

Ah so that's how you use it. Is there any difference to doing that? Since using DIALOGxx lets you put it anywhere you want and you can see to which map it belongs just by reading the name.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Wed Aug 31, 2016 3:53 pm
by pwnsevelt
Thank you for the tutorial! I'm excited to get this working.

Should the conversation start when I get close enough to the monsters? Do I need to hit my Use key? I'm not sure how to initiate the conversation.

Am I doing something wrong obviously? I've loaded the tutorial map into GZDoomBuilder and then tried taking it for a test drive.

Do I need to load something from Strife to make this work? Right now I'm only using the Doom2.wad resources.

Thank you again!

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Wed Sep 14, 2016 8:05 am
by Zergeant
No problems mate.

The tutorial map doesn't have any dialog data inside it, the point is that you work alongside the tutorial to learn how the system works. Download Slade, follow the tutorial and you'll have working conversations in minutes.

Yes, you press the Use key to start conversation with the monsters. No you don't need to load anything from Strife.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Tue Nov 01, 2016 10:24 am
by ramon.dexter
Also, to note, gzDoombuilder has fully working dialogue editor, under script editor. Just open gzdb, open script editor and next to "SCRIPTS" tab is tab called "DIALOGUE", that's where USDF code belongs to. But keep in mind that USDF code is little bit non-friendly to use. What I mean, when there is a mistake in the code, the code following the mistake line is not working, even if written correctly. So if you make a mistake, you have to correct it, otherwise the rest of the code will not work.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Sun Nov 13, 2016 11:44 am
by Hidden Hands
Zergeant wrote:
Image

Since we're using Doom don't forget to tick the Stand still and Friendly flags.



I don't get this ... how are you finding friendly and stand still flags? My Doom Builder doesn't show anything like this, only the standard stuff like difficulty, deaf and multiplayer. Also you have all those other details I don't have on your monster placement... how can I get this to work if I don't have those features? Why don't I have them?

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Sun Nov 13, 2016 11:52 am
by wildweasel
Are you in UDMF format?

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Sun Nov 13, 2016 11:56 am
by Hidden Hands
I don't think I am... how do I choose that? Sorry, I've never worked outside of DOOM format before. How do I change it? Okay never mind, I changed it. But I have another problem. My NPC still isn't working. He still wont speak. What am I doing wrong? I followed the code exactly. Is it something to do with SCRIPT00?

I've added a screenshot of my NPC code. What have I done wrong? Please help.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Tue Nov 15, 2016 12:20 pm
by Zergeant
Have you addressed the actor's classname correctly? Is the lump file named correctly, e.g. "DIALOG01"? Keep in mind that the last numbers refer to the map number, so if the file is named DIALOG01 it will link to a map named MAP01.

As mentioned, including SCRIPT00 is not necessary for it to function, it just includes standard dialogue for Strife actors.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Tue Nov 15, 2016 1:24 pm
by SuperSomariDX
Thank you for this. This should prove very useful.

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Tue Nov 15, 2016 1:43 pm
by Hidden Hands
Zergeant wrote:Have you addressed the actor's classname correctly? Is the lump file named correctly, e.g. "DIALOG01"? Keep in mind that the last numbers refer to the map number, so if the file is named DIALOG01 it will link to a map named MAP01.

As mentioned, including SCRIPT00 is not necessary for it to function, it just includes standard dialogue for Strife actors.


I managed to fix it, I was foolish I missed out a "=" in the code and it messed the whole thing up. It works perfectly now. Thank you so much. But just so I understand correctly, if I want a talking shopkeeper say on MAP02, I would need to make a whole new entry called DIALOG02 in my wad? They cannot be lumped into one DIALOG file, is that correct?

Re: Strife's Dialog System - UDMF Flavor

PostPosted: Tue Nov 15, 2016 2:30 pm
by Zergeant
I don't think it's possible to lump all dialogue files into one, giant dialogue lump and refer to maps from inside it no. But as Gez mentioned you can create a file called DIALOGUE and put it between the Map Marker and ENDMAP marker. Looks structurally the same only difference is you dont need to put your map number at the end of the file.