I am attempting to make a "coal ore" that simply produces an iron ingot with a hue of 1109 and the name "coal ingots". I don't really want to make a whole new resource as it does not need to be mineable at all. It is simply a holiday item that I want players to be able to smelt and craft with changing no properties of iron except the hue. I can make the coal ore just fine but it still spits out a regular colored iron ingot when smelted. This seems like it should be super simple to do. Here is what I have. Any suggestions? I am running on RunUO 2.2. I also attempted to make a coal ingot as well instead but it is not recognized as Iron and therefore wont craft.

C#:
public class CoalOre : BaseOre
    {
        [Constructable]
        public CoalOre() : this( 1 )
        {
        }

        [Constructable]
        public CoalOre( int amount ) : base( CraftResource.Iron, amount )
        {
            Weight = 20.0;
            Hue = 1109;
        }

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

        public override void OnSingleClick(Mobile from)
        {
            if (this.Name != null)
            {
                if (Amount >= 2)
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", Amount + " " + this.Name));
                }
                else
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", this.Name));
                }
            }
            else
            {
                if (Amount >= 2)
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", Amount + " coal"));
                }
                else
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", "coal"));
                }
            }
        }

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

      

        public override BaseIngot GetIngot()
        {
            return new IronIngot();
            Hue = 1109;
            Name = "coal ingot";
        }
    }

C#:
[FlipableAttribute( 0x1BF2, 0x1BEF )]
    public class CoalIngot : BaseIngot
    {
        [Constructable]
        public CoalIngot() : this( 1 )
        {
        }

        [Constructable]
        public CoalIngot( int amount ) : base( CraftResource.Iron, amount )
        {
            Tag = "mining";
            Hue = 1109;
        }

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

        public override void OnSingleClick(Mobile from)
        {
            if (this.Name != null)
            {
                if (Amount >= 2)
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", Amount + " " + this.Name));
                }
                else
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", this.Name));
                }
            }
            else
            {
                if (Amount >= 2)
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", Amount + " coal ingots"));
                }
                else
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", "a coal ingot"));
                }
            }
        }

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

        
    }
 
Last edited:
hmm why not
C#:
        public override BaseIngot GetIngot()
        {
            return new CoalIngot();
        }

but at the same time if you actually want to give them IronIngots that are named and hued, you dont need the CoalIngot class.

then you can do
C#:
        public override BaseIngot GetIngot()
        {
            return new IronIngot()
            {
                Hue = 1109,
                Name = "coal ingot"
            };
        }

the way you wrote it, it would never reach Hue or Name, and if it would do, then it would name the and hue the Ore instead
 
hmm why not
C#:
        public override BaseIngot GetIngot()
        {
            return new CoalIngot();
        }

but at the same time if you actually want to give them IronIngots that are named and hued, you dont need the CoalIngot class.

then you can do
C#:
        public override BaseIngot GetIngot()
        {
            return new IronIngot()
            {
                Hue = 1109,
                Name = "coal ingot"
            };
        }

the way you wrote it, it would never reach Hue or Name, and if it would do, then it would name the and hue the Ore instead

So I tried the code you suggested below

C#:
public override BaseIngot GetIngot()
        {
            return new IronIngot();
            {
                Hue = 1109;
                Name = "coal ingot";
            };
        }

Oddly though It still produced an iron ingot with no hue or namechange.
 
This ought to do the trick. I can't test it because of my custom ores but it should do it!

Code:
        public override BaseIngot GetIngot()
        {
            IronIngot cingot = new IronIngot();
            cingot.Hue = 1109;
            cingot.Name = "coal ingot";

        return (cingot);
        }

Crafting may present its own challenges since the system will see it as iron ore and probably won't use its hue.
 
This ought to do the trick. I can't test it because of my custom ores but it should do it!

Code:
        public override BaseIngot GetIngot()
        {
            IronIngot cingot = new IronIngot();
            cingot.Hue = 1109;
            cingot.Name = "coal ingot";

        return (cingot);
        }

Crafting may present its own challenges since the system will see it as iron ore and probably won't use its hue.
Wow that worked perfectly! Thank you. The other solution seemed like it should have worked. Whats different about what you did? Is this just making a whole new item called a cingot that is an ironingot with the added properties?
 
Returning "new IronIngot" did exactly that -- it immediately returned a new (and normal) IronIngot having never reached the properties you wanted to change.

Now we poof up an iron ingot (referred to as cingot for our purposes), edit it, and then return the modified item.
 
Returning "new IronIngot" did exactly that -- it immediately returned a new (and normal) IronIngot having never reached the properties you wanted to change.

Now we poof up an iron ingot (referred to as cingot for our purposes), edit it, and then return the modified item.
Makes sense. Thanks again!
Post automatically merged:

Finished it up. Here is smeltable coal that doesnt require any changes to crafting if anyone else ever needs it. Just drop it into your ore.cs Keep in mind that the server will think its iron so when crafting with it it wont retain the color.

C#:
public class CoalOre : BaseOre
    {

        [Constructable]
        public CoalOre() : this( 1 )
        {
        }
        

        [Constructable]
        public CoalOre( int amount ) : base( CraftResource.Coal, amount )
        {
            Hue = 1109;
            Name = "coal";
            Weight = 20;
        }

        public CoalOre( 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();
        }
        
         public override BaseIngot GetIngot()
        {
            IronIngot cingot = new IronIngot();
            cingot.Hue = 1109;
            
            if (Amount >= 2)
                {
                    cingot.Name = "coal ingots";
                }
                else
                {
                    cingot.Name = "coal ingot";
                }
            
            return (cingot);
        }
        
    }

Thanks again to Falcore and Pyro above.
Post automatically merged:

Makes sense. Thanks again!
Post automatically merged:

Finished it up. Here is smeltable coal that doesnt require any changes to crafting if anyone else ever needs it. Just drop it into your ore.cs Keep in mind that the server will think its iron so when crafting with it it wont retain the color.

C#:
public class CoalOre : BaseOre
    {

        [Constructable]
        public CoalOre() : this( 1 )
        {
        }
       

        [Constructable]
        public CoalOre( int amount ) : base( CraftResource.Coal, amount )
        {
            Hue = 1109;
            Name = "coal";
            Weight = 20;
        }

        public CoalOre( 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();
        }
       
         public override BaseIngot GetIngot()
        {
            IronIngot cingot = new IronIngot();
            cingot.Hue = 1109;
           
            if (Amount >= 2)
                {
                    cingot.Name = "coal ingots";
                }
                else
                {
                    cingot.Name = "coal ingot";
                }
           
            return (cingot);
        }
       
    }

Thanks again to Falcore and Pyro above.
Actually you will need to change the craftresource to iron if you don't have coal so here is that change.

C#:
public class CoalOre : BaseOre
    {

        [Constructable]
        public CoalOre() : this( 1 )
        {
        }
        

        [Constructable]
        public CoalOre( int amount ) : base( CraftResource.Iron, amount )
        {
            Hue = 1109;
            Name = "coal";
            Weight = 20;
        }

        public CoalOre( 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();
        }
        
         public override BaseIngot GetIngot()
        {
            IronIngot cingot = new IronIngot();
            cingot.Hue = 1109;
            
            if (Amount >= 2)
                {
                    cingot.Name = "coal ingots";
                }
                else
                {
                    cingot.Name = "coal ingot";
                }
            
            return (cingot);
        }
        
    }
 
Last edited:
So I tried the code you suggested below

C#:
public override BaseIngot GetIngot()
        {
            return new IronIngot();
            {
                Hue = 1109;
                Name = "coal ingot";
            };
        }

Oddly though It still produced an iron ingot with no hue or namechange.

haha looking at that? I see why. Not sure why I didnt spot that :D
I forgot to remove the semicolon there and the values shouldnt even have them.

C#:
        public BaseIngot GetIngot()
        {
            return new IronIngot()
            {
                Hue = 1109,
                Name = "coal ingot"
            };
        }

But in the End its good that it works for you, even though I would still use the
CoalIngot instead, since you created the class in the first place. Would also prevent
it from accidently using your coalingots (the way you do them now) in crafting with iron
 
haha looking at that? I see why. Not sure why I didnt spot that :D
I forgot to remove the semicolon there and the values shouldnt even have them.

C#:
        public BaseIngot GetIngot()
        {
            return new IronIngot()
            {
                Hue = 1109,
                Name = "coal ingot"
            };
        }

But in the End its good that it works for you, even though I would still use the
CoalIngot instead, since you created the class in the first place. Would also prevent
it from accidently using your coalingots (the way you do them now) in crafting with iron
Yeah Ill have to consider the outcome. I really don't want players making rare armor/weapons with coal just something neat to play with on holidays. The shard heavily borrows form UO Origins crafting system and its Pre T2a so Iron is the only mineable/craftable metal on the server.
 
Back