RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Dialog NPC

paole

Wanderer
Arya said:
paole, what you're asking is explained in the readme file. Please review that for information on using custom functions.

well, i'm a poor coder and i got no idea how to create a function, that starts the dialog if a player steps in range. :(
 

Trying

Sorceror
Ignius said:
ok ive been messing with xml spawner2 for about a hour now and i dont know just what i have to do to make it spawn the dialognpc and load the dialog i want to use

Im no expert at this, but I will try help ya... ;)

This is what i did to get it installed and running...
I extracted all the files from "DialogNPC" Folder into the "Scripts folder"... these are the 10 files including the "sample folder".. (its abit messy.. but it works), so what you have is .. dialog.cs... outfit.cs.. etc all them files extracted normally at the bottom of the main folders in scripts....

In the same "Scripts" folder i created a new folder called "Dialog"...
in there I extracted the "DialogEditor" folder (so i know were it is for modding the templates)... also this is where I place my .xml templates... (which at the moment you most likely won`t have yet)

Last step is to Edit the "DialogNPC.cs" file to change the path of where the .xml are stored.. in this/my case they are stored in the "Dialog" folder we created above...
The line that you are looking for at the top in "DialogNPC.cs" is:

private static string m_XmlFolder = @"TheBox\Dialog";

Which in this case you will need to change to say:

private static string m_XmlFolder = @"Scripts\Dialog";

Once you have changed it.. save it... and reboot your server if you have it started...

then use the normal command of [add dialognpc to make your "npc" appear.. hopefully he should appear and be walking around...

If he is great!... then all you need to do is make an npc in your dialogeditor, and place the .xml file when he/she is created in your "Dialog" folder...
Go back into game.. kill the exsisting "dude" and [add dialognpc again, and
upon double left clicking your "dude" in game your gump will appear with whatever the new npc is called, just "install" that into your "dude" and he`ll become whatever you have made... ;)

I hope thats easy enough to follow.. *Cringe* I have tried to put it as easy as I can honestly...

Lastly Ayra, can you post a reply to my question pwease... I am really stuck on that bit.. thanx... :D
 

Arya

Wanderer
I believe you can set properties when spawning with the XmlSpawner. I personally didn't try this, but I'm told that's possible. Simply set the DialogName property to whatever dialog you wish to use on spawn and it should work.

Trying: I think you can set all of that using the dialog editor. Under properties, add a custom property for Player and set to true. Under outfit, ad the LB robe. If this doesn't work (perhaps the properties are set AFTER the outfit, can't recall now), you might need to add a custom initialization function to your NPC that fixes all of this. Also if the NPC is invulnerable it shouldn't decay, so no need for respawning.
 

Trying

Sorceror
Thank You! :D

Extra: After some poking around and testing I have managed to get LB`s robe on the dude..! I have also tried this is gm robes, and admin robes, blackthorns suit as well, they all work.. the reason why im adding this extra bit is to just let others know (newbies like me) that if they put the "suit/robe" in the "Item List" section, under the Outfit tab, it will spawn the dude with the suit/robe already on..
Example: LordBritishSuit is added simply by typing that into the "Items list" and clicking Add... Yes guys i know this is common sense, but I know there are others out there that may be struggling with this... :p


Also would it be at all possible for someone to perhaps post a "Demo" template for dropping items on a npc in return for say an item given back.. I know there is demo`s that come with this, but a folder with a .xtml and a .cs would be great, at least then i can look around it, perhaps others can as well, and get an idea of how to setup an npc to do certain things.. (maybe some // this is where you add the items that need to be dropped on npc for him to give you "blah" item in return) type of comments.. that would really help... ;) im still new to C#, and as my login says im trying... but I do love this script.... :D

Btw Ayra, if you update this, or add to it, can I ask/suggest a "frozen" button for the dude, as I have LB sitting on his throne, after i spawn him, but after server re-boot hes back to wandering around again, ive tried looking in the .xtml to see if i could perhaps set him to spawn frozen, but no such luck.. thank you. ;)
 

Crackerjack

Wanderer
Wanted to post a bug. Whenever you use custom outfits for your NPC's, such as the Lord British suit or a GM Robe, and a player opens up the paperdoll and clicks on the character, the outfit will disappear. The only way to get it back is to reload the XML configuration.
 

Kamron

Knight
Code:
Exception:
System.ArgumentOutOfRangeException: Index was out of range.  Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Collections.ArrayList.get_Item(Int32 index)
   at Arya.DialogEditor.ConversationGump.OnResponse(NetState sender, RelayInfo info)
   at Server.Network.PacketHandlers.DisplayGumpResponse(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)

Umm... yep :\ I have no clue how it was caused
 

Arya

Wanderer
That looks like the error caused by Razor, in fact there's no verification done on the gump response. Will be fixed very shortly. Thanks!
 

Froman2686

Wanderer
Just to throw in my two cents...

I'm in the early stages of development for my shard, which I plan on being highly story-driven (and subsequently, quest-driven). This system has simplified my plans to terms I cannot describe. I am so happy to have found this, and I thank you very much for creating and distributing it.

I get to make my Ultima 7 style convos now!

"Hello, sir."
*Name *Job *Bye
 

Froman2686

Wanderer
Persistant Questions.
When you choose one of the dialog options, it moves down that node without maintaining any other available questions, forcing you to restart the conversation in order to gain any other pertinent information.
Example, just so we're clear:
Current System:
*Name *Job *Bye
choose name, get response (I am Patterson, Mayor of Britain)
*Mayor *Britain

What I want:
*Name *Job *Bye
choose name, get response (same as above)
*Job *Bye *Mayor *Britain

See what I mean? Is there any way to make this happen?
 

Krystofer

Sorceror
Yeah, someone suggested today that I try to fully remake Ultima 7 in the UO world, for a handful of people to play through. Sounded like fun. So off I went, starting to document the game... goodness there's a lot of conversations to rebuild... and lots of optional dialogues to build that I may or may not discover.. wee fun. This however, has made the process SO much easier. Rock on, forever and always.
 

DevXLX

Sorceror
XxSP1DERxX said:
Code:
Exception:
System.ArgumentOutOfRangeException: Index was out of range.  Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Collections.ArrayList.get_Item(Int32 index)
   at Arya.DialogEditor.ConversationGump.OnResponse(NetState sender, RelayInfo info)
   at Server.Network.PacketHandlers.DisplayGumpResponse(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)

Umm... yep :\ I have no clue how it was caused


Was this bug fixed yet?
just making sure before enabling it again. :)
 

ssalter

Account Terminated
Marvelous potential, another wonderful script, Arya.

I've been playing with it some and have a few questions.

1) It seems everytime I use speech, I have to have a choice. Is that the case? I would like to do this:

npc is triggered and :

"Hi, would you retrieve an item for me?"
yes
"Thank you so much"
<end conversation option>
no
"You are dirt evil."
< end conversation option>

Unless I am missing something, I have to add another choice after responding to either "yes" or "no" and cannot just offer the <end conversation> button.

2) When the npc responds to an item, is it the ItemID that is the value we need to input?

3) The distro I got, 1.2, doesn't contain xml samples or a readme. Are those forthcoming? The dialognpc is pretty simple to set up anyway but I thought I'd inquire.

Thanks.
 

Arya

Wanderer
ssalter,

Right now you can achieve that by either adding just one speech choice after the 'Thank you so much'/'You are dirt evil' lines (make it just 'Leave' or whatever fits), or you can custom script the NPC to actually say in game the line. If the NPC displays text on a gump, you need the player to take some action to close it. It might as well be a single choice.

When the NPC responds to an item, it's the item type being scanned, not the item id.

I'm very busy with developing a shard at this time, so I'm not sure if I'll have much time to produce more examples. If I manage to find the old one I'll try to include them in the next update.
 

ocalit

Wanderer
Function call

I cant quite get the type and function part down. My script that I'm trying to call from compiles with no errors. What I'm trying to accomplish is ..

1>Player talks to npc
2>Npc asks player to bring back quantity of one item
3>Npc checks for item if player returns.
4>Player responds to positive answer to give items to npc.
************ Here is where my script is suppose to intervene *****
5>Npc removes items from players backpack and give a bankcheck in return
6>My script is to set a custom flag on player for the item given to the npc
7>If player returns to npc a check is done for the item flag. If set true then
the npc returns a response from sayto that the items arent needed anymore.

Here is my script .. I'm assuming it is written properly since it compiles, but I believe my problem is not refrencing it properly in the dialog editor for type and function.

Code:
using System;
using System.Collections;
using Server.Items;
using Server.Mobiles;

using Server;

namespace Arya.DialogEditor
{	
	public class BlueScaleGiven
	{
		public static void GiveRewardTo( Mobile m, DialogNPC npc )
		{			
			if ( m.BlueScale != false )
			{
				npc.SayTo( m, "Thank you my friend... take this check as a sign of my appreciation..." );
				m_Received.Add( m );
				m.BlueScale = true;
				Item p = m.Backpack.FindItemByType( typeof(BlueScales) );
				if ( p != null )
				{
					p.Delete();
					m.BackPack.DropItem( new BankCheck( 2000 ) );
				}				
			}
			else if ( m.BlueScale != true)
			{
				npc.SayTo(m, "You have helped me more than enough. Thank you again.");				
			}
			else
			{
				npc.SayTo( m, "I wish I could grant you with a reward, but I don't think you could carry its weight..." );
				m.BackPack.DropItem( new BlueScales( 10 ) );
				npc.SayTo( m, "I have placed ten blue scales back in your pack. Come back when you have enough room for your reward.");
			}
		}
	}
}
 
Top