Project Phoenix 2 Dialogs

From Legends of Aria Admin and Modding Wiki
Revision as of 05:29, 24 July 2019 by Gizmo (talk | contribs) (Conversation Node Table)
Jump to: navigation, search

Welcome

The dialog system consists of a group of tables, functions and variables. The dynamic window display is used in the merchant systems user interface that comes with Project Phoenix. The system is simply designed and easy to modify to suit your server needs. It uses your basic Node based design. It allows you to have required variables or skill level to access the Node or even the player responses. Allowing you to set up simple dialog to complex progressive dialogs. In this documentation I will explain the basics of how it is set up.

Dialog Table

The dialog table is a global variable that will contain each of your dialog trees. This Table is located in the mods/ProjectPhoenix2/scripts/dialog/dialog.lua. The table name is Dialog. Once you create a new dialog table and add it to the global Dialog table, it will be a simple as adding a string object variable to any merchant in my merchant system. Lets take a look at setting up a conversation node shall we?

Conversation Node Table

Below is a small example table of a conversation

Dialog.HelloWorld=
{
	StartNode =
	{
		NpcText="Hello World",
		Responses=
		{
			{
				Text="Hello Mr Npc, What else do you know?|GotoNode|WhatElse",		
			},
		},
	},
	WhatElse =
	{
		NpcText="Click continue for some fun.",
		Responses=
		{
			{
				Text="Sure lets see what is next|GotoNode|StartNode",		
			},
		},		
	},
}

Each merchant in the game can also be just a person with some conversation. On each merchant you will see a object variable named Data.Dialog. This is a string value which represents the node name to use. In the examples case it will be HelloWorld as our string value. When the player brings up the dialog window, they will always pull up StartNode on the first use of the dialog. Every dialog needs to have At least StartNode entry as it is the entry point for every dialog. To test your dialog just create a merchant_male or merchant_female, use your info command and change the Data.Dialog variable to the name of your Dialog.DialogName table... in the example again, we will be using HelloWorld.

You might ask how do I add a requirement to the response node. Its easy look at the example below of the table above, but with a requirement added. The below changes will make it so if the player interacting with this merchant has the Object Variable named TestObjVar with a value of test, if the player has this condition, then show the player response. This allows you to lock away further conversation unless a player meets a condition. You could create any form you wanted in the game to set the value on a player.

Dialog.HelloWorld=
{
	StartNode =
	{
		NpcText="Hello World",
		Responses=
		{
			{
                               Req={ObjVar="TestObjVar",Value="test"},
				Text="Hello Mr Npc, What else do you know?|GotoNode|WhatElse",		
			},
		},
	},
	WhatElse =
	{
		NpcText="Click continue for some fun.",
		Responses=
		{
			{
				Text="Sure lets see what is next|GotoNode|StartNode",		
			},
		},		
	},
}