BaseCreature Vendor

Mikthebug

Citizen
So since the cendors are just standing around and being boring, i wanted to just make npcs as shop keepers insted to get a more "alive" feel to the citys.

But i get a few errors and i'm not sure why.

This is the first script im trying this with.

GatonHill:
using System;
using Server;
using Server.Items;
using Server.Misc;
using Server.Network;
using Server.Mobiles;
using Server.ContextMenus;
using System.Collections.Generic;

namespace Server.Mobiles
{
    public class GaltonHill : BaseCreature
    {

        [Constructable]
        public GaltonHill() : base(AIType.AI_Melee, FightMode.Evil, 10, 1, 0.8, 3.0)
        {
            {
                this.Body = 0x190;
                Hue = Utility.RandomSkinHue();
                this.Name = "Galton Hill";
                SpeechHue = Utility.RandomDyedHue();

            int hairHue = Utility.RandomNondyedHue();


            Utility.AssignRandomHair( this, hairHue );

            if( Utility.Random( 7 ) != 0 )
                Utility.AssignRandomFacialHair( this, hairHue );
            }
            {
                SetStr( 150 );
                SetDex( 150 );
                SetInt( 100 );

                SetHits( 500 );
                SetMana( 200 );

                SetDamage( 15, 25 );

                SetResistance( ResistanceType.Physical, 70 );
                SetResistance( ResistanceType.Fire, 55 );
                SetResistance( ResistanceType.Cold, 55 );
                SetResistance( ResistanceType.Poison, 55 );
                SetResistance( ResistanceType.Energy, 55 );

                SetSkill( SkillName.MagicResist, 110.0 );
                SetSkill( SkillName.Parry, 110.0 );
                SetSkill( SkillName.Tactics, 110.0 );
                SetSkill( SkillName.Fencing, 110.0 );
                SetSkill( SkillName.Healing, 110.0 );
                
                
                SetSpecialAbility(SpecialAbility.Heal);
            }
            {

                Container pack = new Backpack();
                pack.DropItem(new Gold(0, 50));
                pack.Movable = false;
                AddItem(pack);
            }
            {
                PlateGorget pg = new PlateGorget();
                pg.Resource = CraftResource.Bronze;
                pg.Movable = false;
                AddItem(pg);
            }
            {
                PlateChest pc = new PlateChest();
                pc.Resource = CraftResource.Bronze;
                pc.Movable = false;
                AddItem(pc);
            }
            {
                PlateArms pa = new PlateArms();
                pa.Resource = CraftResource.Bronze;
                pa.Movable = false;
                AddItem(pa);
            }
            {
                PlateGloves pgs = new PlateGloves();
                pgs.Resource = CraftResource.Bronze;
                pgs.Movable = false;
                AddItem(pgs);
            }
            {
                PlateLegs pl = new PlateLegs();
                pl.Resource = CraftResource.Bronze;
                pl.Movable = false;
                AddItem(pl);
            }
            {
                Kryss kss = new Kryss();
                kss.Movable = false;
                AddItem(kss);
            }
            {
                MetalShield mss = new MetalShield();
                mss.Resource = CraftResource.Bronze;
                mss.Movable = false;
                AddItem(mss);
            }

        }

        public override void AddNameProperties(ObjectPropertyList list)
        {
            base.AddNameProperties(list);

            List<string> lines = new List<string>();

            lines.Add(String.Format("Captain of the Guard", 1));

            list.Add(String.Join("<br>", lines));
        }
        
        public GaltonHill(Serial serial)
            : base(serial)
        {
        }
        
        public override bool IsActiveVendor
        {
            get
            {
                return true;
            }
        }
        
        public override void InitSBInfo()
        {
            this.SBInfos.Add(new SBGaltonHill());
        }

        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();
        }
    }
}

And the errors i get are.
C#:
Scripts: Compiling C# scripts...Failed with: 1 errors, 0 warnings
Errors:
 + Customs/Mobiles/Humanoid/Vesper/People/GaltonHill.cs:
    CS0115: Line 124: 'GaltonHill.IsActiveVendor': no suitable method found to override
    CS0115: Line 132: 'GaltonHill.InitSBInfo()': no suitable method found to override
Scripts: One or more scripts failed to compile or no script files were found.

Any help is appreciated :)
 

kfritz411

Citizen
you could try your hand at copy/paste/adjust to drop the blocks of code into the specific creature or add to your basecreature.cs (kind of advanced stuff on either approach IMO and not something I'm really that great at)

you could look at your vendor AI script(s) and add some DoWander "in theory" (again, I'm not really that great at this stuff)

could look at your spawner method (I use the XMLSpawner) and tinker around with the home and spawn ranges

Some different approaches, but hopefully that gets the gears in motion for ya
 

SimonOmega

Citizen
Try:
BaseVendor:
public class GaltonHill : BaseVendor

Or if you want to attempt building things from the ground up:
BaseVendor:
public class GaltonHill : BaseCreature, IVendor

See if one of these will produce the results you are looking for.

In your code when you create the GaltonHill class it is derived from BaseCreature class which does not contain the Vendor varriables, methods, and functions. GaltonHill being the child class it will need to derive something that has the vendor class components, or you would have to build them by hand. Adding ", IVendor" to BaseCreature creates a BaseCreature (Parent) but tacks on all the IVendor class components. You can try BaseVendor and it should create GaltonHill as a vendor in one shot.

Let us know if it helps.
 

Mikthebug

Citizen
Try:
BaseVendor:
public class GaltonHill : BaseVendor

Or if you want to attempt building things from the ground up:
BaseVendor:
public class GaltonHill : BaseCreature, IVendor

See if one of these will produce the results you are looking for.

In your code when you create the GaltonHill class it is derived from BaseCreature class which does not contain the Vendor varriables, methods, and functions. GaltonHill being the child class it will need to derive something that has the vendor class components, or you would have to build them by hand. Adding ", IVendor" to BaseCreature creates a BaseCreature (Parent) but tacks on all the IVendor class components. You can try BaseVendor and it should create GaltonHill as a vendor in one shot.

Let us know if it helps.
I did try the BaseVendor, but the problem with BaseVendor seems to be that it gives the NPCs some random cloth, looks etc that make layer conflics. That's why i tried to make a BaseCreature a vendor insted so i can customise it the way i want and not the get conflicts, but i will try the IVendor as well, so thanks for the tip! :)
 

Mikthebug

Citizen
You can override initoutfit or something similar to change clothes on base vendor.
So basically do,

C#:
        public override void InitBody()
        {
            this.InitStats(125, 50, 125);
            
            this.Female = true;   
            this.CantWalk = false;
            this.Race = Race.Human;       
            
            this.Hue = 0x83EA;
            this.HairItemID = 0x2048;
            this.HairHue = 0x476;
        }

but with, InitOutfit ? and add all the gear in there insted of under Constructable?