Changing Starting Character Templates

beatniche

Citizen
I've gone through my charactercreation.cs and made changes to the starting skills for new characters. Unfortunately, some of the templates are starting with the correct skill values and some are starting with no skill values at all. I've included what I think is the relevant code below. I'm not certain what the error might be. Templates I've tested that I know are working correctly based on the code below are Warrior and Mage and Blacksmith. The Necromancer, Ninja, Samurai, and Paladin are all starting with 0 skill values, despite the changes I made.

Code:
private static bool ValidSkills(SkillNameValue[] skills)
        {
            int total = 0;
 
            for (int i = 0; i < skills.Length; ++i)
            {
                if (skills[i].Value < 0 || skills[i].Value > 50)
                    return false;
 
                total += skills[i].Value;
 
                for (int j = i + 1; j < skills.Length; ++j)
                {
                    if (skills[j].Value > 0 && skills[j].Name == skills[i].Name)
                        return false;
                }
            }
 
            return (total == 100 || total == 120);
        }
 
        private static void SetSkills(Mobile m, SkillNameValue[] skills, int prof)
        {
            switch ( prof )
            {
                case 1: // Warrior
                    {
                        skills = new SkillNameValue[]
                        {
                            new SkillNameValue(SkillName.Anatomy, 60),
                            new SkillNameValue(SkillName.Healing, 50),
                            new SkillNameValue(SkillName.Swords, 80),
                            new SkillNameValue(SkillName.Tactics, 70),
                new SkillNameValue(SkillName.Lumberjacking, 50)
                        };
 
                        break;
                    }
                case 2: // Magician
                    {
                        skills = new SkillNameValue[]
                        {
                            new SkillNameValue(SkillName.EvalInt, 50),
                            new SkillNameValue(SkillName.Wrestling, 70),
                            new SkillNameValue(SkillName.Magery, 80),
                            new SkillNameValue(SkillName.Meditation, 50),
                new SkillNameValue(SkillName.Inscribe, 60)
                        };
 
                        break;
                    }
                case 3: // Blacksmith
                    {
                        skills = new SkillNameValue[]
                        {
                            new SkillNameValue(SkillName.Mining, 80),
                            new SkillNameValue(SkillName.ArmsLore, 50),
                            new SkillNameValue(SkillName.Blacksmith, 70),
                            new SkillNameValue(SkillName.Tinkering, 60),
                new SkillNameValue(SkillName.Magery, 50)
                        };
 
                        break;
                    }
                case 4: // Necromancer
                    {
                        skills = new SkillNameValue[]
                        {
                            new SkillNameValue(SkillName.Necromancy, 80),
                            new SkillNameValue(SkillName.Alchemy, 50),
                            new SkillNameValue(SkillName.SpiritSpeak, 70),
                            new SkillNameValue(SkillName.Swords, 60),
                            new SkillNameValue(SkillName.Tactics, 50)
                        };
 
                        break;
                    }
                case 5: // Paladin
                    {
                        skills = new SkillNameValue[]
                        {
                            new SkillNameValue(SkillName.Chivalry, 80),
                            new SkillNameValue(SkillName.Swords, 70),
                            new SkillNameValue(SkillName.Focus, 50),
                            new SkillNameValue(SkillName.Tactics, 60),
                new SkillNameValue(SkillName.Parry, 50)
                        };
 
                        break;
                    }
                case 6:    //Samurai
                    {
                        skills = new SkillNameValue[]
                        {
                            new SkillNameValue(SkillName.Bushido, 80),
                            new SkillNameValue(SkillName.Swords, 70),
                            new SkillNameValue(SkillName.Anatomy, 60),
                            new SkillNameValue(SkillName.Healing, 50),
                new SkillNameValue(SkillName.Parry, 50)
                        };
                        break;
                    }
                case 7:    //Ninja
                    {
                        skills = new SkillNameValue[]
                        {
                            new SkillNameValue(SkillName.Ninjitsu, 80),
                            new SkillNameValue(SkillName.Hiding, 60),
                            new SkillNameValue(SkillName.Fencing, 50),
                            new SkillNameValue(SkillName.Stealth, 70),
                new SkillNameValue(SkillName.Poisoning, 50)
                        };
                        break;
                    }
                default:
                    {
                        if (!ValidSkills(skills))
                            return;
 
                        break;
                    }
            }

Any help would be appreciated.
 

RoninGT

Citizen
The problem good sir is this bit of code here

Code:
if (addSkillItems)
			{
				for (int i = 0; i < skills.Length; ++i)
				{
					SkillNameValue snv = skills[i];
 
 
 
 
					if (snv.Value > 0 && (snv.Name != SkillName.Stealth || prof == 7) && snv.Name != SkillName.RemoveTrap && snv.Name != SkillName.Spellweaving)
					{
						Skill skill = m.Skills[snv.Name];
 
 
 
 
						if (skill != null)
						{
							skill.BaseFixedPoint = snv.Value * 10;
							AddSkillItems(snv.Name, m);
						}
					}
				}
			}

When it should be

Code:
for (int i = 0; i < skills.Length; ++i)
{
SkillNameValue snv = skills[i];
 
 
 
 
if (snv.Value > 0 && (snv.Name != SkillName.Stealth || prof == 7) && snv.Name != SkillName.RemoveTrap && snv.Name != SkillName.Spellweaving)
{
Skill skill = m.Skills[snv.Name];
 
 
 
 
if (skill != null)
{
skill.BaseFixedPoint = snv.Value * 10;
 
if ( addSkillItems )
AddSkillItems(snv.Name, m);
}
				}
			}

the "if (addSkillItems )" is being called before you add skills since necro and so on dont start with skill items its also not giving the character the skills. I have update the file and will push it to the source ASAP. Ty for letting us know.

RoninGT
 

Ziru

Citizen
this changes is already on the source?


i have this on my charactercreation:

Code:
 for (int i = 0; i < skills.Length; ++i)
{
SkillNameValue snv = skills[i];
 
if (snv.Value > 0 && (snv.Name != SkillName.Stealth || prof == 7) && snv.Name != SkillName.RemoveTrap && snv.Name != SkillName.Spellweaving)
{
Skill skill = m.Skills[snv.Name];
 
if (skill != null)
{
skill.BaseFixedPoint = snv.Value * 10;
 
if ( addSkillItems )
AddSkillItems(snv.Name, m);
}
				}
			}
		}
and new characters have 0 skill.