Kamras
Member
So I have those shroud that permits gargoyles to ride mounts, it temporarily through bodymod makes you kind of human so the graphic doesn't get messed up, and life is good. Now when the player removes the shroud they return to their usual self, this is good. But the problem is.. If the player logs out while wearing this shroud, the system removes the bodymod upon login and they are glitched (no graphic for mounted gargoyle).
So the solution Im looking for is to force the shroud to be unequipped upon login if detected on layer. However I've never seen any code like that and im kind of stumped of where to start. Here is my working script, please let me know what you guys think on this..
So the solution Im looking for is to force the shroud to be unequipped upon login if detected on layer. However I've never seen any code like that and im kind of stumped of where to start. Here is my working script, please let me know what you guys think on this..
Code:
using System;
using Server.Network;
using Server.Mobiles;
namespace Server.Items
{
[Flipable(0x2684, 0x2683)]
public class ShroudOfTheEternalSteed : BaseOuterTorso
{
public override bool IsArtifact { get { return true; } }
[Constructable]
public ShroudOfTheEternalSteed()
: base(0x2684)
{
Name = "Shroud of the Eternal Steed";
Hue = 1967;
Weight = 0;
LootType = LootType.Blessed;
}
public ShroudOfTheEternalSteed(Serial serial)
: base(serial)
{
}
public override bool OnEquip( Mobile from )
{
Effects.SendTargetEffect(from, 0x3709, 32);
Effects.SendTargetEffect(from, 0x376A, 32);
from.LocalOverheadMessage(MessageType.Regular, 0x59, true, "You feel like you could ride anything..");
from.PlaySound(0x208);
from.BodyMod = 400;
return base.OnEquip( from );
}
public override void OnRemoved(object parent)
{
if (parent is Mobile)
{
Mobile m = (Mobile)parent;
Effects.SendTargetEffect(m, 0x3709, 32);
m.LocalOverheadMessage(MessageType.Regular, 0x59, true, "You spread your wings..");
m.PlaySound(0x208);
IMount mount = m.Mount;
if ( mount != null )
mount.Rider = null;
if (m.BodyMod == 0x190)
{
m.BodyMod = 0;
}
else
{
base.OnRemoved(parent);
}
}
}
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();
}
}
}