Difference between revisions of "Project Phoenix 2 Dialogs"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
Line 3: Line 3:
 
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.
 
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===
+
==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
 
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?
 
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===
+
==Conversation Node Table==
 
Below is a small example table of a conversation
 
Below is a small example table of a conversation
  

Revision as of 15:45, 28 July 2019

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",		
			},
		},		
	},
}

Lastly a small explanation of the Dialog.Responses table and functions. You can see just one of 3 keyfunctions present with this system. This is GotoNode, you may also see its located in the Text variable inside the responses table. When clicked by the player, it tells the dialog system to navigate to the node listed after it. In the above example, the dialog will continue back in forth between the WhatElse node and the StartNode. Easy peasy. The other 2 funcctions help with opening up the merchant store system. Which is located on the merchant section.