HalfMercy2
Initiate
For ServUO server, 10/30/18 downloaded
I don't claim credit for the base script but I last used it July 2016, so I no longer remember where I may have picked it up from. I was in the habit of using pre-existing scripts from RunUO and trying to tweak them as a way of learning.
This script is simply for boots that enable the wearer to run on foot at the same speed as they would if mounted. That part works fine. But what has never worked, not in 2016 and not today, is logging in with a character already wearing the boots and being able to run at mount speed right away. Instead, the boots need to be unequipped and then re-equipped before they start working. Can someone help me troubleshoot and fix?
Speedboots.cs
---------------------
I don't claim credit for the base script but I last used it July 2016, so I no longer remember where I may have picked it up from. I was in the habit of using pre-existing scripts from RunUO and trying to tweak them as a way of learning.
This script is simply for boots that enable the wearer to run on foot at the same speed as they would if mounted. That part works fine. But what has never worked, not in 2016 and not today, is logging in with a character already wearing the boots and being able to run at mount speed right away. Instead, the boots need to be unequipped and then re-equipped before they start working. Can someone help me troubleshoot and fix?
Speedboots.cs
---------------------
Code:
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Gumps;
using Server.Network;
using System.Collections;
namespace Server.Items
{
[FlipableAttribute(0x170b, 0x170c)]
public class Speedboots : BaseShoes
{
private bool b_SpeedIncrease = true;
[CommandProperty(AccessLevel.GameMaster)]
public bool SpeedIncrease { get { return b_SpeedIncrease; } set { b_SpeedIncrease = value; InvalidateProperties(); } }
[Constructable]
public Speedboots() : base(0x170b)
{
Weight = 1.0;
Hue = 0x501;
Name = "Boots of Speed";
Layer = Layer.Shoes;
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if(SpeedIncrease)
list.Add(1070809);
}
public override bool OnEquip(Mobile from)
{
base.OnEquip(from);
if(SpeedIncrease)
{
PlayerMobile pm = from as PlayerMobile;
pm.Send(SpeedControl.MountSpeed);
}
return true;
}
private static void World_Login( LoginEventArgs args )
{
if ( args.Mobile != null )
{
Item item = args.Mobile.FindItemOnLayer( Layer.Shoes );
if( item != null )
{
if(item is Speedboots && ((Speedboots)item).SpeedIncrease)
args.Mobile.Send(SpeedControl.MountSpeed);
}
}
}
public override void OnRemoved(object parent)
{
base.OnRemoved(parent);
Mobile from;
from = parent as Mobile;
PlayerMobile pm = from as PlayerMobile;
if (parent is Mobile)
{
from = parent as Mobile;
pm.Send(SpeedControl.Disable);
}
}
public Speedboots(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();
}
}
}
Last edited: