| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| There was a time when I sought to leave this world and for a while I did,
fleeing the poisonous rune it made of my life...
...but the power of this world has pulled me back in. The evil, the poison with-in shall not
be quickly cured. |
|
|
|
|
|
|
Thursday, May 18, 2006 |
|
|
|
|
Dialog NPC by Arya
Summary: This NPC can be used to create dialogs such as those in classical single player RPGs. The creation of the dialogs is done through an external program which produces a datafile that if positioned correctly within the RunUO folder allows the NPC to reconfigure itself on the fly, without rebooting the server.
The dialog script supports also invokation of custom code whenever a player chooses an option on the dialog gump.
Description: This NPC is an evolution of the Conversational NPC I posted some time ago. It's more complex in its functionality though and much more powerful.
The NPC simulates dialogs with players with multiple choice answers (such as those seen in classical Ultima games). The dialog itself is created through an external program called DialogEditor, provided in the download package. The whole conversation is carried through a gump displaying the NPC speech, and a number of choices the player can make in response (limited to 8).
The NPC can be configured on the fly, so it doesn't need a server reboot to apply a new dialog. The XML files containing the dialog configuration must be placed in a well known folder within the RunUO main directory (by default RunUO\TheBox\Dialog), and once they're in a staff member only needs to double click the NPC to access the dialog selection gump (which will display only the name of the XML file, not the full path).
The dialog structure can be as complex as it gets, and I tried to do my best to make creation and editing user friendly. I have written a comprehensive readme file for the DialogEditor program (in the download package) which explains everything you need to know to produce dialogs.
Probably the most powerful feature of this NPC is the ability to interact with your code without actually recoding the NPC itself. Whenever a player chooses a response to whatever the NPC said, the dialog can be configured to dynamically call a function in an external script (provided the function has a specified signature, refer to the DialogEditor readme file for details).
I have provided two very simple samples of what this script can do:
- Thief: whenever a player with over 5000 gold in their backpack approaches this NPC, a dialog will start, leading inevitably to either the player donating the thief some money, or the thief stealing if the player refuses.
- Travel: this is a NPC that will teleport the player to either Britain or Trinsic for a price of 500 gc. If you drop 500 gc on the NPC it will ask you where you wish to go, if you double click it, it will first explain its function and then ask you if you agree to pay (if you say yes, but don't have the money in your bank the NPC will kill you when you try to travel).
Refer to the installation section for information on how to install or remove the samples.
As usual any feedback is appreciated, not working on a shard makes it quite hard to decently test things so please report any issues you might find and I'll try to address them asap.
Installation: The package you download will contain 3 folders:
- DialogEditor : this is the program used to create the dialogs. As all my programs, this requires the .NET framework 1.1 to run. This folder also contains DialogEditor.html, the readme file with instructions for the program. - Samples : these are the XML files for the two situation described above. By default put them into ..\RunUO\TheBox\Dialog and they will be accessible by the NPC when the server starts. - Script : this folder holds all the files needed for the NPC to operate on the server and should be placed within your Scripts folder. If you don't wish to use the samples provided, delete the DialogNPC\Samples folder as they only contain support classes for the Thief and Travel dialogs.
If you wish to change the target folder for the XML files, you can do so by editing DialogNPC.cs. The option is right at the beginning of the file (remember, all folders are realtive to the core RunUO folder).
When you start the server use:
[add DialogNPC
to create the NPC. Double click it to access the list of available dialogs. Refresh the gump, if you add or remove XML files from the dialog folder to see the changes.
Updates
June 19 (1.1): - Fixed bug where the player wasn't removed from the current user list and therefore couldn't initiate a new dialog. - Changed the way the item-in-backpack trigger is handled by the NPC. Now the check is done just once, when the player enters the NPC's range, so the player will no longer receive the gump multiple times when moving around the NPC.
May 18, 2006: This zip contain some of the quests from An Nox. Enjoy.
Download http://geocities.com/ravontus/DialogNPC/dialognpc.zip
Posted by Ravon @ 8:23 AM
|
|
|
|
|
|
|
|
|
|
|
|
|