Ixtabay

Member
I want to give players fastest possible movement speed while dead, then take it away once they res. Anyone already doing this or know the best way to achieve this?

Thanks,
Ix
 
I assume that changing the ghost's movement rate (which is exactly the same as an unmounted player) would require modifying the client.

But what about adding a mount? Have you tried adding a 'ghostly steed' to the dead player? (And don't allow the player to dismount!)
 
Doesn't speedboost only update your actual speed (client side) once you log out and back in?
 
from.Send( SpeedControl.Disable );
from.Send( SpeedControl.MountSpeed );

look in Handlers.cs, in private static void SpeedBoost_OnCommand( CommandEventArgs e )
 
I think there may be another way. Joeku's AutoSpeedBooster does this without having to change core. Perhaps someone more adept can offer a way to modify this script to automatically add ASB on death and remove it on res.

Code:
/**************************************
*Script Name: Automatic Speed Booster
*Author: Joeku
*For use with RunUO 2.0 RC2
*Client Tested with: 6.0.9.1
*Version: 1.00
*Initial Release: 08/06/08
*Revision Date: 08/06/08
**************************************/

using System;
using Server;
using Server.Accounting;
using Server.Commands;

namespace Joeku.ASB
{
	public class ASB_Main
	{
		public const int Version = 100; // Script version (do not change)
		public static AccessLevel HasAccess; // Who has access to the ASB? Mirrors that of the SpeedBoost command (default Counselor)
		public static bool Initialized = false; // Has the script been initialized yet? (activated upon first player login)
		public static bool Running = true; // Is the script active? (deactivates if SpeedBoost command is not found)

		public static void Initialize()
		{
			EventSink.Login += new LoginEventHandler(EventSink_OnLogin);
		}

		// Cannot fully initialize until shard is completely loaded, due to conflicts with the CommandSystem
		public static void Start()
		{
			CommandEntry entry = CommandSystem.Entries["SpeedBoost"]; // Find the SpeedBoost CommandEntry
			if( entry != null ) //  The SpeedBoost command exists...
			{
				HasAccess = entry.AccessLevel; // Set the access to the system to the AccessLevel required to use the SpeedBoost command
				CommandSystem.Register("AutoSpeedBooster", HasAccess, new CommandEventHandler(EventSink_OnCommand)); // Register the ASB command in the CommandSystem
				HelpInfo.FillTable(); // Refresh the HelpInfo dictionary to include the ASB command
				Initialized = true; // The script has now been initialized
			}
			else // The SpeedBoost command does not exist...
				Running = false; // Deactivate the script
		}

		public static void EventSink_OnLogin(LoginEventArgs e)
		{
			if( !Running ) // The script has been deactivated
				return;

			if( !Initialized ) // The script has not yet been initialized...
				Start(); // Initialize the script

			e.Mobile.SendMessage(String.Empty); // Skip a line
			if( e.Mobile.AccessLevel >= HasAccess ) // Does the player have access to the ASB?
			{
				if( GetASB(e.Mobile) ) // The player's ASB is enabled (default)...
				{
					CommandSystem.Handle(e.Mobile, String.Format("{0}SpeedBoost", CommandSystem.Prefix)); // Force the player to invoke the SpeedBoost command
					e.Mobile.SendMessage("Automatic speed boost is enabled for this account. To disable it, use the \"AutoSpeedBooster\" command.");
				}
				else // The player's ASB is disabled
					e.Mobile.SendMessage("Automatic speed boost is disabled for this account. To enable it, use the \"AutoSpeedBooster\" command.");
			}
			e.Mobile.SendMessage(String.Empty); // Skip a line
		}

		[Usage( "AutoSpeedBooster [true|false]" )]
		[Description( "Toggles automatic speed boost upon login for the invoker." )]
		public static void EventSink_OnCommand(CommandEventArgs e)
		{
			if( e.Length == 1 ) // There is one argument present...
			{
				if( Insensitive.Equals(e.Arguments[0], "true") ) // The argument is "true"...
					SetASB(e.Mobile, true); // Enable the player's ASB
				else if( Insensitive.Equals(e.Arguments[0], "false") ) // The argument is "false"...
					SetASB(e.Mobile, false); // Disable the player's ASB
				else // The argument is not a boolean value...
					e.Mobile.SendMessage("Format: AutoSpeedBooster [true|false]");
			}
			else if( e.Length > 1 ) // There is more than one argument present...
				e.Mobile.SendMessage("Format: AutoSpeedBooster [true|false]");
			else // There are no arguments present
				SetASB(e.Mobile, !GetASB(e.Mobile)); // Toggle the player's SpeedBooster
		}

		public static bool GetASB(Mobile mob){ return GetASB((Account)mob.Account); }
		public static bool GetASB(Account acc)
		{
			if( acc.GetTag("ASB") != null ) // Since the account has a SpeedBooster tag, the player's ASB has been disabled
				return false;
			return true;
		}

		public static void SetASB(Mobile mob, bool set)
		{
			Account acc = (Account)mob.Account;

			if( set ) // Enable the player's ASB...
			{
				acc.RemoveTag("ASB"); // Remove any ASB tags the player's account might have
				mob.SendMessage("Automatic speed boost has been enabled for this account.");
			}
			else // Disable the player's ASB...
			{
				acc.SetTag("ASB", "Automatic speed boost has been disabled for this account."); // Add an ASB tag to the player's account
				mob.SendMessage("Automatic speed boost has been disabled for this account.");
			}
		}
	}
}
 
  • Like
Reactions: Cad
You don't need to change it in the core.
Look where i indicated it, the script you posted just refers to what i posted earlier.
the script basically do:
CommandSystem.Handle(e.Mobile, String.Format("{0}SpeedBoost", CommandSystem.Prefix));
which meanbs the player is forced to execute the commad on login: [SpeedBoost

And yea, you can do a login/out check if the person is dead and add a speedboost flag on him.

Then in the onressurection or whatever there is for this in playermobile, just set back speed to disable.
 
Last edited:
you could use an eventsink in a separate file to check a player's death

public static void Initialize()
{
EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);​
}

private static void EventSink_Death(PlayerDeathEventArgs e)
{
if ( e.Mobile != null )
{
if (e.Mobile.Alive)
return;​
}
e.Mobile.Send( SpeedControl.MountSpeed );​
}
 
Ok, so this serves to change speed on death, but is there an event for res, something like EventSink_Res? I need to return to normal speed on res, also need to check on login if player is dead.

Almost there! thanks everyone for helping me out

Code:
// SpeedyGhost v1.0 code thanks to zerodowned
// Sets player speed to mount speed upon death
using System;
using Server;
using Server.Accounting;
using Server.Commands;

namespace Ixtabay.SpeedyGhost
{
    public class SpeedyGhost_Main
    {
        public static void Initialize()
        {
            EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);
        }
        private static void EventSink_Death(PlayerDeathEventArgs e)
        {
            if (e.Mobile != null)
            {
                if (e.Mobile.Alive)
                    return;
            }
            CommandSystem.Handle(e.Mobile, String.Format("{0}SpeedBoost", CommandSystem.Prefix));
            //e.Mobile.Send(SpeedControl.MountSpeed);
        }
    }
}
 
Code:
public static void Initialize()
{
EventSink.LoginEvents += new LoginEventHandler(EventSink_Login);	//verify this line, it's probably wrong.
}
public static void EventSink_OnLogin(LoginEventArgs e)
{
if (e.Mobile != null)
{
if (!e.Mobile.Alive)
e.Mobile.Send(SpeedControl.MountSpeed);
}
}
also in the last code you posted, place the:
CommandSystem.Handle(e.Mobile, String.Format("{0}SpeedBoost", CommandSystem.Prefix));

under: if (e.Mobile.Alive)
and modify: if (e.Mobile.Alive)
for if (!e.Mobile.Alive)

otherwise you can end up with a null e.Mobile, and use it in the command handle thing.

could even do hax and only do:
Code:
if (e.Mobile == null)
return;
if (e.Mobile.Alive)
return;

CommandSystem.Handle(e.Mobile, String.Format("{0}SpeedBoost", CommandSystem.Prefix));
//e.Mobile.Send(SpeedControl.MountSpeed);

Also keep in mind that the command you do:
CommandSystem.Handle(e.Mobile, String.Format("{0}SpeedBoost", CommandSystem.Prefix));

will be checked like if a normal player say [speedboost, it will just not work, as they require accesslevel.
So consider using:
e.Mobile.Send(SpeedControl.MountSpeed);

Why did you leave it commented? It did not work?
 
Last edited:
Going to leave this here for now. Works when player dies or logs in as a ghost, but stays on after res. I could not find event for res. Also, movement is not as smooth as when logged in as staff, there must he some other forces trying to prevent speeding by non-staff. I still have much to learn, but will leave this here in case it helps someone else.
Code:
// SpeedyGhost v1.0 code thanks to zerodowned and PoOka
// Sets player speed to mount speed upon death
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
using Server.Accounting;
using Server.Commands;

namespace Ixtabay.SpeedyGhost
{
    public class SpeedyGhost_Main
    {
        public static void Initialize()
        {
            EventSink.PlayerDeath += new PlayerDeathEventHandler(EventSink_Death);
        }
        private static void EventSink_Death(PlayerDeathEventArgs e)
        {
            if (e.Mobile != null)
            {
                if (!e.Mobile.Alive)
                    e.Mobile.Send(SpeedControl.MountSpeed);
            }
        }
        public static void EventSink_OnLogin(LoginEventArgs e)
        {
            if (e.Mobile != null)
            {
                if (!e.Mobile.Alive)
                    e.Mobile.Send(SpeedControl.MountSpeed);
            }
        }
    }
}
 
public virtual bool UsesFastwalkPrevention{ get{ return ( AccessLevel < AccessLevel.Counselor ); } }

in playermobile.cs,
change it to something like:

Code:
public virtual bool UsesFastwalkPrevention
{
	get
	{
		if (Alive)
			return ( AccessLevel < AccessLevel.Counselor );
		else
			return false;
	}
}

edit:
ressurect in playermobile.cs:
Code:
public override void Resurrect()
{
	//add the remove mount speed effect here.
	bool wasAlive = this.Alive;
	base.Resurrect();
}
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back