Redmoon

Member
I'm trying to make gold dust, and am getting this crash:
Code:
Server Crash Report
===================

RunUO Version 0.5, Build 5151.20665
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 4.0.30319.18444
Time: 2/19/2014 3:46:19 PM
Mobiles: 43317
Items: 236651
Exception:
System.MissingMethodException: No parameterless constructor defined for this object.
  at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
  at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
  at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
  at System.Activator.CreateInstance(Type type, Boolean nonPublic)
  at System.Activator.CreateInstance(Type type)
  at Server.Engines.Craft.CraftItem.CompleteCraft(Int32 quality, Boolean makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CustomCraft customCraft)
  at Server.Engines.Craft.CraftItem.InternalTimer.OnTick()
  at Server.Timer.Slice() in c:\Reds Domain Pub 54\Server\Timer.cs:line 387
  at Server.Core.Main(String[] args) in c:\Reds Domain Pub 54\Server\Main.cs:line 622

Here is the simple GoldDust.cs (no problems adding it IG)
Code:
using System;
using Server.Items;
using Server.Network;

namespace Server.Items
{

    public class GoldDust : Item
    {
        [Constructable]
        public GoldDust(int amount) : base(0x4C09)
        {
            Name = "Gold Dust";
            Stackable = true;
            Hue = 1161;//get hue
            Weight = 1.0;
            Amount = amount;
        }

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

}

And the DefAlchemy.cs:
Code:
index = this.AddCraft(typeof(GoldDust), 1098336, 1098337, 90.0, 120.0, typeof(Gold), 3000083, 1000, 1150747);
 this.SetNeededExpansion(index, Expansion.SA);

I'm thinking it has something to do with this in the Gold.cs:
Code:
        public Gold(int amountFrom, int amountTo)
            : this(Utility.RandomMinMax(amountFrom, amountTo))
 
System.MissingMethodException: No parameterless constructor defined for this object.
You need a parameterless constructor. Try adding this and see if it works. I don't have access to test it at the moment.
Code:
[Constructable]
public GoldDust() : this(1)
{
}
 
You need a parameterless constructor. Try adding this and see if it works. I don't have access to test it at the moment.
Code:
[Constructable]
public GoldDust() : this(1)
{
}

I get a client crash, and re-crashes on re-log with this one, but the new art for the gold dust shows up now.
 
Are the crashes happening from crafting? Does the '[add golddust' or '[add golddust 100' commands work?
 
I get a client crash, and re-crashes on re-log with this one, but the new art for the gold dust shows up now.
try removing :this(1) in Kalamus's code above and see how it goes. I just tried there and had no crash but I do not have your art.
 
The ': this(1)' just calls the other constructor with int value of 1. It's the same as as doing '[add golddust 1' but without having to assign the 1 value. If that's removed then then it won't call the base constructor or add any of the values assigned in the other constructor.
 
The ': this(1)' just calls the other constructor with int value of 1. It's the same as as doing '[add golddust 1' but without having to assign the 1 value. If that's removed then then it won't call the base constructor or add any of the values assigned in the other constructor.
My bad :p
 
Are the crashes happening from crafting? Does the '[add golddust' or '[add golddust 100' commands work?
Yes, these work fine. I'm thinking it's due to converting Gold.cs into a resource?

Code:
(int amountFrom, int amountTo)
 
I just tested the GoldDust with the added constructor and the DefAlchemy change you posted above. Add commands and crafting is working fine for me. Did you make any changes anywhere else?
 
Though, it shouldn't matter, can I ask what section you put it in in the DefAlchemy.cs?
I just added it to the very end of the init list, past the Plant Pigments/Natural Dyes area.

Recap everything for me. What client version are you using? Are you using custom art? When is the client crashing, when you [add the golddust or craft it? Does your script match up with what I have below?

I'm guessing there's something different about your client if you are getting client crashes but not server crashes.

Here's the full GoldDust script with the added constructor just for recapping purposes.
Code:
using System;
using Server.Items;
using Server.Network;

namespace Server.Items
{

	public class GoldDust : Item
	{
		[Constructable]
		public GoldDust()
			: this(1)
		{
		}

		[Constructable]
		public GoldDust(int amount)
			: base(0x4C09)
		{
			Name = "Gold Dust";
			Stackable = true;
			Hue = 1161;//get hue
			Weight = 1.0;
			Amount = amount;
		}

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

}
 
I just added it to the very end of the init list, past the Plant Pigments/Natural Dyes area.

Recap everything for me. What client version are you using? Are you using custom art? When is the client crashing, when you [add the golddust or craft it? Does your script match up with what I have below?

I'm guessing there's something different about your client if you are getting client crashes but not server crashes.

Here's the full GoldDust script with the added constructor just for recapping purposes.
Code:
using System;
using Server.Items;
using Server.Network;

namespace Server.Items
{

	public class GoldDust : Item
	{
		[Constructable]
		public GoldDust()
			: this(1)
		{
		}

		[Constructable]
		public GoldDust(int amount)
			: base(0x4C09)
		{
			Name = "Gold Dust";
			Stackable = true;
			Hue = 1161;//get hue
			Weight = 1.0;
			Amount = amount;
		}

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

}
I could hug ya!!! Yep I didn't have the same script as you. It's working now! WOOT! WOOT! Now to finish adding in the rest of the craftables.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back