Hello, I've added in a few variables into the PlayerMobile.cs file. I'm having issues with the Serialization or Deserialization of the variables I guess?

Error..
An error was encountered while loading a saved object
- Type: Server.Mobiles.PlayerMobile
- Serial: 0x000003C3
Delete the object? (y/n)
Delete all objects of that type? (y/n)
After pressing return an exception will be thrown and the server will terminate.
yyfdghbfgdh\
Error:
System.Exception: Load failed (items=False, mobiles=True, guilds=False, data=False, type=Server.Mobiles.PlayerMobile, serial=0x000003C3) ---> System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
at System.IO.BinaryReader.ReadBoolean()
at Server.Mobiles.PlayerMobile.Deserialize(GenericReader reader)
at Server.World.Load() in c:\Users\lisa\Downloads\ServUO-master\ServUO-master\Server\World.cs:line 595
--- End of inner exception stack trace ---
at Server.World.Load() in c:\Users\lisa\Downloads\ServUO-master\ServUO-master\Server\World.cs:line 328
at Server.Core.Main(String[] args) in c:\Users\lisa\Downloads\ServUO-master\ServUO-master\Server\Main.cs:line 545
This exception is fatal, press return to exit


I've tried multiple different ways of serializing and deserializing nothing seems to work. So If someone can take a few moments look over this script and explain what I'm doing wrong I would really be thankful!
 

Attachments

  • PlayerMobile.cs
    142.9 KB · Views: 4
What did you add?
Nevermind, I found what you added & I think I see the problem.
In DeSerialize you have
Code:
                    //Level System

                    m_CharacterLevel = reader.ReadInt();
                    m_CharacterExperience = reader.ReadInt();
                    m_CharacterSkillPoints = reader.ReadInt();
                    m_CharacterStatPoints = reader.ReadInt();
                    m_CharacterExpNeeded = reader.ReadInt();

                    // End Level System
but in Serialize you only have
Code:
            // Level System Version 31
           
            writer.Write((int)m_CharacterLevel);
            writer.Write((int)m_CharacterExperience);
            writer.Write((int)m_CharacterSkillPoints);
            writer.Write((int)m_CharacterStatPoints);
           
            //Level System End
You are missing the CharacterExpNeeded in Serialize.
 
Last edited:
Back