Making a dialogue tree with WML

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

Post Reply
User avatar
MathBrush
Posts: 192
Joined: February 12th, 2018, 10:21 pm

Making a dialogue tree with WML

Post by MathBrush »

I'm making a non-traditional campaign that is a creepypasta and involves quite a bit of dialog.

I'd like to make a dialogue tree, similar to choice-based games like Twine.

I can already get one choice to work (this is wrapped in one big 'event' tag):

Code: Select all

	[message]
                    speaker=David
                    message= _ "[Initial message]"
                    [option]
                        label= _ "Text of choice 1."
				[command]
						[message]
							speaker=David
							message= _ "Result of choice 1"
						[/message]
 				[/command]
		  [/option]
                    [option]
                        label= _ "Text of choice 2."
 				[command]
						[message]
							speaker=David
							message= _ "Result of Choice 2"
						[/message]
 				[/command]
                   [/option]
               [/message]
               [message]
                      speaker=David
                    message= _ "[Final message that doesn't actually get printed]"
             [/message]
 
Running this gives me some dialog, lets me click a choice, then runs more dialog after. I can get 'Result of Choice 2' to appear. But the 'option' seems to stop the sequence of messages, so my final message (after the option) doesn't get printed. I can fix that by just pasting the code twice, but ideally I'd like a convenient way to run the same code after each choice (using function-style notation would work just fine as well, if that exists in WML).

So, what would be the most code-efficient way to have messages or actions that run regardless of which choice you picked, once the effects of the choice are finished?
Drake Campaign: A Fiery Birth | Knalgan Alliance Campaign: Drunkards, Dwarves, and Doubloons | Dunefolk Campaign: Asheviere's Shadow | Northeners Campaign: Goblin's Glory | Undead Campaign: Shakespeare's Ghost | Rebels Campaign: Santa Must Die
white_haired_uncle
Posts: 1226
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: Making a dialogue tree with WML

Post by white_haired_uncle »

Are you saying that "[Final message that doesn't actually get printed]" doesn't get displayed after "Result of choice 1" or "Result of Choice 2"? Because it does for me.
Speak softly, and carry Doombringer.
User avatar
MathBrush
Posts: 192
Joined: February 12th, 2018, 10:21 pm

Re: Making a dialogue tree with WML

Post by MathBrush »

Huh, I guess you're right. I had to simplify my code to get something I could post on here, so I guess doing that fixed the bug. I feel dumb now but I wouldn't have gotten it to work without posting and seeing your comment, so thanks!
Drake Campaign: A Fiery Birth | Knalgan Alliance Campaign: Drunkards, Dwarves, and Doubloons | Dunefolk Campaign: Asheviere's Shadow | Northeners Campaign: Goblin's Glory | Undead Campaign: Shakespeare's Ghost | Rebels Campaign: Santa Must Die
Post Reply