Full Version : Npc Talking Question
xmlspawner >>Scripting Support >>Npc Talking Question


<< Prev | Next >>

Erica- 10-27-2007
Hi was curious if anyway to make the npc not talk while owner runs by them when hidden its a edited from BaseVendor heres the part thats edited.
CODE
public abstract class BaseVendor : BaseCreature, IVendor
   {
       //07SEP2006 Talking Vendors by RavonTUS@Yahoo.com *** START ***
       #region Make Vendors Talk
       private static bool m_Talked;
       string[] VendorSay = new string[]
 {
  "Greetings",
           "Hello there",
           "I have what ye needs.",
           "Look here!",
           "Shop ye here!"
 };

       public override void OnMovement(Mobile m, Point3D oldLocation)
       {
           if (m_Talked == false)
           {
               if (m.InRange(this, 3) && m is PlayerMobile)
               {
                   m_Talked = true;
                   SayRandom(VendorSay, this);
                   this.Move(GetDirectionTo(m.Location));
                   SpamTimer t = new SpamTimer();
                   t.Start();
               }
           }
       }

       private class SpamTimer : Timer
       {
           public SpamTimer()
               : base(TimeSpan.FromMinutes(1))
           {
               Priority = TimerPriority.OneMinute;
           }

           protected override void OnTick()
           {
               m_Talked = false;
           }
       }

       private static void SayRandom(string[] say, Mobile m)
       {
           m.Say(say[Utility.Random(say.Length)]);
       }
       #endregion
       //07SEP2006 Talking Vendors by RavonTUS@Yahoo.com *** END ***

       private const int MaxSell = 500;
I post this In RunUO Forum and post it here since i might get help here faster.

ArteGordon- 10-27-2007
why not just use an xmldialog for this? No scripting required.

Erica- 10-27-2007
QUOTE (ArteGordon @ October 27, 2007 06:45 pm)
why not just use an xmldialog for this? No scripting required.

Ok cant remember how to do that can you show me a link or tell me how i think youve to me this before just forgot Sorry.

ArteGordon- 10-28-2007
QUOTE (Erica @ October 27, 2007 09:02 pm)
QUOTE (ArteGordon @ October 27, 2007 06:45 pm)
why not just use an xmldialog for this?  No scripting required.

Ok cant remember how to do that can you show me a link or tell me how i think youve to me this before just forgot Sorry.

http://xmlspawner.15.forumer.com/index.php?showtopic=81&hl=