|
Proficiency System [by Chuck Reed] |
|
|
|
Posted Wednesday, August 12th @ 11:34:14 PM, by George Greer in the Players dept.
Added Jul 6, 1998. Click the link below to read it or download it.
From: Chuck Reed <creed@I-55.COM>
Subject: Proficiency
Here's the small backbone of my proficiency system. It basicly implements
the ability to store profficiencies, but doesn't actually implement any.
They are used similarly to skills, but are learned (in my mud at least) by
special trainers in the land. If you can't read the code and understand
it, I'd probably suggest not using it. However, it QUITE simple and should
be no prob. They do have a few examples of proficiencies coded in, but
very few.
STEP 1
------
Add these two files in your src directory:
/*****************************************************************
** File: Prof.c Usage: Handles the new profeciency system **
** By Chuck Reed - Ash of Dark Horizon **
** Email: ash@dh.gator.net **
*****************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "spells.h"
#include "comm.h"
#include "interpreter.h"
#include "prof.h"
#include "db.h"
extern struct room_data *world;
extern const char *dirs[];
int check_prof(struct char_data *ch, int num)
{
int i;
for(i=0;i <= MAX_PROFS;i++)
if(GET_PROF(ch, i) == num)
return TRUE;
return FALSE;
}
int learn_prof(struct char_data *ch, int num)
{
int i;
for(i=0;i <= MAX_PROFS;i++)
if(GET_PROF(ch, i) == num) {
send_to_char("You already know how to do that!\r\n", ch);
return FALSE;
}
if(GET_PROF_SLOTS(ch) > 0) {
for(i=0;i <= MAX_PROFS;i++)
if(GET_PROF(ch, i) == 0) {
GET_PROF(ch, i) = num;
return TRUE;
}
/* A check to see if someone slipped by and got too many prof slots. */
send_to_char("You have learned the maximum amount of proficiencies you
can.\r\n", ch);
return FALSE;
}
else
send_to_char("You aren't able to learn another proficiency at the
moment.\r\n", ch);
return FALSE;
}
void check_sense_danger(struct char_data *ch)
{
int door;
for (door = 0; door < NUM_OF_DIRS; door++)
if (EXIT(ch, door) && EXIT(ch, door)->to_room != NOWHERE &&
IS_SET(ROOM_FLAGS(EXIT(ch, door)->to_room), ROOM_TRAP)) {
if(number(1, 20) <= GET_WIS(ch)) {
sprintf(buf, "\\c01You sense danger %s from here!\\c00\r\n",
dirs[door]);
send_to_char(buf, ch);
}
}
}
const char *prof_name[] = {
"Swimming",
"Blind Fighting",
"Ambidexterity",
"Endurance",
"First Aid",
"Sense Danger"
};
*************************************************************************
NEXT FILE
*************************************************************************
/*****************************************************************
** File: Prof.h Usage: Defines for the profeciency system **
** By Chuck Reed - Ash of Dark Horizon **
** Email: ash@dh.gator.net **
*****************************************************************/
#define GET_PROF(ch, i) ((ch)->player_specials->saved.proficiencies[i])
#define GET_PROF_SLOTS(ch) ((ch)->player_specials->saved.prof_slots)
/* Here's the list of proficiencies you can have, change to fit your needs */
#define PROF_SWIMMING 0
#define PROF_BLIND_FIGHTING 1
#define PROF_AMBIDEXTERITY 2
#define PROF_ENDURANCE 3
#define PROF_FIRST_AID 4
#define PROF_SENSE_DANGER 5
STEP 2
------
Add these variables to structs.h:
You'll have to add a new one in player_specials_saved (this means pwipe
with binary) called
int proficiencies[MAX_PROFS];
and then add it again in char_player_data.
You'll need to define MAX_PROFS as well. Just stick this line in structs.h
near some MAX_XXX defines
#define MAX_PROFS 40 /* Change 40 to fit your needs */
STEP 3
------
Edit your makefile adding to your objfiles
prof.o
somewhere in the list.
Also, you must add this to the bottom of the file as well:
prof.o : prof.c prof.h structs.h
$(CC) -c $(CFLAGS) prof.c
^^^^^^^^
this space must be a <TAB>
That should be all you need to get you started. I hope this helps you out
with what you want.
Chuck
<< Practice Command Organized [by Frollo] | Reply | View as text | Threaded | Proposal For New Player Structs [by Jaco] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|