Hello!

I am planning on creating a couple of custom races with some simples bonus, like +5 in luck or + 10% in weapon damage, etc., that would be attach to a player.

Before diving into this, I want to know what's the best way to do this, since I'm new to ServUO (and in coding in general).

I have a some ideas :

Creating an "invisible" armor piece that would act like a "skin" and store all the attributes.
Find a way to store the attributes directly into the playermobile.
Just script the all thing from the ground.

Do you know a better way to do this?
 
XmlSpawner (XmlAttachments that is) would be a good way to go with this. Lots of tutorials about it, but it is uniquely suited to this type of simple "attachment" to the player.
 
XmlAttachment is still the best way to do it, and I dit it! Thank you.

I added this to the GetValue in AOS.cs, after creating an attachment :

Code:
if (m is PlayerMobile)
            {
                XmlClasse vm = (XmlClasse)XmlAttach.FindAttachment(m, typeof(XmlClasse));

                switch (attribute)
                {
                    case AosAttribute.Luck:
                        {
                            if (vm != null)
                                value += vm.Luck;
                            break;
                        }
                    case AosAttribute.LowerRegCost:
                        {
                            if (vm != null)
                                value += vm.LowerRegCost;
                            break;
                        }
                }

And for now it works. I just have to refresh the Character Status.
 
Back