ImaNewb

Member
ServUO Version
Publish Unknown
Ultima Expansion
The Second Age
Hey all I am sure this is something simple but I noticed that I cant fight with a smith hammer. I know that back in the day you could use a smith hammer as a bashing weapon like a mace. Any Idea how I can make that work? Right now I can EITHER make the hammer a tool or a weapon but I cant figure out how to make it both. It seems that when I try to add weapon attributes to the it Smithhammer it doesn't like that. It seems that the trouble is with the base class. Is there a way to make the item a dual class? BaseTool and BaseBashing?

Here is my Smithhammer script. Pretty Standard.
C#:
using Server.Engines.Craft;

namespace Server.Items
{
    [FlipableAttribute( 0x13E3, 0x13E4 )]
    public class SmithHammer : BaseTool
    {
        public override CraftSystem CraftSystem{ get{ return DefBlacksmithy.CraftSystem; } }

        [Constructable]
        public SmithHammer() : base( 0x13E3 )
        {
            Weight = 8.0;
            Layer = Layer.OneHanded;
        }

        [Constructable]
        public SmithHammer( int uses ) : base( uses, 0x13E3 )
        {
            Weight = 8.0;
            Layer = Layer.OneHanded;
        }

        public SmithHammer( Serial serial ) : base( serial )
        {
        }

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

Id like to add this section
C#:
public class SmithyHammer : BaseBashing
    {
        
        public override string Damage { get { return WeaponControl.Settings.SmithyHammerDamage; } }

        public override int OldStrengthReq { get { return 45; } }
        public override int OldMinDamage { get { return 6; } }
        public override int OldMaxDamage { get { return 18; } }
        public override int OldSpeed { get { return 40; } }

        public override int InitMinHits { get { return 31; } }
        public override int InitMaxHits { get { return 60; } }
Do I have to make a whole new base class for this to work?
 
Last edited:
Well there are 2 versions in the main code.

SmithHammer: Tool only
and SmithyHammer: Tool and weapon.

So if you use Smithyhammer you already got the Base bashing tool.

But ultimately you would use the same interfaces as BaseTool, overwrite the DoubleClick of the hammer and you would get the same result.
Even though you may want to add the FlipableAttribute over to SmithyHammer as well
 
Well there are 2 versions in the main code.

SmithHammer: Tool only
and SmithyHammer: Tool and weapon.

So if you use Smithyhammer you already got the Base bashing tool.

But ultimately you would use the same interfaces as BaseTool, overwrite the DoubleClick of the hammer and you would get the same result.
Even though you may want to add the FlipableAttribute over to SmithyHammer as well
Thank you Pyro. I just cant get it to work. I cant figure out how to write the double click. I have taken the method from BaseTool but even that continues to complain. Then I tried to tell it to just pull up the blacksmith gump but that doesn't seem to work either. I just don't know what to do here.

C#:
using Server.Engines.Craft;

namespace Server.Items
{
    [Flipable(0x13b4, 0x13b3)]
    public class SmithyHammer : BaseBashing
    {
        public override string Damage { get { return WeaponControl.Settings.SmithyHammerDamage; } }

        public override int OldStrengthReq { get { return 35; } }
        public override int OldMinDamage { get { return 8; } }
        public override int OldMaxDamage { get { return 24; } }
        public override int OldSpeed { get { return 40; } }

        public override int InitMinHits { get { return 31; } }
        public override int InitMaxHits { get { return 40; } }

        [Constructable]
        public SmithyHammer()
            : base(0x13B4)
        {
            Weight = 9.0;
        }

        public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) || Parent == from )
            {
                CraftSystem system = this.CraftSystem;

                int num = system.CanCraft( from, this, null );

                if ( num > 0 )
                {
                    from.SendLocalizedMessage( num );
                }
                else
                {
                    from.SendGump( new CraftGump( from, system, this, null ) );
                }
            }
            else
            {
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
        }
      
      
        public SmithyHammer(Serial serial)
            : base(serial)
        { }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write(0); // version
        }

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

            var version = reader.ReadInt();
        }
    }
}

C#:
Errors:
 + Custom/Systems/Combat Control/Weapons/Maces/SmithyHammer.cs:
    CS1061: Line 29: 'Server.Items.SmithyHammer' does not contain a definition for 'CraftSystem' and no extension method 'CraftSystem' accepting a first argument of type 'Server.Items.SmithyHammer' could be found (are you missing a using directive or an assembly reference?)
    CS1502: Line 31: The best overloaded method match for 'Server.Engines.Craft.CraftSystem.CanCraft(Server.Mobile, Server.Items.BaseTool, System.Type)' has some invalid arguments
    CS1503: Line 31: Argument 2: cannot convert from 'Server.Items.SmithyHammer' to 'Server.Items.BaseTool'
    CS1502: Line 39: The best overloaded method match for 'Server.Engines.Craft.CraftGump.CraftGump(Server.Mobile, Server.Engines.Craft.CraftSystem, Server.Items.BaseTool, object)' has some invalid arguments
    CS1503: Line 39: Argument 3: cannot convert from 'Server.Items.SmithyHammer' to 'Server.Items.BaseTool'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
 
Last edited:
Like I said, what you want to do, already exists in the repo.


There are 2 clases inside this file.

And you didn not add a property for CraftSystem, but you try to access it.
You didnt add the interface ITools.

And apparently you use an older version. That could be why you lack the interface.
Since it runs from 2 different base classes you would need the interface.

Else you will continue to get the error of "cannot convert"
 
Like I said, what you want to do, already exists in the repo.


There are 2 clases inside this file.

And you didn not add a property for CraftSystem, but you try to access it.
You didnt add the interface ITools.

And apparently you use an older version. That could be why you lack the interface.
Since it runs from 2 different base classes you would need the interface.

Else you will continue to get the error of "cannot convert"
Yep I am running an older version. Thanks again Pyro. :D
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back