I have a shard running on RunUO version 2.1
We discovered a problem with a piece of equipment I made for our shard.
The problem is:
The item adds some Skill Mods when equipped but if the server goes down or if the server is rebooted then the Mods stay on the player but they no longer get removed when the equipment is removed and they no longer get added when they are equipped.
I suspect the problem is a result of the item not being Serialized Deserialized for the Mods but that is just my guess.
So ..
1) If this is the cause . . does anyone know how to properly Serialized Deserialized the item for the Mods?
2) If this is not the cause . . does anyone know how I can fix it?
3) Also . . is there a way for me to allow the item's Skill Mods exceed the player's skill cap?
Any help I can get on this would be very much appreciated.
Here is the scrip I am using:
Many Thanks
We discovered a problem with a piece of equipment I made for our shard.
The problem is:
The item adds some Skill Mods when equipped but if the server goes down or if the server is rebooted then the Mods stay on the player but they no longer get removed when the equipment is removed and they no longer get added when they are equipped.
I suspect the problem is a result of the item not being Serialized Deserialized for the Mods but that is just my guess.
So ..
1) If this is the cause . . does anyone know how to properly Serialized Deserialized the item for the Mods?
2) If this is not the cause . . does anyone know how I can fix it?
3) Also . . is there a way for me to allow the item's Skill Mods exceed the player's skill cap?
Any help I can get on this would be very much appreciated.
Here is the scrip I am using:
Code:
using System;
namespace Server.Items
{
public class SampireChest : StuddedChest
{
private SkillMod m_SkillMod0;
private SkillMod m_SkillMod1;
private SkillMod m_SkillMod2;
public override int ArtifactRarity{ get{ return 16; } }
public override int BasePhysicalResistance{ get{ return 13; } }
public override int BaseFireResistance{ get{ return 13; } }
public override int BaseColdResistance{ get{ return 13; } }
public override int BasePoisonResistance{ get{ return 13; } }
public override int BaseEnergyResistance{ get{ return 13; } }
public override int InitMinHits{ get{ return 255; } }
public override int InitMaxHits{ get{ return 255; } }
[Constructable]
public SampireChest()
{
Name = "<BASEFONT COLOR=#01FD0E>Draugr Tunic";
Hue = 1361;
Attributes.BonusStr = 7;
Attributes.BonusHits = 7;
Attributes.BonusDex = 5;
Attributes.BonusStam = 5;
Attributes.DefendChance = 5;
Attributes.ReflectPhysical = 5;
ArmorAttributes.DurabilityBonus = 100;
this.HitPoints = this.MaxHitPoints = 255;
DefineMods();
}
private void DefineMods()
{
m_SkillMod0 = new DefaultSkillMod( SkillName.Bushido, true, 5 );
m_SkillMod1 = new DefaultSkillMod( SkillName.Necromancy, true, 5 );
m_SkillMod2 = new DefaultSkillMod( SkillName.Swords, true, 5 );
}
private void SetMods( Mobile wearer )
{
wearer.AddSkillMod( m_SkillMod0 );
wearer.AddSkillMod( m_SkillMod1 );
wearer.AddSkillMod( m_SkillMod2 );
}
public override bool OnEquip( Mobile from )
{
SetMods( from );
return true;
}
public override void OnRemoved( object parent )
{
if ( parent is Mobile )
{
Mobile m = (Mobile)parent;
m.RemoveStatMod("SampireChest");
if ( m_SkillMod0 != null )
m_SkillMod0.Remove();
if ( m_SkillMod1 != null )
m_SkillMod1.Remove();
if ( m_SkillMod2 != null )
m_SkillMod2.Remove();
if ( m.Hits > m.HitsMax )
m.Hits = m.HitsMax;
}
}
public SampireChest(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadEncodedInt();
}
}
}
Many Thanks