Izex

Member
I am using Animal Taming Systems Gen2 and I have everything working fine except for one bug. Each creature has a level between 1-30 but if the server restarts all creatures will be set to level 0. This makes it impossible for players to level pets and wanted to know if anyone has encountered this problem before and if they knew how to fix this. <3 and thank you for any response!
 
Not using the system but it sounds like a serialization / deserialization issue. Make sure the mobiles have the pet level in those functions (in mobile.cs I guess ;) )
 
Well I have been looking around in the files but not sure where the issue is ATM. You can download the system here. Will update if I find where the issue is.
[doublepost=1467257718][/doublepost]Okay I think I found the issue, but I do not know how to fix it since when I put in the edits required it makes me delete my mobiles save folder (player characters, items, any custom spawns) and if I do that and run/save/restart the server it will have be delete dark creeper and pretty much repeat.

So in BaseCreature.cs I forgot to add the edit I think is making my creatures not save their levels. I will post what I forgot and then what I have that is doing that.

BaseCreature (File with the edits needed)

Code:
public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 17 ); // version

            writer.Write( (int)m_CurrentAI );
            writer.Write( (int)m_DefaultAI );

            writer.Write( (int)m_iRangePerception );
            writer.Write( (int)m_iRangeFight );

            writer.Write( (int)m_iTeam );

            writer.Write( (double)m_dActiveSpeed );
            writer.Write( (double)m_dPassiveSpeed );
            writer.Write( (double)m_dCurrentSpeed );

            writer.Write( (int) m_pHome.X );
            writer.Write( (int) m_pHome.Y );
            writer.Write( (int) m_pHome.Z );

            // Version 1
            writer.Write( (int) m_iRangeHome );

            int i=0;

            writer.Write( (int) m_arSpellAttack.Count );
            for ( i=0; i< m_arSpellAttack.Count; i++ )
            {
                writer.Write( m_arSpellAttack[i].ToString() );
            }

            writer.Write( (int) m_arSpellDefense.Count );
            for ( i=0; i< m_arSpellDefense.Count; i++ )
            {
                writer.Write( m_arSpellDefense[i].ToString() );
            }

            // Version 2
            writer.Write( (int) m_FightMode );

            writer.Write( (bool) m_bControlled );
            writer.Write( (Mobile) m_ControlMaster );
            writer.Write( (Mobile) m_ControlTarget );
            writer.Write( (Point3D) m_ControlDest );
            writer.Write( (int) m_ControlOrder );
            writer.Write( (double) m_dMinTameSkill );
            // Removed in version 9
            //writer.Write( (double) m_dMaxTameSkill );
            writer.Write( (bool) m_bTamable );
            writer.Write( (bool) m_bSummoned );

            if ( m_bSummoned )
                writer.WriteDeltaTime( m_SummonEnd );

            writer.Write( (int) m_iControlSlots );

            // Version 3
            writer.Write( (int)m_Loyalty );

            // Version 4
            writer.Write( m_CurrentWayPoint );

            // Verison 5
            writer.Write( m_SummonMaster );

            // Version 6
            writer.Write( (int) m_HitsMax );
            writer.Write( (int) m_StamMax );
            writer.Write( (int) m_ManaMax );
            writer.Write( (int) m_DamageMin );
            writer.Write( (int) m_DamageMax );

            // Version 7
            writer.Write( (int) m_PhysicalResistance );
            writer.Write( (int) m_PhysicalDamage );

            writer.Write( (int) m_FireResistance );
            writer.Write( (int) m_FireDamage );

            writer.Write( (int) m_ColdResistance );
            writer.Write( (int) m_ColdDamage );

            writer.Write( (int) m_PoisonResistance );
            writer.Write( (int) m_PoisonDamage );

            writer.Write( (int) m_EnergyResistance );
            writer.Write( (int) m_EnergyDamage );

            // Version 8
            writer.Write( m_Owners, true );

            // Version 10
            writer.Write( (bool) m_IsDeadPet );
            writer.Write( (bool) m_IsBonded );
            writer.Write( (DateTime) m_BondingBegin );
            writer.Write( (DateTime) m_OwnerAbandonTime );

            // Version 11
            writer.Write( (bool) m_HasGeneratedLoot );

            // Version 12
            writer.Write( (bool) m_Paragon );

            // Version 13
            writer.Write( (bool) ( m_Friends != null && m_Friends.Count > 0 ) );

            if ( m_Friends != null && m_Friends.Count > 0 )
                writer.Write( m_Friends, true );

            // Version 14
            writer.Write( (bool)m_RemoveIfUntamed );
            writer.Write( (int)m_RemoveStep );

            // Version 17 FS:ATS EDITS
            writer.Write( (bool) m_IsMating );
            writer.Write( (int) m_ABPoints );
            writer.Write( (int) m_Exp );
            writer.Write( (int) m_NextLevel );
            writer.Write( (int) m_Level );
            writer.Write( (int) m_MaxLevel );
            writer.Write( (bool) m_AllowMating );
            writer.Write( (bool) m_Evolves );
            writer.Write( (int) m_Gen );
            writer.Write( (DateTime) m_MatingDelay );
            writer.Write( (int) m_Form1 );
            writer.Write( (int) m_Form2 );
            writer.Write( (int) m_Form3 );
            writer.Write( (int) m_Form4 );
            writer.Write( (int) m_Form5 );
            writer.Write( (int) m_Form6 );
            writer.Write( (int) m_Form7 );
            writer.Write( (int) m_Form8 );
            writer.Write( (int) m_Form9 );
            writer.Write( (int) m_Sound1 );
            writer.Write( (int) m_Sound2 );
            writer.Write( (int) m_Sound3 );
            writer.Write( (int) m_Sound4 );
            writer.Write( (int) m_Sound5 );
            writer.Write( (int) m_Sound6 );
            writer.Write( (int) m_Sound7 );
            writer.Write( (int) m_Sound8 );
            writer.Write( (int) m_Sound9 );
            writer.Write( (bool) m_UsesForm1 );
            writer.Write( (bool) m_UsesForm2 );
            writer.Write( (bool) m_UsesForm3 );
            writer.Write( (bool) m_UsesForm4 );
            writer.Write( (bool) m_UsesForm5 );
            writer.Write( (bool) m_UsesForm6 );
            writer.Write( (bool) m_UsesForm7 );
            writer.Write( (bool) m_UsesForm8 );
            writer.Write( (bool) m_UsesForm9 );
            writer.Write( (bool) m_F0 );
            writer.Write( (bool) m_F1 );
            writer.Write( (bool) m_F2 );
            writer.Write( (bool) m_F3 );
            writer.Write( (bool) m_F4 );
            writer.Write( (bool) m_F5 );
            writer.Write( (bool) m_F6 );
            writer.Write( (bool) m_F7 );
            writer.Write( (bool) m_F8 );
            writer.Write( (bool) m_F9 );
            writer.Write( (int) m_RoarAttack );
            writer.Write( (int) m_PetPoisonAttack );
            writer.Write( (int) m_FireBreathAttack );
        }

BaseCreature.cs (My file without edits)

Code:
public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write(20); // version

            writer.Write((int)m_CurrentAI);
            writer.Write((int)m_DefaultAI);

            writer.Write(m_iRangePerception);
            writer.Write(m_iRangeFight);

            writer.Write(m_iTeam);

            writer.Write(m_dActiveSpeed);
            writer.Write(m_dPassiveSpeed);
            writer.Write(m_dCurrentSpeed);

            writer.Write(m_pHome.X);
            writer.Write(m_pHome.Y);
            writer.Write(m_pHome.Z);

            // Version 1
            writer.Write(m_iRangeHome);

            int i = 0;

            writer.Write(m_arSpellAttack.Count);
            for (i = 0; i < m_arSpellAttack.Count; i++)
            {
                writer.Write(m_arSpellAttack[i].ToString());
            }

            writer.Write(m_arSpellDefense.Count);
            for (i = 0; i < m_arSpellDefense.Count; i++)
            {
                writer.Write(m_arSpellDefense[i].ToString());
            }

            // Version 2
            writer.Write((int)m_FightMode);

            writer.Write(m_bControlled);
            writer.Write(m_ControlMaster);
            writer.Write(m_ControlTarget);
            writer.Write(m_ControlDest);
            writer.Write((int)m_ControlOrder);
            writer.Write(m_dMinTameSkill);
            // Removed in version 9
            //writer.Write( (double) m_dMaxTameSkill );
            writer.Write(m_bTamable);
            writer.Write(m_bSummoned);

            if (m_bSummoned)
            {
                writer.WriteDeltaTime(m_SummonEnd);
            }

            writer.Write(m_iControlSlots);

            // Version 3
            writer.Write(m_Loyalty);

            // Version 4
            writer.Write(m_CurrentWayPoint);

            // Verison 5
            writer.Write(m_SummonMaster);

            // Version 6
            writer.Write(m_HitsMax);
            writer.Write(m_StamMax);
            writer.Write(m_ManaMax);
            writer.Write(m_DamageMin);
            writer.Write(m_DamageMax);

            // Version 7
            writer.Write(m_PhysicalResistance);
            writer.Write(m_PhysicalDamage);

            writer.Write(m_FireResistance);
            writer.Write(m_FireDamage);

            writer.Write(m_ColdResistance);
            writer.Write(m_ColdDamage);

            writer.Write(m_PoisonResistance);
            writer.Write(m_PoisonDamage);

            writer.Write(m_EnergyResistance);
            writer.Write(m_EnergyDamage);

            // Version 8
            writer.Write(m_Owners, true);

            // Version 10
            writer.Write(m_IsDeadPet);
            writer.Write(m_IsBonded);
            writer.Write(m_BondingBegin);
            writer.Write(m_OwnerAbandonTime);

            // Version 11
            writer.Write(m_HasGeneratedLoot);

            // Version 12
            writer.Write(m_Paragon);

            // Version 13
            writer.Write((m_Friends != null && m_Friends.Count > 0));

            if (m_Friends != null && m_Friends.Count > 0)
            {
                writer.Write(m_Friends, true);
            }

            // Version 14
            writer.Write(m_RemoveIfUntamed);
            writer.Write(m_RemoveStep);

            // Version 17
            if (IsStabled || (Controlled && ControlMaster != null))
            {
                writer.Write(TimeSpan.Zero);
            }
            else
            {
                writer.Write(DeleteTimeLeft);
            }

            // Version 18
            writer.Write(m_CorpseNameOverride);

            // Mondain's Legacy version 19
            writer.Write(m_Allured);

      //Version 20 Queens Loyalty
          writer.Write(m_QLPoints);
         
        }

What I tried was putting the FS:ATS Edit just below //Version 20 and naming it //Version 21 and changing
writer.Write(20); // version
to
writer.Write(21); // version

Can anyone help me out with this?
 
You need to make your changes in both the Serialize (write) AND Deserialize (read) and make sure they match up all the way down. What you're showing there is it's trying to Write what it hasn't even been able to Read in the first place, so it has no idea what to save. Hence the deletions. Post your BaseCreature.cs and the one from FSATS so we can check the full thing. Don't copy & paste them, just upload the files.
 
Here are the two files. Thank you for the help :)
 

Attachments

  • BaseCreature (FSATS).cs
    128.2 KB · Views: 14
  • BaseCreature.cs
    168.7 KB · Views: 4
This might do the trick. Not sure though. Its been a while since I did anything with FSATS , but nothing ventured - nothing gained. ;)
 

Attachments

  • BaseCreature.cs
    172.3 KB · Views: 31

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back