ServUO Version
Publish Unknown
Ultima Expansion
High Seas
Hi, first of all, I'm not an English speaker, so please excuse my poor English.

I'm using a shard with some edits to the script, and since it's not a shard I built myself, I need help with a malfunction in the code.

In this shard, new code added for exp and levels in \Scripts\Customs\BaseCreature.cs.

Below code is normally works fine, but only when playing in a party does it not give me any exp points and does not display any messages.
                                if ( !Controlled && !Summoned && Alive && ds.m_Mobile is PlayerMobile )
                                    PlayerMobile pm = ((PlayerMobile)ds.m_Mobile);
                                    pm.StackI = 0;
                                    int multipler = 750-(pm.PoELevel*5); SoulPower *= multipler;
                                    int getexp = SoulPower/(pm.PoELevel*pm.PoELevel);
                                    int needexp = (pm.PoELevel*pm.PoELevel)+(30*pm.PoELevel);

                                    if ( getexp > (needexp/3) ) { getexp = (needexp/3); }
                                    if ( getexp > 0 && pm.PoEEXP < 2100000000)
                                        pm.PoEEXP += getexp;
                                        int percent = 0;
                                        if ( (needexp-pm.PoEEXP) > 0 ){
                                        percent = getexp * 100 / needexp;
                                        ds.m_Mobile.SendMessage("You have gained {0} exp. [{1}%]", getexp, percent );

                                        if ( pm.PoEEXP >= needexp && pm.PoELevel < 99 )
                                            pm.PoEEXP -= needexp;
                                            pm.PoELevel += 1;
I'm not very good at coding, but I don't think party play would prevent the if statement from being satisfied.

What am I overlooking? I desperately need some help.

I also have another class that stores, fetches, and prints exp and levels, but that part always works fine.

Thank you in advance.

ServUO Version : 0.5 build 7344.36207
Hi there !

I thought I would try to help :)

I see you are running ServUO 0.5 build 7344.36207. I'm currently working on ServUO pub58, so our BaseCreature.cs files are kinda different. I haven't been able to spot out where exactly you want to place/modify your code above.

So let's try to get back to the basics. What's a DamageStore ?
You are using a ds.m_Mobile as a reference to distribute the XP reward points. It seems to work when you are alone, but when in a party, there's only 1 (or none ?) player that gets the XP.

A DamageStore is this :
public class DamageStore : IComparable
        public Mobile m_Mobile;
        public int m_Damage;
        public bool m_HasRight;

        public DamageStore(Mobile m, int damage)
            m_Mobile = m;
            m_Damage = damage;

        public int CompareTo(object obj)
            DamageStore ds = (DamageStore)obj;

            return ds.m_Damage - m_Damage;
That's the Class. You have a Mobile, an m_Damage and an m_HasRight public variables.
You can link damage done by a mobile.
And you can compare it with other objects.

But technically, you are not really sending the message, nor giving the XP, to the whole group. Just to one player/party member who hit the mob you were fighting.

You'll need a loop for that. You'll need to go through all the players in your group, or all the players having the right to loot the mob, to give them the reward XP.

Let's try it this way. I may be totally wrong as I just have a couple lines of your whole BaseCreature.cs, but let's try :)
Also, I've changed a few lines, so I could read them more easily.
Watch out though : there are integer variables you are using, but you assign them with equations that include a division. Integer are usually numbers without decimals. Not a big thing, but I'm surprised it was working with integers :p

var toGive = new List<Mobile>();
var rights = GetLootingRights();
for (int i = rights.Count - 1; i >= 0; --i)
    var partyMembers = rights[i];

    if (ds.m_HasRight && InRange(ds.m_Mobile, 100) && ds.m_Mobile.Map == Map)

if (toGive.Count == 0)

for (int i = 0; i < toGive.Count; i++)
    Mobile m = toGive[i];

    if (!(m is PlayerMobile))
    if (!Controlled && !Summoned && m?.Alive)
        m.StackI = 0;
        var multipler = 750-(m?.PoELevel*5);
        SoulPower *= multipler;
        var getexp = SoulPower/(m?.PoELevel*m?.PoELevel);
        var needexp = (m?.PoELevel*m?.PoELevel)+(30*m?.PoELevel);

        if (getexp > needexp/3)
            getexp = needexp/3;

        if (getexp > 0 && m?.PoEEXP < 2100000000)
            m.PoEEXP += getexp;
            var percent = 0;
            if (needexp-m?.PoEEXP > 0)
                percent = getexp * 100 / needexp;
            m?.SendMessage("You have gained {0} exp. [{1}%]", getexp, percent );

            if (m?.PoEEXP >= needexp && m?.PoELevel < 99)
                m.PoEEXP -= needexp;
                m.PoELevel += 1;

PS: this code was 100% inspired by Champion Spawn scripts ^_^
Last edited: