Andronama

Member
Hey everyone.

Alright, usually I don't have any problems pumping out content or debugging things but this damn weapon is driving me up the wall.

Basically, I made a "whip" from scratch as a BaseWeapon. Set the ItemID 3520 (Fishing Pole). Well, I set the weapon abilities to Paralyzing Blow and Armor Ignore but it's still coming up with the usual Disarm, ParaBlow where you can't use the abilities.
I've tried a couple different things and still to no avail. I've tried making the base some other weapon like a Broadsword, I've tweaked it as a BaseWeapon, and still nothing.

public override WeaponAbility.PrimaryAbility{ get{ return WeaponAbility.ParalyzingBlow; } }

public override WeaponAbility.SecondaryAbility{ get{ return WeaponAbility.ArmorIgnore; } }

That's the code I'm using....anything I should change? Add?

Maybe I'm just making some simple mistake here but if anyone has any recommendations or can point me in the right direction to fix this, that would be awesome. So far, there are no compiling errors, the abilities just don't show up.
Thanks!
 
I believe you want to set it as something other than baseweapon like basesword, or copy code from basesword into your new weapon script
 
Alright, trying that out now. Will let you know the results upon completion of testing.

Nope, changing it to BaseSword or something else didn't fix it. Tried a couple others things as well.


Going to try one more thing then if that doesn't work, would you mind if I sent my script to you by chance? Just for a quick glance over to see if I'm just making some simple mistake somewhere but missing it.
 
Last edited:
yeah i ran into this a while back (when i was reworking weapons) and i couldn't for the life of me figure this one out. if i have some time this weekend i will also give a crack to find a solution! because i would be very interested in this!
 
Im not 100% on this (not home to test) but if I remember correctly the client actually handles the special abilities based on the item id. You have to modify one of the client files to change the weapon abilities. The overrides for weapon ability dont actually do anything any longer and they have just never been removed.

Ill verify this when i got home and look up the client file.
 
Im not 100% on this (not home to test) but if I remember correctly the client actually handles the special abilities based on the item id. You have to modify one of the client files to change the weapon abilities. The overrides for weapon ability dont actually do anything any longer and they have just never been removed.

Ill verify this when i got home and look up the client file.
dang i hope not!! :( i was thinking it was more hardcoded in the client but i really hope it isnt...
 
You have to modify one of the client files to change the weapon abilities. The overrides for weapon ability dont actually do anything any longer and they have just never been removed.

Seems reasonable...kind of what I've been seeing. What started as making a simple mob has turned into hell haha.
Let me know what you find...very curious to see if this can be confirmed.
 
i suppose it wouldnt be too bad, all you'd have to do is give people a client patch. i did want to change some weapons abilities. so i guess its better then nothing!!
 
Im not 100% on this (not home to test) but if I remember correctly the client actually handles the special abilities based on the item id. You have to modify one of the client files to change the weapon abilities. The overrides for weapon ability dont actually do anything any longer and they have just never been removed.

Ill verify this when i got home and look up the client file.
That might be correct. I've never messed around with it, I know you change the skill a weapon uses so why not abilities? strange
 
after combing through the 4 pages of posts on the first link i found three scripts for the system that cannot be downloaded anymore


Code:
using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Items;

namespace Server
{
    public static class CustomWeaponAbilities
    {
        public static void Initialize()
        {
            EventSink.Login += new LoginEventHandler( EventSink_Login );
        }
       
        private static void EventSink_Login( LoginEventArgs args )
        {
            Mobile from = args.Mobile;
           
            if ( from != null )
            {
                Check(from);
            }
        }
       
        public static void Check(Mobile from)
        {
            BaseWeapon weapon = (BaseWeapon)(from.Weapon);
            Check(weapon,from);
        }
       
        public static void Check(BaseWeapon weapon, Mobile from)
        {
            from.CloseGump(typeof(SpecialAttackGump));
           
            int abilities=0;
           
            if ( from != null )
            {
                abilities=HasAbilities( weapon, from);
               
                if(abilities>0)
                {
                    from.SendGump(new SpecialAttackGump( weapon, from, abilities ));
                }
            }
        }
       
        private static int HasAbilities(BaseWeapon weapon, Mobile from)
        {
            int number = 0;
           
            if(weapon.PrimaryAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 70.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 70.0 ))
                {
                    number++;
                }
            }
           
            if(weapon.SecondaryAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 120.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 120.0 ))
                {
                    number++;
                }
            }
            if(weapon.ThirdAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 170.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 170.0 ))
                {
                    number++;
                }
            }
            if(weapon.FourthAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 210.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 210.0 ))
                {
                    number++;
                }
            }
            if(weapon.FifthAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 240.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 240.0 ))
                {
                    number++;
                }
            }
           
            return number;
        }
       
        public static bool ServerSideSetAbility(Mobile from, int index)
        {
            if ( index == 0 )
                WeaponAbility.ClearCurrentAbility( from );
            else if ( index >= 1 && index < WeaponAbility.Abilities.Length )
            {
                if(WeaponAbility.SetCurrentAbility( from, WeaponAbility.Abilities[index] ))
                    return true;
            }
            return false;
        }
       
        public static void SetAbilities(BaseWeapon weapon, ref int Primary, ref int Secondary, ref int Third, ref int Fourth, ref int Fifth)
        {
            WeaponAbility prim = weapon.PrimaryAbility;
            WeaponAbility second = weapon.SecondaryAbility;
            WeaponAbility third = weapon.ThirdAbility;
            WeaponAbility forth = weapon.FourthAbility;
            WeaponAbility fifth = weapon.FifthAbility;
           
            for(int i=0;i<WeaponAbility.Abilities.Length;i++)
            {
                WeaponAbility index = WeaponAbility.Abilities[i];
                if(index!=null)
                {
                    if(prim == index)Primary=i;
                    if(second == index)Secondary=i;
                    if(third == index)Third=i;
                    if(forth == index)Fourth=i;
                    if(fifth == index)Fifth=i;
                }
            }
        }
    }
}

Code:
using System;
using Server;
using Server.Gumps;
using Server.Items;
using Server.Network;

namespace Server.Gumps
{
    public class SpecialAttackGump : Gump
    {
        private BaseWeapon m_weapon;
       
        public int Abilities;
       
        private int Primary;
        private int Secondary;
        private int Third;
        private int Forth;
        private int Fifth;
       
private int PrimaryIcon {get{return Primary<32?0x51FF+Primary:WeaponAbility.Abilities[Primary].CustomGump;}}
private int SecondaryIcon {get{return  Secondary<32?0x51FF+Secondary:WeaponAbility.Abilities[Secondary].CustomGump;}}
private int ThirdIcon {get{return  Third<32?0x51FF+Third:WeaponAbility.Abilities[Third].CustomGump;}}
private int ForthIcon {get{return  Forth<32?0x51FF+Forth:WeaponAbility.Abilities[Forth].CustomGump;}}
private int FifthIcon {get{return  Fifth<32?0x51FF+Fifth:WeaponAbility.Abilities[Fifth].CustomGump;}}
       
        private int PrimaryState = 9781;
        private int SecondaryState = 9781;
        private int ThirdState = 9781;
        private int ForthState = 9781;
        private int FifthState = 9781;
       
        public SpecialAttackGump(BaseWeapon weapon, Mobile from,int abilities): base( 0, 0 )
        {
            m_weapon = weapon;
            Abilities = abilities;
            InitializeGump();
        }

        public SpecialAttackGump(BaseWeapon weapon, Mobile from, int abilities, int primary, int secondary): this( weapon, from, abilities, primary, secondary, 9781, 9781, 9781) {}
        public SpecialAttackGump(BaseWeapon weapon, Mobile from, int abilities, int primary, int secondary, int third, int Forth, int fifth): base( 0, 0 )
        {
            m_weapon = weapon;
            Abilities = abilities;
            PrimaryState = primary;
            SecondaryState = secondary;
            ThirdState = third;
            ForthState = Forth;
            FifthState = fifth;
            InitializeGump();
        }

        private void InitializeGump()
        {
            Closable=false;
            Disposable=true;
            Dragable=true;
            Resizable=false;
           
            AddButton(841,  490, 0x082D, 0x082D, 0, GumpButtonType.Reply, 0);
           
            CustomWeaponAbilities.SetAbilities(m_weapon, ref Primary, ref Secondary, ref Third, ref Forth, ref Fifth);

            AddButton(841,  509, PrimaryIcon, PrimaryIcon, 1, GumpButtonType.Reply, 0);
            AddImage(807,  509, PrimaryState);
           
            if(Abilities >= 2)
            {
                AddButton(841, 550, SecondaryIcon, SecondaryIcon, 2, GumpButtonType.Reply, 0);
                AddImage(807, 550, SecondaryState);
            }
            if(Abilities >= 3)
            {
                AddButton(841, 591, ThirdIcon, ThirdIcon, 3, GumpButtonType.Reply, 0);
                AddImage(807, 591, ThirdState);
            }
            if(Abilities >= 4)
            {
                AddButton(841, 632, ForthIcon, ForthIcon, 4, GumpButtonType.Reply, 0);
                AddImage(807, 632, ForthState);
            }
            if(Abilities >= 5)
            {
                AddButton(841, 673, FifthIcon, FifthIcon, 5, GumpButtonType.Reply, 0);
                AddImage(807, 673, FifthState);
            }
        }
       
        public override void OnResponse( NetState sender, RelayInfo info )
        {
            int idx = info.ButtonID;
            if(idx==0) sender.Mobile.CloseGump(typeof(SpecialAttackGump));
            if(idx==1)
            {
                if(PrimaryState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Primary))
                    {
                        PrimaryState=9780;
                        SecondaryState=9781;
                        ThirdState=9781;
                        ForthState=9781;
                        FifthState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                }
                else
                {
                    PrimaryState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
            if(idx==2)
            {
                if(SecondaryState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Secondary))
                    {
                        SecondaryState=9780;
                        PrimaryState=9781;
                        ThirdState=9781;
                        ForthState=9781;
                        FifthState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                }
                else
                {
                    SecondaryState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
            if(idx==3)
            {
                if(ThirdState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Third))
                    {
                        ThirdState=9780;
                        SecondaryState=9781;
                        PrimaryState=9781;
                        ForthState=9781;
                        FifthState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                   
                }
                else
                {
                    ThirdState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
            if(idx==4)
            {
                if(ForthState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Forth))
                    {
                        ForthState=9780;
                        SecondaryState=9781;
                        PrimaryState=9781;
                        ThirdState=9781;
                        FifthState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                }
                else
                {
                    ForthState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
            if(idx==5)
            {
                if(FifthState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Fifth))
                    {
                        FifthState=9780;
                        SecondaryState=9781;
                        PrimaryState=9781;
                        ForthState=9781;
                        ThirdState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                }
                else
                {
                    FifthState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
        }
    }
}

Code:
// By LordGreyWolf

using System;
using Server;
using Server.Gumps;

namespace Server.Commands
{
    public class SpecialAttackCommands
    {
        public static void Initialize()
        {
            CommandSystem.Register( "SetPrimaryAbility", AccessLevel.Player, new CommandEventHandler( SetPrimaryAbility_OnCommand ) );
            CommandSystem.Register( "SetSecondaryAbility", AccessLevel.Player, new CommandEventHandler( SetSecondaryAbility_OnCommand ) );
            CommandSystem.Register( "SetThirdAbility", AccessLevel.Player, new CommandEventHandler( SetThirdAbility_OnCommand ) );
            CommandSystem.Register( "SetFourthAbility", AccessLevel.Player, new CommandEventHandler( SetFourthAbility_OnCommand ) );
            CommandSystem.Register( "SetFifthAbility", AccessLevel.Player, new CommandEventHandler( SetFifthAbility_OnCommand ) );
            CommandSystem.Register( "Set1", AccessLevel.Player, new CommandEventHandler( SetPrimaryAbility_OnCommand ) );
            CommandSystem.Register( "Set2", AccessLevel.Player, new CommandEventHandler( SetSecondaryAbility_OnCommand ) );
            CommandSystem.Register( "Set3", AccessLevel.Player, new CommandEventHandler( SetThirdAbility_OnCommand ) );
            CommandSystem.Register( "Set4", AccessLevel.Player, new CommandEventHandler( SetFourthAbility_OnCommand ) );
            CommandSystem.Register( "Set5", AccessLevel.Player, new CommandEventHandler( SetFifthAbility_OnCommand ) );
        }

        [Usage( "SetPrimaryAbility" )]
        [Aliases( "Set1" )]
        [Description( "Sets your Weapons Primary Ability Active." )]
        private static void SetPrimaryAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            gump.OnResponse(from.NetState,new RelayInfo(1,null,null));
        }

        [Usage( "SetSecondaryAbility" )]
        [Aliases( "Set2" )]
        [Description( "Sets your Weapons Secondary Ability Active." )]
        private static void SetSecondaryAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            if(gump.Abilities<2)return;
            gump.OnResponse(from.NetState,new RelayInfo(2,null,null));
        }

        [Usage( "SetThirdAbility" )]
        [Aliases( "Set3" )]
        [Description( "Sets your Weapons Third Ability Active." )]
        private static void SetThirdAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            if(gump.Abilities<3)return;
            gump.OnResponse(from.NetState,new RelayInfo(3,null,null));
        }

        [Usage( "SetFourthAbility" )]
        [Aliases( "Set4" )]
        [Description( "Sets your Weapons Fourth Ability Active." )]
        private static void SetFourthAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            if(gump.Abilities<4)return;
            gump.OnResponse(from.NetState,new RelayInfo(4,null,null));
        }

        [Usage( "SetFifthAbility" )]
        [Aliases( "Set5" )]
        [Description( "Sets your Weapons Fifth Ability Active." )]
        private static void SetFifthAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            if(gump.Abilities<5)return;
            gump.OnResponse(from.NetState,new RelayInfo(5,null,null));
        }
    }
}
 
This seems to working so far, but it also means that you'd have to disable the existing weapon ability system
this look interesting. i might give it a crack! thank you for taking your time with this!
isnt this just if you want to add more than 2 abilitys basically?
for me that makes it even better! the possibility to add multiple to certain weapons, would make it quite interesting. :)
 
I'll test it out when I have a chance. Thanks a ton for the help! Will let you know how it turns out whenever it's completed.
ALL edits in those posts aren't required for the system to work.
When I get a chance I'll post which ones I used and can confirm are working
 
Of course, if you want special weapon abilities, you could just use the XmlCustomAttacks from XmlSpawner.
 
Last edited:
That might be correct. I've never messed around with it, I know you change the skill a weapon uses so why not abilities? strange

The skill is not hardcoded to the client. The weapon overrides USED to work until the change was made to the client to detect special weapon attacks based on the item id. The overrides were never removed since it was hundreds of weapons that would have to be edited. Notice that the new weapons don't have this override and still function just fine.

I'm trying to do this from old memory, so I may not be correct. From what I remember tho, the animations and special moves are tied together in the client based on the item id. This is why when you try to modify them, the weapon will not do the override specials and often will not even do a swing animation.
 
Of course, if you want special weapon abilities, you could just use the XmlCustomAttacks from XmlSpawner.

Wasn't aware of that attachment, thank you :)
It doesn't naturally support WeaponAbilities, but you could copy of the Ability script to create a new CustomAttack to go with the xml attachment

updated for xmlspawner 3.26c - Zagros

XmlCustomAttacks v1.02
updated 11/29/04
ArteGordon

SUMMARY
This set of attachments provides a system for adding custom special attacks to weapons and defenses to shields including combos that require a series of specific special moves to be executed in a timed sequence. Any number of special moves can be enabled on a given weapon/shield, and combos can be made up of sequences of arbitrary length and complexity.


New to v1.02
updated 11/29/04
- added support for the new XmlSockets system.


INSTALLATION:
for RunUO 2.0

STEP 1:
Install the latest XmlSpawner2 package (must be at least version 2.69. You can find it here XmlSpawner2). Make sure that you perform installation steps 7, 9, and 10 from that thread.

STEP 2:
Place the scripts from this package into your custom scripts directory, or into the XmlAttachments area of your XmlSpawner2 installation. (anywhere in your Scripts folder is fine, these locations are suggested for organizational purposes only).
Place the optional .xml example in the top level of your RunUO installation directory if you would like to try it out.


DESCRIPTION:

This system makes use of the XmlSpawner2 attachment system and the XmlSpawner2 package must be installed to support it. You dont need to use the xmlspawners themselves, and it doesnt matter whether you use the standard distribution spawners or any other spawning system but you do need the XmlSpawner2 package installed.

Because the attachment system neither requires nor makes any changes to serialization/deserializations of any item or mobile, it can be safely added and removed at any time now or in the future without interfering with any other systems that you might have installed.

Note, this is intended as more of a development system for people to add custom content to their shards than a full drop-and-play system with a full complement of attacks and combos. While I have included some attacks and combos in the package, they are largely intended to illustrate its features, and are not necessarily balanced for drop-and-play use (although you could certainly do that if you wanted to). Add, fiddle, and most importantly, have fun.

Features:

When a weapon with this attachment is equipped, a gump containing icons for the special attacks that it has available will be displayed.
Attacks can be selected by pressing one of the attack icons. When selected, the icon will turn red until it is activated by a successful hit.
The description and requirements for an attack can be viewed by pressing the small blue button to the right of the attack selection button.
Secret combination attacks can be unleashed by executing the proper sequence of special moves.

Several special attacks and combos have been added to , but the system can be extended with any number of additional moves.

Examples of included special attacks/combos:

Gift of Health - Restores attacker to full health
Requires - 30 int, 60 Healing
Uses - 40 mana, 20 stamina, 2 ginseng, 2 mandrake, 50 gold.

Puff of Smoke - Makes the attacker invisible
Requires - 40 dex, 50 Stealth, 50 Hiding
Uses - 20 mana, 40 stamina, 2 spiderssilk.

Paralyzing Fear - Paralyzes the target then causes it to flee
Requires - 40 int, 30 Necromancy
Uses - 10 mana, 10 stamina, 5 hits, 10 karma, 1 Head

Thunder Strike - a combo attack activated by the following sequence of custom attacks
TripleSlash + MindDrain + ParalyzingFear + TripleSlash + StamDrain


Customizable special attacks:

- user-definable special attacks can be designed and added to weapons in any combination and number.

- special attacks can be given requirements that include minimum str, dex, int, and skills.

- executing an attack can be defined to consume mana, stamina, hits, karma, and any number and type of reagent.


Customizable combo attacks:

- special combo attacks can be created that are executed when a definable sequence of special attacks has been carried out in the proper order and without interruption.

- The custom attacks gump has an indicator at the top of the gump that signals when a combo sequence has been started and is still in progress. When it goes out, that means that it has been interrupted either due to executing a special move out of sequence, or taking too long between moves.

- Because the end of one combo could be the beginning of another, it is possible to chain multiple combos together.
Combos that share moves can even be executed together for multiple simultaneous combos.


Adding custom attacks to weapons:

Manually to individual weapons

- the custom attacks attachment can be added to weapons in several ways. It can be manually attached to any existing weapon with the "[addatt" command.

For example

"[addatt xmlcustomattacks random 4"

will attach 4 randomly selected custom attacks to a targeted weapon.

"[addatt xmlcustomattacks tartan"

Will add a predefined custom attack configuration that was named "tartan" in the attachment constructor in XmlCustomAttacks.cs

To weapon scripts

- Special attacks can also be added to scripted weapons. See the included script TestCustomWeapon.cs for an example of this.

To spawned weapons

- To add special attacks to spawned weapons use the ATTACH keyword in spawn entries such as this

katana/ATTACH/xmlcustomattacks,random,4

which would spawn a katana with 4 randomly selected custom attacks.

or

orc/ADD/<katana/ATTACH/xmlcustomattacks,random,4>

would spawn an orc carrying the katana with custom attacks.

To try out the included example spawner .xml file, place the file "customattacks.xml" in your top level RunUO directory and execute the command

"[xmlloadhere customattacks.xml"



Adding custom defenses to shields:

Manually to individual shields

- the custom defenses attachment can be added to shields in several ways. It can be manually attached to any existing shield with the "[addatt" command.

For example

"[addatt xmlcustomdefenses random 4"

will attach 4 randomly selected custom defenses to a targeted shield

"[addatt xmlcustomdefenses brogan"

Will add a predefined custom defense configuration that was named "brogan" in the attachment constructor in XmlCustomDefenses.cs

To shield scripts

- Special defenses can also be added to scripted shields. See the included script TestCustomShield.cs for an example of this.

To spawned shields

- To add special defenses to spawned shields use the ATTACH keyword in spawn entries such as this

buckler/ATTACH/xmlcustomdefenses,random,4

which would spawn a buckler with 4 randomly selected custom defenses

or

orc/ADD/<buckler/ATTACH/xmlcustomdefenses,random,4>

would spawn an orc carrying the buckler with custom defenses.

To try out the included example spawner .xml file, place the file "customattacks.xml" in your top level RunUO directory and execute the command

"[xmlloadhere customattacks.xml"
 
hello I have a silly question I looked and looked but no luck unless im looking in the wrong place! Im trying to add Skill Bonuses to say a robe and i tried everything in the xml spawner. Id like to make this a drop off of a MOB! However at this point I dont Script yet but know a way around the XML System butim stuck now :(
 
after combing through the 4 pages of posts on the first link i found three scripts for the system that cannot be downloaded anymore


Code:
using System;
using Server.Gumps;
using Server.Mobiles;
using Server.Items;

namespace Server
{
    public static class CustomWeaponAbilities
    {
        public static void Initialize()
        {
            EventSink.Login += new LoginEventHandler( EventSink_Login );
        }
      
        private static void EventSink_Login( LoginEventArgs args )
        {
            Mobile from = args.Mobile;
          
            if ( from != null )
            {
                Check(from);
            }
        }
      
        public static void Check(Mobile from)
        {
            BaseWeapon weapon = (BaseWeapon)(from.Weapon);
            Check(weapon,from);
        }
      
        public static void Check(BaseWeapon weapon, Mobile from)
        {
            from.CloseGump(typeof(SpecialAttackGump));
          
            int abilities=0;
          
            if ( from != null )
            {
                abilities=HasAbilities( weapon, from);
              
                if(abilities>0)
                {
                    from.SendGump(new SpecialAttackGump( weapon, from, abilities ));
                }
            }
        }
      
        private static int HasAbilities(BaseWeapon weapon, Mobile from)
        {
            int number = 0;
          
            if(weapon.PrimaryAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 70.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 70.0 ))
                {
                    number++;
                }
            }
          
            if(weapon.SecondaryAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 120.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 120.0 ))
                {
                    number++;
                }
            }
            if(weapon.ThirdAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 170.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 170.0 ))
                {
                    number++;
                }
            }
            if(weapon.FourthAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 210.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 210.0 ))
                {
                    number++;
                }
            }
            if(weapon.FifthAbility != null)
            {
                if(from.Skills[weapon.DefSkill].Base >= 240.0 || (from.Skills[weapon.GetUsedSkill(from,true)].Base >= 240.0 ))
                {
                    number++;
                }
            }
          
            return number;
        }
      
        public static bool ServerSideSetAbility(Mobile from, int index)
        {
            if ( index == 0 )
                WeaponAbility.ClearCurrentAbility( from );
            else if ( index >= 1 && index < WeaponAbility.Abilities.Length )
            {
                if(WeaponAbility.SetCurrentAbility( from, WeaponAbility.Abilities[index] ))
                    return true;
            }
            return false;
        }
      
        public static void SetAbilities(BaseWeapon weapon, ref int Primary, ref int Secondary, ref int Third, ref int Fourth, ref int Fifth)
        {
            WeaponAbility prim = weapon.PrimaryAbility;
            WeaponAbility second = weapon.SecondaryAbility;
            WeaponAbility third = weapon.ThirdAbility;
            WeaponAbility forth = weapon.FourthAbility;
            WeaponAbility fifth = weapon.FifthAbility;
          
            for(int i=0;i<WeaponAbility.Abilities.Length;i++)
            {
                WeaponAbility index = WeaponAbility.Abilities[i];
                if(index!=null)
                {
                    if(prim == index)Primary=i;
                    if(second == index)Secondary=i;
                    if(third == index)Third=i;
                    if(forth == index)Fourth=i;
                    if(fifth == index)Fifth=i;
                }
            }
        }
    }
}

Code:
using System;
using Server;
using Server.Gumps;
using Server.Items;
using Server.Network;

namespace Server.Gumps
{
    public class SpecialAttackGump : Gump
    {
        private BaseWeapon m_weapon;
      
        public int Abilities;
      
        private int Primary;
        private int Secondary;
        private int Third;
        private int Forth;
        private int Fifth;
      
private int PrimaryIcon {get{return Primary<32?0x51FF+Primary:WeaponAbility.Abilities[Primary].CustomGump;}}
private int SecondaryIcon {get{return  Secondary<32?0x51FF+Secondary:WeaponAbility.Abilities[Secondary].CustomGump;}}
private int ThirdIcon {get{return  Third<32?0x51FF+Third:WeaponAbility.Abilities[Third].CustomGump;}}
private int ForthIcon {get{return  Forth<32?0x51FF+Forth:WeaponAbility.Abilities[Forth].CustomGump;}}
private int FifthIcon {get{return  Fifth<32?0x51FF+Fifth:WeaponAbility.Abilities[Fifth].CustomGump;}}
      
        private int PrimaryState = 9781;
        private int SecondaryState = 9781;
        private int ThirdState = 9781;
        private int ForthState = 9781;
        private int FifthState = 9781;
      
        public SpecialAttackGump(BaseWeapon weapon, Mobile from,int abilities): base( 0, 0 )
        {
            m_weapon = weapon;
            Abilities = abilities;
            InitializeGump();
        }

        public SpecialAttackGump(BaseWeapon weapon, Mobile from, int abilities, int primary, int secondary): this( weapon, from, abilities, primary, secondary, 9781, 9781, 9781) {}
        public SpecialAttackGump(BaseWeapon weapon, Mobile from, int abilities, int primary, int secondary, int third, int Forth, int fifth): base( 0, 0 )
        {
            m_weapon = weapon;
            Abilities = abilities;
            PrimaryState = primary;
            SecondaryState = secondary;
            ThirdState = third;
            ForthState = Forth;
            FifthState = fifth;
            InitializeGump();
        }

        private void InitializeGump()
        {
            Closable=false;
            Disposable=true;
            Dragable=true;
            Resizable=false;
          
            AddButton(841,  490, 0x082D, 0x082D, 0, GumpButtonType.Reply, 0);
          
            CustomWeaponAbilities.SetAbilities(m_weapon, ref Primary, ref Secondary, ref Third, ref Forth, ref Fifth);

            AddButton(841,  509, PrimaryIcon, PrimaryIcon, 1, GumpButtonType.Reply, 0);
            AddImage(807,  509, PrimaryState);
          
            if(Abilities >= 2)
            {
                AddButton(841, 550, SecondaryIcon, SecondaryIcon, 2, GumpButtonType.Reply, 0);
                AddImage(807, 550, SecondaryState);
            }
            if(Abilities >= 3)
            {
                AddButton(841, 591, ThirdIcon, ThirdIcon, 3, GumpButtonType.Reply, 0);
                AddImage(807, 591, ThirdState);
            }
            if(Abilities >= 4)
            {
                AddButton(841, 632, ForthIcon, ForthIcon, 4, GumpButtonType.Reply, 0);
                AddImage(807, 632, ForthState);
            }
            if(Abilities >= 5)
            {
                AddButton(841, 673, FifthIcon, FifthIcon, 5, GumpButtonType.Reply, 0);
                AddImage(807, 673, FifthState);
            }
        }
      
        public override void OnResponse( NetState sender, RelayInfo info )
        {
            int idx = info.ButtonID;
            if(idx==0) sender.Mobile.CloseGump(typeof(SpecialAttackGump));
            if(idx==1)
            {
                if(PrimaryState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Primary))
                    {
                        PrimaryState=9780;
                        SecondaryState=9781;
                        ThirdState=9781;
                        ForthState=9781;
                        FifthState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                }
                else
                {
                    PrimaryState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
            if(idx==2)
            {
                if(SecondaryState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Secondary))
                    {
                        SecondaryState=9780;
                        PrimaryState=9781;
                        ThirdState=9781;
                        ForthState=9781;
                        FifthState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                }
                else
                {
                    SecondaryState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
            if(idx==3)
            {
                if(ThirdState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Third))
                    {
                        ThirdState=9780;
                        SecondaryState=9781;
                        PrimaryState=9781;
                        ForthState=9781;
                        FifthState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                  
                }
                else
                {
                    ThirdState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
            if(idx==4)
            {
                if(ForthState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Forth))
                    {
                        ForthState=9780;
                        SecondaryState=9781;
                        PrimaryState=9781;
                        ThirdState=9781;
                        FifthState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                }
                else
                {
                    ForthState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
            if(idx==5)
            {
                if(FifthState==9781)
                {
                    if(CustomWeaponAbilities.ServerSideSetAbility(sender.Mobile,Fifth))
                    {
                        FifthState=9780;
                        SecondaryState=9781;
                        PrimaryState=9781;
                        ForthState=9781;
                        ThirdState=9781;
                    }

                    sender.Mobile.CloseGump(typeof(SpecialAttackGump));
                    sender.Mobile.SendGump(new SpecialAttackGump(m_weapon, sender.Mobile, Abilities, PrimaryState, SecondaryState, ThirdState, ForthState, FifthState));
                }
                else
                {
                    FifthState=9781;
                    WeaponAbility.ClearCurrentAbility( sender.Mobile );
                }
            }
        }
    }
}

Code:
// By LordGreyWolf

using System;
using Server;
using Server.Gumps;

namespace Server.Commands
{
    public class SpecialAttackCommands
    {
        public static void Initialize()
        {
            CommandSystem.Register( "SetPrimaryAbility", AccessLevel.Player, new CommandEventHandler( SetPrimaryAbility_OnCommand ) );
            CommandSystem.Register( "SetSecondaryAbility", AccessLevel.Player, new CommandEventHandler( SetSecondaryAbility_OnCommand ) );
            CommandSystem.Register( "SetThirdAbility", AccessLevel.Player, new CommandEventHandler( SetThirdAbility_OnCommand ) );
            CommandSystem.Register( "SetFourthAbility", AccessLevel.Player, new CommandEventHandler( SetFourthAbility_OnCommand ) );
            CommandSystem.Register( "SetFifthAbility", AccessLevel.Player, new CommandEventHandler( SetFifthAbility_OnCommand ) );
            CommandSystem.Register( "Set1", AccessLevel.Player, new CommandEventHandler( SetPrimaryAbility_OnCommand ) );
            CommandSystem.Register( "Set2", AccessLevel.Player, new CommandEventHandler( SetSecondaryAbility_OnCommand ) );
            CommandSystem.Register( "Set3", AccessLevel.Player, new CommandEventHandler( SetThirdAbility_OnCommand ) );
            CommandSystem.Register( "Set4", AccessLevel.Player, new CommandEventHandler( SetFourthAbility_OnCommand ) );
            CommandSystem.Register( "Set5", AccessLevel.Player, new CommandEventHandler( SetFifthAbility_OnCommand ) );
        }

        [Usage( "SetPrimaryAbility" )]
        [Aliases( "Set1" )]
        [Description( "Sets your Weapons Primary Ability Active." )]
        private static void SetPrimaryAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            gump.OnResponse(from.NetState,new RelayInfo(1,null,null));
        }

        [Usage( "SetSecondaryAbility" )]
        [Aliases( "Set2" )]
        [Description( "Sets your Weapons Secondary Ability Active." )]
        private static void SetSecondaryAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            if(gump.Abilities<2)return;
            gump.OnResponse(from.NetState,new RelayInfo(2,null,null));
        }

        [Usage( "SetThirdAbility" )]
        [Aliases( "Set3" )]
        [Description( "Sets your Weapons Third Ability Active." )]
        private static void SetThirdAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            if(gump.Abilities<3)return;
            gump.OnResponse(from.NetState,new RelayInfo(3,null,null));
        }

        [Usage( "SetFourthAbility" )]
        [Aliases( "Set4" )]
        [Description( "Sets your Weapons Fourth Ability Active." )]
        private static void SetFourthAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            if(gump.Abilities<4)return;
            gump.OnResponse(from.NetState,new RelayInfo(4,null,null));
        }

        [Usage( "SetFifthAbility" )]
        [Aliases( "Set5" )]
        [Description( "Sets your Weapons Fifth Ability Active." )]
        private static void SetFifthAbility_OnCommand( CommandEventArgs e )
        {
            Mobile from = e.Mobile;
            if(!from.HasGump(typeof(SpecialAttackGump)))return;
            SpecialAttackGump gump = (SpecialAttackGump)from.FindGump(typeof(SpecialAttackGump));
            if(gump.Abilities<5)return;
            gump.OnResponse(from.NetState,new RelayInfo(5,null,null));
        }
    }
}

Digging up an old thead, but this is really interesting. Thank you for this!

Would you be able to create a command that would display the gump? I tried this script and it works fine, but the gump only shows up when you equip a weapon. Once you close the gump, you have to re-equip the weapon in order to display it again.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back