Dvinn wrote: Thank you! I don't know how you guys are so smart, but thank you.
Its because people like Thomas teach us as we go
You're on the right track with the function, but the reason the correct skills aren't improving is that get_weapon_prof() is NOT returning a skill number, it returns how good (proficient) they are in a skill.
You'll probably find that the code is actually improving a spell. Anyway, here is a copy/paste of the existing snippet to return the skill instead.
Code:
int get_weapon_skillnumber(struct char_data *ch, struct obj_data *wield)
{
/* Mobs default to Swords - maybe make a SKILL_BARE_HAND skill? */
if (IS_NPC(ch))
return (SKILL_WEAPON_SWORDS);
/* Prevent crashes if no weapon exists! */
if (!wield)
return (SKILL_WEAPON_SWORDS);
value = GET_OBJ_VAL(wield, 3) + TYPE_HIT;
switch (value) {
case TYPE_SLASH:
return (SKILL_WEAPON_SWORDS);
break;
case TYPE_STING:
case TYPE_PIERCE:
case TYPE_STAB:
return (SKILL_WEAPON_DAGGERS);
break;
case TYPE_THRASH:
case TYPE_WHIP:
return (SKILL_WEAPON_WHIPS);
break;
case TYPE_CLAW:
return (SKILL_WEAPON_TALONOUS_ARMS);
break;
case TYPE_BLUDGEON:
case TYPE_MAUL:
case TYPE_POUND:
case TYPE_CRUSH:
return (SKILL_WEAPON_BLUDGEONS);
break;
case TYPE_HIT:
case TYPE_PUNCH:
case TYPE_BITE:
case TYPE_BLAST:
return (SKILL_WEAPON_EXOTICS);
break;
default:
return (SKILL_WEAPON_SWORDS);
break;
}
}
Then use the new function with the following call:
Code:
improve_skill(ch, get_weapon_skillnumber(ch, wielded));
I haven't compiled or tested this so there might be a couple of typos to fix up but hopefully you get the gist of it