well, a long time ago I made an "improve_skill" function.. :P anyways..
here it is.. and this time it says the skill instead of the # of skill..
void improve_skill(struct char_data *ch, int skill)
{
extern char *spells[];
int percent = GET_SKILL(ch, skill);
int newpercent;
char skillbuf[MAX_STRING_LENGTH];
if (number(1, 200) > GET_WIS(ch) + GET_INT(ch))
return;
if (percent >= 97 || percent <= 0)
return;
newpercent = number(1, 3);
percent += newpercent;
SET_SKILL(ch, skill, percent);
if (newpercent >= 4) {
sprintf(skillbuf, "You feel your skill in %s improving.", spells[skill]);
send_to_char(skillbuf, ch);
}
}
Chuckle.. I know it seems like a long time, but here is a fix for my old
improve_skill function.. before when your skill went up it would say "You
feel your skill in 62 improving" instead of "You feel your skill in
<whatever 62 is> improving".. put the code in fight.c, then in
act.offensive.c, put a "void improve_skill(struct char_data *ch, int skill);"
at the top, then in anything you want to be improved on success..
<randomly> put a "improve_skill(ch, SKILL_x);" on the line below the
successful part of the code.. i.e.
in bash: "improve_skill(ch, SKILL_BASH);" and then when you got bash off,
it would check the random, etc.. if you got it, it would set your skill
1-3 points higher.. and say "You feel your skill in bash improving."
- Nashak
also, someone asked about how to restrict classes to certain races, here
it is: <give credit to Daniel Koepke also, he gave me the code, but I
changed it> ps... this only works if you select race BEFORE you select
class...
-=-=-=-=-=-=-=-=-=-
interpreter.c
-=-=-=-=-=-=-=-=-=-
Search for:
int Valid_Name(char *newname);
Below it, add:
int class_ok_race[NUM_RACES][NUM_CLASSES];
extern char *class_display[];
Search for:
int parse_class(char arg);
Change to:
int parse_class(struct char_data *ch, char arg);
Search for:
int is_abbrev(char *arg1, char *arg2)
{
if (!*arg1)
return 0;
for (; *arg1 && *arg2; arg1++, arg2++)
if (LOWER(*arg1) != LOWER(*arg2))
return 0;
if (!*arg1)
return 1;
else
return 0;
}
Below it, add:
void display_classes(struct descriptor_data *d) {
int x;
send_to_char("Class selection menu - please choose a class\r\n--------------------\r\n", d->character);
for (x = 0; x < NUM_CLASSES; x++)
if (class_ok_race[(int)GET_RACE(ch)][x]])
send_to_char(class_display[x], d->character);
send_to_char("\nClass: ", d->character);
}
Search for:
SEND_TO_Q(class_menu, d);
SEND_TO_Q("Class: ", d);
Change to:
display_classes(d);
Search for:
load_result = parse_class(*arg);
Change to:
load_result = parse_class(d->character, *arg);
-=-=-=-=-=-=-=-=-=-
class.c
-=-=-=-=-=-=-=-=-=-
Search for:
#include "interpreter.h"
Below it, add:
char *class_display[NUM_CLASSES] = {
"a) Sorcerer\r\n",
"b) Cleric\r\n",
"c) Thief\r\n",
"d) Warrior\r\n"
};
Search for:
const char *pc_class_types[] = {
"Sorcerer",
"Cleric",
"Thief",
"Warrior",
"\n"
};
Below it, add:
#define Y TRUE
#define N FALSE
int class_ok_race[NUM_RACES][NUM_CLASSES] = {
/* S, C, T, W */
/* Human */ { Y, Y, Y, Y },
/* Elf */ { Y, Y, Y, N },
/* Gnome */ { Y, Y, N, Y },
/* Dwarf */ { N, Y, N, Y }
};
Search for:
int parse_class(char arg) {
.....
}
Change to:
int parse_class(struct char_data *ch, char arg) {
int class = CLASS_UNDEFINED;
switch (LOWER(arg)) {
case 'a': class = CLASS_MAGIC_USER; break;
case 'b': class = CLASS_CLERIC ; break;
case 'c': class = CLASS_THIEF ; break;
case 'd': class = CLASS_WARRIOR ; break;
default : class = CLASS_UNDEFINED ; break;
}
if (class >= 0 && class < NUM_CLASSES)
if (!class_ok_race[(int)GET_RACE(ch)][class])
class = CLASS_UNDEFINED;
return (class);
}
Search for:
long find_class_bitvector(char arg)
{
arg = LOWER(arg);
switch (arg) {
case 'm': <--- Change to: case 'a':
return (1 << 0);
break;
case 'c': <--- Change to: case 'b':
return (1 << 1);
break;
case 't': <--- Change to: case 'c':
return (1 << 2);
break;
case 'w': <--- Change to: case 'd':
return (1 << 3);
break;
default:
return 0;
break;
}
}
-=-=-=-=-=-=-=-=-=-
act.wizard.c
-=-=-=-=-=-=-=-=-=-
Search for:
int parse_class(char arg);
Change to:
int parse_class(struct char_data *ch, char arg);
Search for:
if ((i = parse_class(*val_arg)) == CLASS_UNDEFINED) {
Change to:
if ((i = parse_class(vict, *val_arg)) == CLASS_UNDEFINED) {
That's all you need. Simple, eh? Hope this helps... - Nashak
|-\ \ / /
\ \ \ /<
\ \-| / \
..... asha .....
bmw@efn.org
mud.penguin.net
4000
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST