Strife's Dialog System - UDMF Flavor

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

Moderators: GZDoom Developers, Raze 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.
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Strife's Dialog System - UDMF Flavor

Post by ramon.dexter »

Zergeant wrote:
tetssian wrote:hello again and thanks again for the help Vostyok, but now i was wondering is it possible to play a sound when you dont have the neccesary item or you end a dilog, im making the RE4 merchant just for fun but well i cant seem to put a sound when the transaction ends or fail and second is it possible that even if you fail or end the transaction the dialog doesnt close and return to the fist dialog? cause i try to put the closedialog in false or true but it doesnt make anything it just close the dialog and dont call the page i ask for, even if closedialog doesnt show at all it just end the dialog instead of continue it. BTW thank youy zeargent for the advice in named dialogs
You can try putting A_PlaySound in the Yes and No states, which respectively corresponds to a successful or failed transaction, see the Conversation States on the first page for more information.
I haven't experimented much with merchant actors so far, but I don't think there is a way to keep the dialog open when attempting to buy items currently.
It is completely possible. I'n on tablet, so I cannot properly write code example. But if you want to buy, not close dialog and stay on the same page, you just simply put into nextpage the number/name of the shop page, and make Closedialog = false.
User avatar
Vostyok
Posts: 1666
Joined: Sat Jan 17, 2015 8:54 am
Preferred Pronouns: No Preference
Location: Discord: Vostyok#3164
Contact:

Re: Strife's Dialog System - UDMF Flavor

Post by Vostyok »

I did some testing, and the above is true. In some situations, nextpage will override Closedialog entirely. It seems that the order of the statements is important.
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Strife's Dialog System - UDMF Flavor

Post by ramon.dexter »

The order of statements is not important at all. All that matters is function 'Closedialog' set to 'false'. Setting the same to 'true' causes to close the conversation by a option with function set to true.
edit: In fact, the dialogue system don't care if you have any giveitem="" functions in the dialog choice. The main control is from the closedialog=true/false function.

I have set-up many shops in a way that when player buys a item, the conversation closes. This is good for buying weapons. And I have many shops that don't close when buying an item (good for buying bigger amounts of items like ammo or health, without the need to start the conversation to buy each one item).

For the order of functions - I have not tested it to be 100% sure, but as I'm making the conversations, some are copy pasted, yet some are manually written. The order of funtions varies and the conversation just works as I have set it up.

Here is nice exaple of fully working one-page shop:

Code: Select all

Conversation {
	ID = 3;
	Page {
        pageName = "SH_energyAmmoVendor_opener";
		Name = "Technician";
		Dialog = "\c[white]\c[white]Hello, how may I serve you?";
		Panel = "M_FALSP2";
		Goodbye = "\c[red]Goodbye";
		Choice {
			Text = "Buy Night Eye Device";
			NextPage = "SH_energyAmmoVendor_opener";
			CloseDialog = true;
			DisplayCost = true;
			YesMessage = "Here it is!";
			NoMessage = "Not enough gold!";
			GiveItem = "NightEyeDevice";
			Cost {
				item = "coin";
				amount = 50;
			}
		}
		Choice {
			Text = "Buy Blaster Turret";
			NextPage = "SH_energyAmmoVendor_opener";
			CloseDialog = true;
			DisplayCost = true;
			YesMessage = "Here it is!";
			NoMessage = "Not enough gold!";
			GiveItem = "blasterTurret_item";
			Cost {
				item = "coin";
				amount = 75;
			}
		}
		Choice {
			Text = "Buy Flight Harness";
			YesMessage = "Here you go!";
			NoMessage = "Not enough gold!";
			GiveItem = "jetpack_item";
			NextPage = "SH_energyAmmoVendor_opener";
			DisplayCost = true;
			Cost {
				Item = "coin";
				Amount = 80;
			}
		}
		Choice {
			Text = "Buy Personal Shield";
			YesMessage = "Here you go!";
			NoMessage = "Not enough gold!";
			GiveItem = "shieldModule";
			NextPage = "SH_energyAmmoVendor_opener";
			DisplayCost = true;
			Cost {
				Item = "coin";
				Amount = 150;
			}
		}
	}
}
tetssian
Posts: 40
Joined: Wed May 30, 2012 1:09 pm

Re: Strife's Dialog System - UDMF Flavor

Post by tetssian »

ok this could work, i will try it and see if i manage to get it work, i will ask again if i have trouble
User avatar
KaseyZombieRoo
Posts: 2
Joined: Tue Nov 24, 2020 3:29 am

Re: Strife's Dialog System - UDMF Flavor

Post by KaseyZombieRoo »

I seen that the topic of how to change colors came up earlier in this thread. I spent the past couple days trying to figure it out, cause my current dialogue-heavy wad has lots of red/orange walls that the default bright red text blends in with. So the default colors had to go.

Then I realized that simple [wiki]TEXTCOLO[/wiki] works for me, especially since then I can have certain speakers have different colors. I def felt dumb, since I used that before on simple HUDMessages and prints.

I figured I'd post this example for others who wanted to change the colors in their projects:

Code: Select all

Conversation {
	id = 2;
	Page {
		Name = "\c[Yellow]Student";
		Dialog = "\c[Tan]Dude, this spring break is totally a drag.";
		Goodbye = "\c[Brick]Whatever.";
	}
}
User avatar
Zergeant
Posts: 108
Joined: Tue Aug 31, 2010 7:19 am
Location: Sweden

Re: Strife's Dialog System - UDMF Flavor

Post by Zergeant »

KaseyZombieRoo wrote:I seen that the topic of how to change colors came up earlier in this thread. I spent the past couple days trying to figure it out, cause my current dialogue-heavy wad has lots of red/orange walls that the default bright red text blends in with. So the default colors had to go.

Then I realized that simple [wiki]TEXTCOLO[/wiki] works for me, especially since then I can have certain speakers have different colors. I def felt dumb, since I used that before on simple HUDMessages and prints.

I figured I'd post this example for others who wanted to change the colors in their projects:

Code: Select all

Conversation {
	id = 2;
	Page {
		Name = "\c[Yellow]Student";
		Dialog = "\c[Tan]Dude, this spring break is totally a drag.";
		Goodbye = "\c[Brick]Whatever.";
	}
}
This is a good finding, mind if I include it in OP next time I make an update?
User avatar
Vostyok
Posts: 1666
Joined: Sat Jan 17, 2015 8:54 am
Preferred Pronouns: No Preference
Location: Discord: Vostyok#3164
Contact:

Re: Strife's Dialog System - UDMF Flavor

Post by Vostyok »

I have noticed an issue. I wonder if anyone else has encountered this. Following the example in the OP, I have been using item checks to link to separate pages.

I have created a token for tracking quests completed. I want different responses to be displayed depending on how many quests the player has completed. I have used this code:

Code: Select all

link=57;
		ifitem
		{
		 item = "MoralityToken";
		 amount = 6;
		 }
However, it appears that the Amount identifier does not seem to be recognised = the check passes regardless of how many of the item you hold.

Might this be a minor typo in the OP?
User avatar
NicoTheGoat
Posts: 17
Joined: Sun Dec 29, 2019 6:36 pm
Contact:

Re: Strife's Dialog System - UDMF Flavor

Post by NicoTheGoat »

Vostyok wrote:However, it appears that the Amount identifier does not seem to be recognised = the check passes regardless of how many of the item you hold.
Might this be a minor typo in the OP?
IfItem is supposed to check the amount field, but the check is broken (checking for 'Count', not 'Amount'). I've submitted a PR that fixes this, so this (hopefully) won't be a problem for much longer.
User avatar
KaseyZombieRoo
Posts: 2
Joined: Tue Nov 24, 2020 3:29 am

Re: Strife's Dialog System - UDMF Flavor

Post by KaseyZombieRoo »

Zergeant wrote: This is a good finding, mind if I include it in OP next time I make an update?
Sorry for the delay, forgot I posted that till just now. I posted it for anyone who could use the info, so it's all good to go on the OP.
User avatar
Bjecinst
Posts: 90
Joined: Fri Apr 19, 2019 11:22 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: Intel (Modern GZDoom)
Location: Q3DM17, The Longest Yard
Contact:

Re: Strife's Dialog System - UDMF Flavor

Post by Bjecinst »

Terribly sorry to necro a thread such as this, albeit it is a very *very* helpful thread, i was just wondering something:
Is it possible to have a sound byte play upon exiting a conversation?

Currently i have a randomized sound that plays whenever you initiate a conversation, it's selected between 8 unique "greeting" sounds,
and i've recorded 8 unique "exit" sounds where you can hear the npc say their goodbyes, but i've no real way to actually use these sounds, now that i think about it.
Is there any sort of, well, hacky way (or non hacky, either/or works) to get what im going for here?

Thank you in advance! :biggrin:
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Strife's Dialog System - UDMF Flavor

Post by ramon.dexter »

bjecinst: Well, you can make a normal choice mimic a goodbye response.
Something like:

Code: Select all

Choice {
  Text = "Goodbye";
  Nextpage = <desired nextpage>
  Closedialog = true;
  <put soundfile here>
}
But you have to keep in mind that there will always be a second, hard-coded goodbye response, that will not play the sound. Maybe a better solution would be to make a normal choice, and just change the flow of conversation so that you don't put an audio into a 'goodbye" response.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Strife's Dialog System - UDMF Flavor

Post by Enjay »

This strikes me as something that would be useful to many people (I certainly could have used it a while back with something I was doing). Would it be worth making a feature suggestion for an optional "dialogue exit noise"?

As I understand it, the dialogues are menus and several menu events have SNDINFO defined sounds associated with them so perhaps this might be reasonably straight forward to add. Maybe?
User avatar
Xeotroid
Posts: 436
Joined: Sat Jun 23, 2012 7:44 am
Graphics Processor: nVidia with Vulkan support
Location: Czech Rep.

Re: Strife's Dialog System - UDMF Flavor

Post by Xeotroid »

ramon.dexter wrote:But you have to keep in mind that there will always be a second, hard-coded goodbye response, that will not play the sound
It's a bit nasty, but you can create your own ConversationMenu-derived class, override the FormatReplies() method, copy-paste the original implementation and just remove the lines that add the hardcoded goodbye reply. Now you can either specify the custom class in the dialogue file or specify it as default in MAPINFO. Obviously if something gets changed afterwards in the original implementation of the method in an update, you're not getting the updated features/fixes unless you go and copy-paste it again, and in general this is a horrible practice.
User avatar
Mush256
Posts: 10
Joined: Tue May 31, 2022 2:05 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Czech Republic

Re: Strife's Dialog System - UDMF Flavor

Post by Mush256 »

Hello, I just wanted to ask if it's possible for the dialog to activate a script that uses mapspots, so I can make a store where the item spawns in front of the player first.
User avatar
Vostyok
Posts: 1666
Joined: Sat Jan 17, 2015 8:54 am
Preferred Pronouns: No Preference
Location: Discord: Vostyok#3164
Contact:

Re: Strife's Dialog System - UDMF Flavor

Post by Vostyok »

Mush256 wrote:Hello, I just wanted to ask if it's possible for the dialog to activate a script that uses mapspots, so I can make a store where the item spawns in front of the player first.
Yes! I do this stuff all the time. Take a look, it's easy:

Here is what such a choice would look like in the DIALOG lump

Code: Select all

choice
		{
			text = "No, I wanted orange!";  //player's dialogue choice
			special = 80; // special code to activate execute ACS script.
                        arg0 = 30; // number of the script in the map's ACS.
			arg1 = 12; // the number of the map this script number will be active.
			nextpage = 30; 
		}
With the above, special = 80 automatically looks for an ACS script to activate, using the ARG0 as the script number it will look for. arg1 will determine on which map that script number will be looked for. Here, we are activating script 30, in map 12, and then progressing to page 30 of the dialogue tree.

Then, it would be simply a case of adding the following to your map ACS:

Code: Select all

script 30 (void) //vendor option orange
{
	if (Orange < 0)
	{
	SpawnSpotForced("LemonLime",44,32,0);
	}
	}
}
See the spawnspotforced entry on the zdoom wiki for more info on how to use this one if you haven't already. (You could also go straight to Thing_spawn in the dialogue tree, using Special = 135, arg0= tid of map spot, arg1 = spawn number of item, arg2= angle, arg3 = tid of spawned item) but imho this method is a lot more reliable and lets you do other things such as add extra special effects, checks and such.

Hope this helps.
Post Reply

Return to “Tutorials”