RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How To Fix Messy Bag Script in Runuo 2.4

UOExtreme

Sorceror
Hello there everyone I've looked and I've tried different ways to fix the messy bag issue to the point I Fixed it and the saves worked perfect but after the server restart I had a Server.Mobiles.PlayerMobile, serial=0x00000001) Error to the point it wiped out all the player accounts here's the Script can anyone please help?
 

Attachments

  • PlayerMobile.cs
    130.1 KB · Views: 2

Mortis

Knight
In your Serialization
Code:
            writer.Write( (int) 28 ); // version
 
            writer.Write((int)29); // version //Messy Bag Mod Start
 
            if (m_ItemLocations == null)
            {
                writer.Write((int)0);
            }
            else
            {
                writer.Write(m_ItemLocations.Count);
 
                foreach (KeyValuePair<Item, Point2D> kvp in m_ItemLocations)
                {
                    writer.Write(kvp.Key);
                    writer.Write(kvp.Value.X);
                    writer.Write(kvp.Value.Y);
                }
            }//Messy Bag Mod End

Should be
Code:
            writer.Write((int)29); // version //Messy Bag Mod Start
 
            if (m_ItemLocations == null)
            {
                writer.Write((int)0);
            }
            else
            {
                writer.Write(m_ItemLocations.Count);
 
                foreach (KeyValuePair<Item, Point2D> kvp in m_ItemLocations)
                {
                    writer.Write(kvp.Key);
                    writer.Write(kvp.Value.X);
                    writer.Write(kvp.Value.Y);
                }
            }//Messy Bag Mod End

And in Deserialize you have and I do not understand why.
Code:
                        goto case 25;

Maybe it should be.
Code:
                case 29: //Messy Bag Mod Start
                    {
                        int itemLocationsCount = reader.ReadInt();
 
                        if (itemLocationsCount > 0)
                        {
                            m_ItemLocations = new Dictionary<Item, Point2D>();
 
                            for (int i = 0; i < itemLocationsCount; i++)
                            {
                                m_ItemLocations.Add(reader.ReadItem(), new Point2D(reader.ReadInt(), reader.ReadInt()));
                            }
                        }
Comment out the Deserialize part. Start server, [save. UN-comment out Case 29 in Deserialize and start server.
 

tindo

Sorceror
You should not be getting a scrambled inventory unless you have your expansion set to be pre-aos. If you have expansion set prior to AOS, then scrambled inventories are correct to era.

If you dont want them scrambled and you are using pre-aos, then all you need to do is add this line in playermobile.cs:

Code:
public override bool RetainPackLocsOnDeath { get { return true; } }

There is no need for those edits you did and you certainly shouldn't need to re-serialize your playermmobile.
 
Top