I was trying to change the weight limit in the core containers script to allow for a max weight of 1000 stones and got that working but I want to make gold weightless only in the bankbox so that it doesnt contribute to the max weight. I haven't been able to do it. I can make gold weightless globally but that's not what I want to do. Can anyone tell me how to do this ?
 
And yet not all people use the new era with the account gold. You could look into setting the weight to 0 in the gold script with the DragInto or what its called, with a check for the bankbox. If it is not a bankbox or on the ground then set weight back to normal?
 
And yet not all people use the new era with the account gold. You could look into setting the weight to 0 in the gold script with the DragInto or what its called, with a check for the bankbox. If it is not a bankbox or on the ground then set weight back to normal?
Yes I'm using expansion none. Also im running Runuo 2.2 right now. What you are describing is exactly what i would like, can you recommended a script that does something similar so i can see how the code would work. I am not a coder so I would need an example.
 
This may not be correct, i am learning the code as well, however, if i were to want to make gold weigh nothing while in bankbox, i would first find the gold script, it resides at
Scripts\Items\Consumables\Gold.cs

Then read the file a bit, you will notice pretty much all the code is contained within
public override void OnAdded(object parent)

So, looks like to me that this is called when the gold is added to bankbox, or a container, or to a player, also looks like when 2 players are trading.

So, need to think out what you really want to do first, if we find out where to check for a bankbox, and then we want to set the weight to 0, what i am unsure of, because i do not know the code well, if once we put it in the bank and set weight to 0, if we pull it out again we may need to check if weight is 0 again, and if so reset it to default, but the code may be written in such a way that would make that unnecessary, i have not tested this method, it is all just a first glance assessment, but if nothing else it should point you in the right direction.

If we read the file inside the OnAdded function one section stands out
Code:
else if (parent is BankBox && AccountGold.ConvertOnBank)
            {
                owner = ((BankBox)parent).Owner;
            }

This looks like good place to test it, so change it to look as such

Code:
else if (parent is BankBox && AccountGold.ConvertOnBank)
            {
                owner = ((BankBox)parent).Owner;
                this.Weight = 0;
            }

Give that a shot, it might work, keep in mind you will need to pull the gold back out of the bankbox and see if the weight stays at 0, if so you may not want that, so you would need to go back into this code, and add something like this, right under the first snippet

Code:
if(parent is Container)
            {
                Container c = parent as Container;
                if (c.Parent is PlayerMobile && this.Weight == 0)
                {
                    this.Weight = DefaultWeight;
                }
            }

Again i did not test this, so i may be totally off
 
This may not be correct, i am learning the code as well, however, if i were to want to make gold weigh nothing while in bankbox, i would first find the gold script, it resides at
Scripts\Items\Consumables\Gold.cs

Then read the file a bit, you will notice pretty much all the code is contained within
public override void OnAdded(object parent)

So, looks like to me that this is called when the gold is added to bankbox, or a container, or to a player, also looks like when 2 players are trading.

So, need to think out what you really want to do first, if we find out where to check for a bankbox, and then we want to set the weight to 0, what i am unsure of, because i do not know the code well, if once we put it in the bank and set weight to 0, if we pull it out again we may need to check if weight is 0 again, and if so reset it to default, but the code may be written in such a way that would make that unnecessary, i have not tested this method, it is all just a first glance assessment, but if nothing else it should point you in the right direction.

If we read the file inside the OnAdded function one section stands out
Code:
else if (parent is BankBox && AccountGold.ConvertOnBank)
            {
                owner = ((BankBox)parent).Owner;
            }

This looks like good place to test it, so change it to look as such

Code:
else if (parent is BankBox && AccountGold.ConvertOnBank)
            {
                owner = ((BankBox)parent).Owner;
                this.Weight = 0;
            }

Give that a shot, it might work, keep in mind you will need to pull the gold back out of the bankbox and see if the weight stays at 0, if so you may not want that, so you would need to go back into this code, and add something like this, right under the first snippet

Code:
if(parent is Container)
            {
                Container c = parent as Container;
                if (c.Parent is PlayerMobile && this.Weight == 0)
                {
                    this.Weight = DefaultWeight;
                }
            }

Again i did not test this, so i may be totally off
Awesome i will give this a shot and play around with it when I get home. This example is great thank you for the help!
 
The first part should not work as you want it, if I see it right since you also have "AccountGold.ConvertOnBank" as a condition.
That is for the AccountGold itself wich he does not want to use and I guess not even have in his version.

But the general idea is right. Also you may want to see if you can set the weight back once it drops on the ground
 
The first part should not work as you want it, if I see it right since you also have "AccountGold.ConvertOnBank" as a condition.
That is for the AccountGold itself wich he does not want to use and I guess not even have in his version.

But the general idea is right. Also you may want to see if you can set the weight back once it drops on the ground
The script I am using is considerably different. Also makes no reference to a GoldAccount so as you said the solution would't work in that way.
Code:
using System;
using Server.Network;

namespace Server.Items
{
    public class Gold : Item
    {
        public override double DefaultWeight
        {
            get { return 0.02; }
        }

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

        [Constructable]
        public Gold( int amountFrom, int amountTo ) : this( Utility.RandomMinMax( amountFrom, amountTo ) )
        {
        }

        [Constructable]
        public Gold( int amount ) : base( 0xEED )
        {
            Stackable = true;
            Amount = amount;
        }

        public Gold( 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 + " gold coins"));
                }
                else
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", "gold coin"));
                }
            }
        }

        public override int GetDropSound()
        {
            if ( Amount <= 1 )
                return 0x35;
            else if ( Amount <= 5 )
                return 0x36;
            else
                return 0x37;
        }

        protected override void OnAmountChange( int oldValue )
        {
            int newValue = this.Amount;

            UpdateTotal( this, TotalType.Gold, newValue - oldValue );
        }

        public override int GetTotal( TotalType type )
        {
            int baseTotal = base.GetTotal( type );

            if ( type == TotalType.Gold )
                baseTotal += this.Amount;

            return baseTotal;
        }

      

        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();
        }
    }
}
 
was asked how to add the color to mouseover of a item, so gonna post it here

AddNameProperty(ObjectPropertyList list) all items inherit this, all i have seen override it, then after it does all it normally does, you can add a custom property like this

Code:
      #region Evo Gear
  if (IsEvo)
  {
  list.Add(string.Format("<BASEFONT COLOR={0}> [Evo Armor] Level {1}/{2} <BASEFONT COLOR=#FFFFFF>",
  TextColor.Amaranth_deep_purple, _evoLevel, _evoMaxLevel));
  }
  #endregion
[doublepost=1484194003][/doublepost]
The script I am using is considerably different. Also makes no reference to a GoldAccount so as you said the solution would't work in that way.
Code:
using System;
using Server.Network;

namespace Server.Items
{
    public class Gold : Item
    {
        public override double DefaultWeight
        {
            get { return 0.02; }
        }

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

        [Constructable]
        public Gold( int amountFrom, int amountTo ) : this( Utility.RandomMinMax( amountFrom, amountTo ) )
        {
        }

        [Constructable]
        public Gold( int amount ) : base( 0xEED )
        {
            Stackable = true;
            Amount = amount;
        }

        public Gold( 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 + " gold coins"));
                }
                else
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, 0, 3, "", "gold coin"));
                }
            }
        }

        public override int GetDropSound()
        {
            if ( Amount <= 1 )
                return 0x35;
            else if ( Amount <= 5 )
                return 0x36;
            else
                return 0x37;
        }

        protected override void OnAmountChange( int oldValue )
        {
            int newValue = this.Amount;

            UpdateTotal( this, TotalType.Gold, newValue - oldValue );
        }

        public override int GetTotal( TotalType type )
        {
            int baseTotal = base.GetTotal( type );

            if ( type == TotalType.Gold )
                baseTotal += this.Amount;

            return baseTotal;
        }

     

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


Whats your Item.cs script look like ?
[doublepost=1484194096][/doublepost]
was asked how to add the color to mouseover of a item, so gonna post it here

AddNameProperty(ObjectPropertyList list) all items inherit this, all i have seen override it, then after it does all it normally does, you can add a custom property like this

Code:
      #region Evo Gear
  if (IsEvo)
  {
  list.Add(string.Format("<BASEFONT COLOR={0}> [Evo Armor] Level {1}/{2} <BASEFONT COLOR=#FFFFFF>",
  TextColor.Amaranth_deep_purple, _evoLevel, _evoMaxLevel));
  }
  #endregion
[doublepost=1484194003][/doublepost]


Whats your Item.cs script look like ?



Also for the mouse over, i have not tested all those colors, they should work, but client might not like some of them
 
I am sure you will have these methods in RunUO so add that into your gold.cs and it should work just fine ;)
Code:
		public override bool OnDroppedInto(Mobile from, Container target, Point3D p)
		{
			if (target is BankBox)
				Weight = 0;
			return base.OnDroppedInto(from, target, p);
		}

		public override bool OnDragLift(Mobile from)
		{
			Weight = DefaultWeight;
			return base.OnDragLift(from);
		}
 
Here is what my Item.cs looks
I am sure you will have these methods in RunUO so add that into your gold.cs and it should work just fine ;)
Code:
		public override bool OnDroppedInto(Mobile from, Container target, Point3D p)
		{
			if (target is BankBox)
				Weight = 0;
			return base.OnDroppedInto(from, target, p);
		}

		public override bool OnDragLift(Mobile from)
		{
			Weight = DefaultWeight;
			return base.OnDragLift(from);
		}
Let me just first say thank you Pyro and Daniel for helping me with this. The code works and it is people like you that are the backbone of the community. You didn't have to help with this and there are many posts that get left unanswered. I am very grateful you took the time to help me through this problem. Cheers!
 
Back