Welcome to the Builder Academy

Question Improving a weapon proficiency

More
14 Jan 2017 20:38 - 14 Jan 2017 20:39 #6529 by Dvinn
To do it the way Liko was saying, by just creating a function to use the weapon type to attach to the improve skill, could I just do a
Code:
improve_skill(ch, get_weapon_prof(ch, wielded));
?? It seems to compile, but it isn't improving the actual skill. What am I missing?
Last edit: 14 Jan 2017 20:39 by Dvinn.

Please Log in or Create an account to join the conversation.

More
14 Jan 2017 21:53 #6531 by WhiskyTest

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 :D

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
The following user(s) said Thank You: Dvinn

Please Log in or Create an account to join the conversation.

More
15 Jan 2017 07:34 #6534 by Dvinn
Thank you, worked perfectly. Thanks for putting your effort and time into this for me, I learned a lot!

Please Log in or Create an account to join the conversation.

Time to create page: 0.183 seconds