1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Auto Sheathe Weapon 1.4.0

Automatically sheathes or unsheathes player's weapon when they change warmode.

  1. Felladrin

    This is an automatic system to make characters sheathe their weapons when they change from war to peace mode. It will also reequip their last used weapon when they get back to war mode.


    You can put this into your shard in 2 easy steps:

    1. Drop this script somewhere in your Scripts folder.

    2. Open PlayerMobile.cs and find:
    Code (C#):
    1. public override void OnWarmodeChanged()
    2. {
    3.     if (!Warmode)
    4.     {
    5.         Timer.DelayCall(TimeSpan.FromSeconds(10), new TimerCallback(RecoverAmmo));
    6.     }
    7. }
    There, you just need to add the function Felladrin.Automations.AutoSheatheWeapon.From(this). Now your method should look like this:
    Code (C#):
    1. public override void OnWarmodeChanged()
    2. {
    3.     Felladrin.Automations.AutoSheatheWeapon.From(this);
    5.     if (!Warmode)
    6.     {
    7.         Timer.DelayCall(TimeSpan.FromSeconds(10), new TimerCallback(RecoverAmmo));
    8.     }
    9. }

    You can configure the items that should not be unequiped when changing warmode. By default, the system will keep all kind of shields, lights and spellbooks. You can easily add or remove type of items to keep equiped on the top of the script:
    Code (C#):
    1. static Type[] ItemTypesToKeepEquiped = {
    2.     typeof(BaseShield),
    3.     typeof(BaseLight),
    4.     typeof(Spellbook)
    5. };
    You can also enable or disable some features at the top of the script:
    Code (C#):
    1. bool Enabled = true;                // Is this system enabled?
    2. bool SendOverheadMessage = true;    // Should we send a overhead message to the player about the auto-sheathe?
    3. bool AllowPlayerToggle = true;      // Should we allow player to use a command to toggle the auto-sheathe?