Hello, been scratching my head over this for a bit now. This compiles fine, does not crash my shard, and works. EXCEPT in cases regarding a player.
For example, on my admin account if i say bounty it tells me how many kills i have essentially.
If i say pay, it tells me my kills * 2000, which is how much i have to pay to clean up my record.

Do the same on a test account, accesslevel player, no response from NPC. make player accesslevel seer, or anything remotely close to staff, it works. help?

Code:
using System;
using Server.Items;

namespace Server.Mobiles
{
    public class Crookedguard : BaseCreature
    {
        [Constructable]
        public Crookedguard()
            : base(AIType.AI_Animal, FightMode.None, 10, 1, 0.2, 0.4)
        {
            this.InitStats(31, 41, 51);

            this.SpeechHue = Utility.RandomDyedHue();

           /* this.SetSkill(SkillName.DetectHidden, 65, 88);
            this.SetSkill(SkillName., 65, 88);
            this.SetSkill(SkillName.Stealing, 65, 88);*/

            this.Hue = Utility.RandomSkinHue();

            if (this.Female = Utility.RandomBool())
            {
                this.Body = 0x191;
                this.Name = NameList.RandomName("female");
                this.Title = "the crooked guard";
            }
            else
            {
                this.Body = 0x190;
                this.Name = NameList.RandomName("male");
                this.Title = "the crooked guard";
            }

            this.AddItem(new Bandana(Utility.RandomDyedHue()));
            this.AddItem(new Longsword());
            this.AddItem(new RingmailArms());
            this.AddItem(new RingmailChest());
            this.AddItem(new RingmailGloves());
            this.AddItem(new RingmailLegs());

            Utility.AssignRandomHair(this);

            Container pack = new Backpack();

            pack.DropItem(new Gold(10, 783));

            pack.Movable = false;

            this.AddItem(pack);
        }
          
        public Crookedguard(Serial serial)
            : base(serial)
        {
        }

       
public override void OnSpeech( SpeechEventArgs args )
           {
           PlayerMobile mobile = args.Mobile as PlayerMobile;
           //Mobile mobile = args.Mobile as PlayerMobile;

            if ( args.Speech.ToLower().IndexOf("bounty") >= 0)
            {
                this.Direction =  GetDirectionTo( args.Mobile.Location );
               this.Say("You currently have a bounty for {0} murders...", mobile.Kills); //   
            }
            else if ( args.Speech.ToLower().IndexOf( "pay" ) >= 0)
            {
                this.Direction =  GetDirectionTo( args.Mobile.Location );
                this.Say("For {0} gold, I will wipe your slate clean...", mobile.Kills * 2000);
            }           
           
            }
       
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }
}
 
Make look at how the banker, animal trainer handle speech? I am not at home right now so can not pull up my scripts to look at it.
 
Banker and animal trainer function off of keywords. i may just have to write a new command to do this, unless someone can tell me why it is functioning as it is.
 
Looks fine to me, no reason why that script would work only for access level greater than player. You would have to debug why this method is not getting called (assuming it isn't).

The mobile OnSpeech method is called from Mobile.cs

One thing I just noticed is you are not overriding "HandlesOnSpeech" to be true, but that doesn't explain the accesslevel difference. It does mean that "OnSpeech" would never get called though.
 
Last edited:
Back