ServUO Version
Publish Unknown
Ultima Expansion
Stygian Abyss
Ok this might be a simple question. I have a custom stat in my custom player mobile Charisma in my titles.cs I have added a way to gain Charisma when karma is awarded my question is I have it as greater than or equal to value but I kind of dont want that I just want it so that once it hits that value or above it but below the next level it only gains once. otherwise I think it will gain everytime you award karma. Yes brain fart it is probably pretty simple just can't think of it right at this moment here is just a cut down section of awardkarma code with gains in it.

awadrkarma:
        public static void AwardKarma( Mobile m, int offset, bool message )
        {
            GPlayerMobile gp = m as GPlayerMobile;

            if ( m.Karma >= 1249 )
            {
                gp.Charisma += 10;
            }
            else if ( m.Karma >= 2499 )
            {
                gp.Charisma += 10;
            }
        }
 
Thats times 10 your not understanding what I mean. Once you hit a karma level of positive karma 1249 you gain 10 points of Charisma. and you don't gain any more points of Charisma until you hit 2499 points of positive karma. The way I have it you will gain every time you gain 10 points of Charisma every time you gain karma in between the two levels of karma.
 
I do understand, if the idea is to only have 10 char until 2499 than be at 20 char, than the code I provided does that, since we know the level between the char is 1250, we divide the karma by 1250, which is 1 at 1250 and 2 at 2500, which you times that to 10, gets you 10 and 20 respectfully!
 
No players have set charisma could be 50 could be 30 could be 70 to start and it could go up or down depending on karma gain or loss. you gain +10 charisma in the range of 1249-2499 and another +10 in the range of 2500-4999 and so on like the karmaentry for titles and loose -10 for negative just didnt include entire code just posted example. I am looking for a range example instead of <= how do i get the 1249-2499 in a range.
 
I thought Wilson had it. Maybe you can clarify a bit more? From what I'm understanding, your system is: characters start with some amount of charisma (30, 50, 70, etc). At 1249 karma, you want +10 charisma. At 2499 karma, you want +10 charisma. You want this +10 charisma only on these thresholds, but no gains in between and no gains during regular karma gains. You also want it to go up or down depending on karma gain or loss when outside of this range. If this is correct, this may work:

C#:
public static void AwardKarma(Mobile m, int offset, bool message)
{
    GPlayerMobile gp = m as GPlayerMobile;

    if (gp != null)
    {
        // Calculate the previous karma threshold before the gain
        int previousThreshold = (m.Karma - offset) / 1250;
        
        // Calculate the new karma threshold after the gain
        int newThreshold = m.Karma / 1250;

        // Check if we've crossed a threshold with this karma gain
        if (newThreshold > previousThreshold)
        {
            gp.Charisma += 10;
            
            if (message)
            {
                m.SendMessage("Your charisma has increased due to your actions!");
            }
        }
        else if (newThreshold < previousThreshold) // Check if we've gone down a threshold
        {
            gp.Charisma -= 10;
            
            if (message)
            {
                m.SendMessage("Your charisma has decreased due to your actions!");
            }
        }
    }
}
 
OK see I never knew about thresholds. I will give that a try. something new I have learned. sounds like what I am looking for or close to it. Right now I just have it as == because I dont think it needs to land directly on the amount of karma to trigger just pass over it like the fameentry and karmaentry titles " example Honored" havent tested though. The idea behind Charisma is buying and selling items talking to npcs you get different reactions depending on Charisma like in D&D also hiring servants tamed animals also react differently according to charisma if have a low charisma some tamed creatures it takes more time to bond.
 
Just a thought: why not just use the Karma value itself, instead of creating a "Charisma" stat that is basically some form of Karma points?
 
Did Constitution also for max hits and regen rates. added proficiencies weapon and non weapon adds so much more flavor to the game. weapon specializations all sorts of goodies from D&D.
Just a thought: why not just use the Karma value itself, instead of creating a "Charisma" stat that is basically some form of Karma points?
Well Charisma is different from karma it acts as a way of interacting with the world its not how the outcome of your actions as Karma is known. Your karma affects your Charisma as others see you but Charisma is how your presented to others its not just karma kind of hard to explain. I want players to be able to gain Charisma in other ways also than just gaining karma also through tomes and acts and quests like in D&D.
 
Back