Lemke

Member
Hello,i try to get a ride with 2 stages,stage 1= taming required(savage),stage 2= taming no required(tamed).

If i place the mount,and spawn it,when i restart the shard gives the message saying this ride is not found,delete all the same types of object,etc...
Here is the code:

using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
[CorpseName( "a corpse" )]
public class TwoStages : BaseMount
{

public int m_Stage;

public bool m_S1;
public bool m_S2;

public bool S1
{
get{ return m_S1; }
set{ m_S1 = value; }
}
public bool S2
{
get{ return m_S2; }
set{ m_S2 = value; }
}

[CommandProperty( AccessLevel.GameMaster )]
public int Stage
{
get{ return m_Stage; }
set{ m_Stage = value; }
}
[Constructable]
public TwoStages() : this( "Two stages" )
{
}

[Constructable]
public TwoStages ( string name ) : base( name, 0xD5, 0x3EC5, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.1, 0.2 )
{
Body = 213;
BaseSoundID = 0xA3;
Hue = 2934;
SetStr( 116, 140 );
SetDex( 81, 105 );
SetInt( 26, 50 );
S1 = true;
S2 = false;
SetHits( 70, 84 );
SetMana( 0 );

SetDamage( 7, 12 );

SetDamageType( ResistanceType.Physical, 100 );

SetResistance( ResistanceType.Physical, 25, 35 );
SetResistance( ResistanceType.Cold, 60, 80 );
SetResistance( ResistanceType.Poison, 15, 25 );
SetResistance( ResistanceType.Energy, 10, 15 );

SetSkill( SkillName.MagicResist, 45.1, 60.0 );
SetSkill( SkillName.Tactics, 60.1, 90.0 );
SetSkill( SkillName.Wrestling, 45.1, 70.0 );

Fame = 1500;
Karma = 0;

VirtualArmor = 18;

Tamable = true;
ControlSlots = 2;
MinTameSkill = 99.1;
}

public override void OnThink()
{
if ( Controlled == true )
{
if ( this.S1 == true )
{
this.S1 = false;
this.Tamable = true;
this.ControlSlots = 2;
this.MinTameSkill = 0;
}
}
}

public override int Meat{ get{ return 2; } }
public override int Hides{ get{ return 16; } }
public override FoodType FavoriteFood{ get{ return FoodType.Fish | FoodType.FruitsAndVegies | FoodType.Meat; } }
public override PackInstinct PackInstinct{ get{ return PackInstinct.Bear; } }
public override Poison PoisonImmune{ get{ return Poison.Deadly; } }
public TwoStages( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write((int) 1);
writer.Write( m_S1 );
writer.Write( m_S2 );
writer.Write( (int) m_Stage );
writer.Write( (int) 0 );
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
{
m_S1 = reader.ReadBool();
m_S2 = reader.ReadBool();
m_Stage = reader.ReadInt();
}
}
}
}


Did someone see an error on serialize/deserialize?Thanks in advance!!!
 
Your serialize and deserialize do not match. Everything written in serialize must be read back in the same order it was written in deserialize.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back