Strife's Dialog System - UDMF Flavor

Handy guides on how to do things, written by users for users.

Moderator: GZDoom Developers

Forum rules
Please don't start threads here asking for help. This forum is not for requesting guides, only for posting them. If you need help, the Editing forum is for you.

Strife's Dialog System - UDMF Flavor

Postby Zergeant » Fri Jul 01, 2016 12:15 pm

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.



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



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.

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:



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




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:
-Next Page
-Drop Item


Next 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!


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.
Last edited by Zergeant on Fri Apr 05, 2019 7:29 pm, edited 2 times in total.
User avatar
Zergeant
 
Joined: 31 Aug 2010
Location: Sweden

Re: Strife's Dialog System - UDMF Flavor

Postby Jimmy » Fri Jul 01, 2016 12:39 pm

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
Jimmy
I picked a fine day to be lactose intolerant
 
 
 
Joined: 10 Apr 2006
Location: Perth, WA
Twitch ID: JimmySquared

Re: Strife's Dialog System - UDMF Flavor

Postby Zergeant » Fri Jul 01, 2016 12:45 pm

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.
User avatar
Zergeant
 
Joined: 31 Aug 2010
Location: Sweden

Re: Strife's Dialog System - UDMF Flavor

Postby Gez » Fri Jul 01, 2016 1:05 pm

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.
Gez
 
 
 
Joined: 06 Jul 2007

Re: Strife's Dialog System - UDMF Flavor

Postby Zergeant » Fri Jul 01, 2016 1:47 pm

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.
User avatar
Zergeant
 
Joined: 31 Aug 2010
Location: Sweden

Re: Strife's Dialog System - UDMF Flavor

Postby pwnsevelt » Wed Aug 31, 2016 3:53 pm

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!
pwnsevelt
 
Joined: 17 Nov 2013

Re: Strife's Dialog System - UDMF Flavor

Postby Zergeant » Wed Sep 14, 2016 8:05 am

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.
User avatar
Zergeant
 
Joined: 31 Aug 2010
Location: Sweden

Re: Strife's Dialog System - UDMF Flavor

Postby ramon.dexter » Tue Nov 01, 2016 10:24 am

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.
User avatar
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia

Re: Strife's Dialog System - UDMF Flavor

Postby Hidden Hands » Sun Nov 13, 2016 11:44 am

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?
User avatar
Hidden Hands
Deadite
 
Joined: 20 Sep 2016
Location: London, England

Re: Strife's Dialog System - UDMF Flavor

Postby wildweasel » Sun Nov 13, 2016 11:52 am

Are you in UDMF format?
User avatar
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 15 Jul 2003

Re: Strife's Dialog System - UDMF Flavor

Postby Hidden Hands » Sun Nov 13, 2016 11:56 am

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.
Attachments
WHATSWRONGWITHTHIS.png
User avatar
Hidden Hands
Deadite
 
Joined: 20 Sep 2016
Location: London, England

Re: Strife's Dialog System - UDMF Flavor

Postby Zergeant » Tue Nov 15, 2016 12:20 pm

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.
User avatar
Zergeant
 
Joined: 31 Aug 2010
Location: Sweden

Re: Strife's Dialog System - UDMF Flavor

Postby SuperSomariDX » Tue Nov 15, 2016 1:24 pm

Thank you for this. This should prove very useful.
User avatar
SuperSomariDX
wonders what the hell is a Horror Monitor.
 
Joined: 01 Jul 2014
Location: Stuck in Illbleed once more.

Re: Strife's Dialog System - UDMF Flavor

Postby Hidden Hands » Tue Nov 15, 2016 1:43 pm

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?
User avatar
Hidden Hands
Deadite
 
Joined: 20 Sep 2016
Location: London, England

Re: Strife's Dialog System - UDMF Flavor

Postby Zergeant » Tue Nov 15, 2016 2:30 pm

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.
User avatar
Zergeant
 
Joined: 31 Aug 2010
Location: Sweden

Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests