Full Version : PhantomSteed don't save color
xmlspawner >>Scripting Support >>PhantomSteed don't save color
<< Prev | Next >>
Erica- 03-27-2007
Hi again i am not sure if this can be done but here it is ok i got a PhantomSteed mount he is Ethereal mount when not on him then when you mount him he changes to a hue blue color when your mounted on him then if you get off him he is Ethereal color now it seems to work like that but when you restart the server before you mount him hes not ethereal no more hes blue so how can i get it to save when i restart he should always be ehtereal color when not mounted and when mounted should always change hue blue color can you please tell me what i need to add so when i reboot server it saves the way it should be thanks heres the script

CODE
using System; using Server; using Server.Items; using Server.Mobiles; namespace Server.Mobiles
{
[CorpseName( "a phantom steed corpse" )]
public class PhantomSteed : BaseMount
{
public override WeaponAbility GetWeaponAbility()
{
switch ( Utility.Random( 10 ) )
{
default: return null;
case 0: return WeaponAbility.MortalStrike;
case 1: return WeaponAbility.BleedAttack;
}
}
[Constructable]
public PhantomSteed() : this( "a phantom steed" )
{
}
[Constructable]
public PhantomSteed( string name ) : base( name, 0x74, 0x3EA7, AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
BaseSoundID = 0xA8;
Hue = 2972;
HueMod = 16385;
SetStr( 700, 715 );
SetDex( 350, 405 );
SetInt( 350, 475 );
SetHits( 650, 670 );
SetDamage( 30, 35 );
SetDamageType( ResistanceType.Physical, 65 );
SetDamageType( ResistanceType.Fire, 45 );
SetDamageType( ResistanceType.Cold, 40 );
SetDamageType( ResistanceType.Poison, 30 );
SetDamageType( ResistanceType.Energy, 45 );
SetResistance( ResistanceType.Physical, 70 );
SetResistance( ResistanceType.Fire, 65 );
SetResistance( ResistanceType.Cold, 50 );
SetResistance( ResistanceType.Poison, 50 );
SetResistance( ResistanceType.Energy, 45 );
SetSkill( SkillName.EvalInt, 120.0, 130.0 );
SetSkill( SkillName.Magery, 100.0, 120.0 );
SetSkill( SkillName.MagicResist, 109.0, 115.0 );
SetSkill( SkillName.Tactics, 115.0, 125.0 );
SetSkill( SkillName.Wrestling, 100.0, 105.0 );
SetSkill( SkillName.Meditation, 110.0, 120.0 );
SetSkill( SkillName.Anatomy, 175.0, 200.0 );
Fame = 14000;
Karma = -14000;
VirtualArmor = 100;
Tamable = true;
ControlSlots = 4;
MinTameSkill = 115.0;
switch ( Utility.Random( 3 ) )
{
case 0:
{
BodyValue = 116;
ItemID = 16039;
break;
}
case 1:
{
BodyValue = 178;
ItemID = 16041;
break;
}
case 2:
{
BodyValue = 179;
ItemID = 16055;
break;
}
}
PackItem( new SulfurousAsh( Utility.RandomMinMax( 3, 5 ) ) );
}
public override void GenerateLoot()
{
AddLoot( LootPack.Rich );
AddLoot( LootPack.LowScrolls );
AddLoot( LootPack.Potions );
// if ( 0.2 > Utility.RandomDouble() )
//PackItem( new SpiritOfTheRealms() );
}
public override int GetAngerSound()
{
if ( !Controlled )
return 0x16A;
return base.GetAngerSound();
}
public override bool HasBreath{ get{ return true; } } // fire breath enabled
public override int Meat{ get{ return 5; } }
public override int Hides{ get{ return 10; } }
public override HideType HideType{ get{ return HideType.Barbed; } }
public override FoodType FavoriteFood{ get{ return FoodType.Meat; } }
public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
//public override Poison HitPoison{ get{ return Poison.Lethal; } }
public override int BreathFireDamage{ get{ return 0; } }
public override int BreathColdDamage{ get{ return 100; } }
public override int BreathEffectHue{ get{ return 0x480; } }
//public override double WeaponAbilityChance{ get{ return 0.9; } }
public override Poison HitPoison{ get{ return (0.8 >= Utility.RandomDouble() ? Poison.Greater : Poison.Deadly); } }
public PhantomSteed( Serial serial ) : base( serial )
{
}
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();
if ( BaseSoundID == 0x16A )
BaseSoundID = 0xA8;
}
}
}

Erica- 03-28-2007
Damn it lol hehe tryed a few other things and still not saving the hues . Think i'll give up.
ArteGordon- 03-28-2007
You could always just try reinstating the hue during deserialization.
Something like this at the end of the Deserialize method

CODE
if(Rider != null) { Hue = blue; } else {
Hue = ethy;
}

Also note that HueMod doesnt get serialized/deserialized, so if you wanted it to keep the value of
HueMod = 16385;
you would have to reassign that during deserialization as well.
Erica- 03-28-2007
Yea your right it spawned was not tamed rebooted server and did stay ethy color before it would be blue when rebooted that code you give me worked then i tamed it got on it and rebooted and when i got off it it stayed blue so the ethy color didnt save.
Now to figure out how to make it save when mounted.
Erica- 03-28-2007

QUOTE (ArteGordon @ March 28, 2007 06:28 am)
You could always just try reinstating the hue during deserialization. Something like this at the end of the Deserialize method

CODE
if(Rider != null) { Hue = blue; } else {
Hue = ethy;
}

Also note that HueMod doesnt get serialized/deserialized, so if you wanted it to keep the value of
HueMod = 16385;
you would have to reassign that during deserialization as well.
Figured it out all i had to put was this

CODE
if(Rider == null) HueMod = 16385;

and tested it now it works the way i want it to work.
Erica- 03-28-2007
hmm ok can skrink it stable it mount it be blue on mount be ethy save world reboot when its shrunk saves all that and when stable saves it all now if your mounted on it and save world reboot when you get off it stays blue on or off so the problem now is when you save world when mounted on it this what i got so far that fixed the other issues that just said

CODE
using System; using Server; using Server.Items; using Server.Mobiles; namespace Server.Mobiles
{
[CorpseName( "a phantom steed corpse" )]
public class PhantomSteed : BaseMount
{
public override WeaponAbility GetWeaponAbility()
{
switch ( Utility.Random( 10 ) )
{
default: return null;
case 0: return WeaponAbility.MortalStrike;
case 1: return WeaponAbility.BleedAttack;
}
}
[Constructable]
public PhantomSteed() : this( "a phantom steed" )
{
}
[Constructable]
public PhantomSteed( string name ) : base( name, 0x74, 0x3EA7, AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
BaseSoundID = 0xA8;
Hue = 2972;
HueMod = 16385;
SetStr( 700, 715 );
SetDex( 350, 405 );
SetInt( 350, 475 );
SetHits( 650, 670 );
SetDamage( 30, 35 );
SetDamageType( ResistanceType.Physical, 65 );
SetDamageType( ResistanceType.Fire, 45 );
SetDamageType( ResistanceType.Cold, 40 );
SetDamageType( ResistanceType.Poison, 30 );
SetDamageType( ResistanceType.Energy, 45 );
SetResistance( ResistanceType.Physical, 70 );
SetResistance( ResistanceType.Fire, 65 );
SetResistance( ResistanceType.Cold, 50 );
SetResistance( ResistanceType.Poison, 50 );
SetResistance( ResistanceType.Energy, 45 );
SetSkill( SkillName.EvalInt, 120.0, 130.0 );
SetSkill( SkillName.Magery, 100.0, 120.0 );
SetSkill( SkillName.MagicResist, 109.0, 115.0 );
SetSkill( SkillName.Tactics, 115.0, 125.0 );
SetSkill( SkillName.Wrestling, 100.0, 105.0 );
SetSkill( SkillName.Meditation, 110.0, 120.0 );
SetSkill( SkillName.Anatomy, 175.0, 200.0 );
Fame = 14000;
Karma = -14000;
VirtualArmor = 100;
Tamable = true;
ControlSlots = 4;
MinTameSkill = 115.0;
switch ( Utility.Random( 3 ) )
{
case 0:
{
BodyValue = 116;
ItemID = 16039;
break;
}
case 1:
{
BodyValue = 178;
ItemID = 16041;
break;
}
case 2:
{
BodyValue = 179;
ItemID = 16055;
break;
}
}
PackItem( new SulfurousAsh( Utility.RandomMinMax( 3, 5 ) ) );
}
public override void GenerateLoot()
{
AddLoot( LootPack.Rich );
AddLoot( LootPack.LowScrolls );
AddLoot( LootPack.Potions );
// if ( 0.2 > Utility.RandomDouble() )
//PackItem( new SpiritOfTheRealms() );
}
public override int GetAngerSound()
{
if ( !Controlled )
return 0x16A;
return base.GetAngerSound();
}
public override bool HasBreath{ get{ return true; } } // fire breath enabled
public override int Meat{ get{ return 5; } }
public override int Hides{ get{ return 10; } }
public override HideType HideType{ get{ return HideType.Barbed; } }
public override FoodType FavoriteFood{ get{ return FoodType.Meat; } }
public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
//public override Poison HitPoison{ get{ return Poison.Lethal; } }
public override int BreathFireDamage{ get{ return 0; } }
public override int BreathColdDamage{ get{ return 100; } }
public override int BreathEffectHue{ get{ return 0x480; } }
//public override double WeaponAbilityChance{ get{ return 0.9; } }
public override Poison HitPoison{ get{ return (0.8 >= Utility.RandomDouble() ? Poison.Greater : Poison.Deadly); } }
public PhantomSteed( Serial serial ) : base( serial )
{
}
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();
if(Rider == null)
HueMod = 16385;
}
}
}

As you see in code i added that fixed those issues but now is when you stay mounted .

CODE
if(Rider == null) HueMod = 16385;

Erica- 03-28-2007
I give up omg this script its been more than a year with this little glitch i am going to leave it alone looks like ill never ever get this to save hue mod lol.
ArteGordon- 03-29-2007
have you tried just restoring the HueMod on deser?

CODE
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); HueMod = 16385;
}

Erica- 03-29-2007

QUOTE (ArteGordon @ March 29, 2007 02:08 am)
have you tried just restoring the HueMod on deser?

CODE
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); HueMod = 16385;
}

Wow i am so blind it worked when im mounted shrinking and unshrinking did what you said.

CODE
using System; using Server; using Server.Items; using Server.Mobiles; namespace Server.Mobiles
{
[CorpseName( "a phantom steed corpse" )]
public class PhantomSteed : BaseMount
{
public override WeaponAbility GetWeaponAbility()
{
switch ( Utility.Random( 10 ) )
{
default: return null;
case 0: return WeaponAbility.MortalStrike;
case 1: return WeaponAbility.BleedAttack;
}
}
[Constructable]
public PhantomSteed() : this( "a phantom steed" )
{
}
[Constructable]
public PhantomSteed( string name ) : base( name, 0x74, 0x3EA7, AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
BaseSoundID = 0xA8;
Hue = 2972;
HueMod = 16385;
SetStr( 700, 715 );
SetDex( 350, 405 );
SetInt( 350, 475 );
SetHits( 650, 670 );
SetDamage( 30, 35 );
SetDamageType( ResistanceType.Physical, 65 );
SetDamageType( ResistanceType.Fire, 45 );
SetDamageType( ResistanceType.Cold, 40 );
SetDamageType( ResistanceType.Poison, 30 );
SetDamageType( ResistanceType.Energy, 45 );
SetResistance( ResistanceType.Physical, 70 );
SetResistance( ResistanceType.Fire, 65 );
SetResistance( ResistanceType.Cold, 50 );
SetResistance( ResistanceType.Poison, 50 );
SetResistance( ResistanceType.Energy, 45 );
SetSkill( SkillName.EvalInt, 120.0, 130.0 );
SetSkill( SkillName.Magery, 100.0, 120.0 );
SetSkill( SkillName.MagicResist, 109.0, 115.0 );
SetSkill( SkillName.Tactics, 115.0, 125.0 );
SetSkill( SkillName.Wrestling, 100.0, 105.0 );
SetSkill( SkillName.Meditation, 110.0, 120.0 );
SetSkill( SkillName.Anatomy, 175.0, 200.0 );
Fame = 14000;
Karma = -14000;
VirtualArmor = 100;
Tamable = true;
ControlSlots = 4;
MinTameSkill = 115.0;
switch ( Utility.Random( 3 ) )
{
case 0:
{
BodyValue = 116;
ItemID = 16039;
break;
}
case 1:
{
BodyValue = 178;
ItemID = 16041;
break;
}
case 2:
{
BodyValue = 179;
ItemID = 16055;
break;
}
}
PackItem( new SulfurousAsh( Utility.RandomMinMax( 3, 5 ) ) );
}
public override void GenerateLoot()
{
AddLoot( LootPack.Rich );
AddLoot( LootPack.LowScrolls );
AddLoot( LootPack.Potions );
// if ( 0.2 > Utility.RandomDouble() )
//PackItem( new SpiritOfTheRealms() );
}
public override int GetAngerSound()
{
if ( !Controlled )
return 0x16A;
return base.GetAngerSound();
}
public override bool HasBreath{ get{ return true; } } // fire breath enabled
public override int Meat{ get{ return 5; } }
public override int Hides{ get{ return 10; } }
public override HideType HideType{ get{ return HideType.Barbed; } }
public override FoodType FavoriteFood{ get{ return FoodType.Meat; } }
public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
//public override Poison HitPoison{ get{ return Poison.Lethal; } }
public override int BreathFireDamage{ get{ return 0; } }
public override int BreathColdDamage{ get{ return 100; } }
public override int BreathEffectHue{ get{ return 0x480; } }
//public override double WeaponAbilityChance{ get{ return 0.9; } }
public override Poison HitPoison{ get{ return (0.8 >= Utility.RandomDouble() ? Poison.Greater : Poison.Deadly); } }
public PhantomSteed( Serial serial ) : base( serial )
{
}
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();
//if(Rider == null)
HueMod = 16385;
}
}
}

Thank You all i had to do is take off the

CODE
if(Rider == null)

and works.