View Single Post
Old 08-11-2010, 01:15 AM   #1
Redfox
New Member
 
Join Date: Aug 2010
Posts: 2
Redfox is on a distinguished road
Lightbulb Making a new skill with old code

Hello,

I'm new to this forum but I'm gonna start out with a bang, heh. Basically, I'm a novice C++ coder with mere 3 years experience and now I'm goofing with C along side a SMAUG based mud source code. I play a mud in which I've played for several years and have always wanted to code for them. My plan is to make some things to show what I can do and hopefully I can be on the team, *shrugs*, we'll see. So, to the nits and grits. I've located a couple files which contain things similar to what -I- feel are what's needed to tweak to make my skill/class ( WeaponSmith, fyi ) intended; 'act.other.c' and the header files, etc... Next I will post some code that, once again -I-, feel is most similar to what I could use to create an action of smithing a weapon for a class/skill of WeaponSmith. After the code I will post another question which I feel dumb for not knowing but I'm lost pretty much with coding a mud at this point :P

Here is the generic code for the act 'recite' for scrolls and what have we:

void do_recite(struct char_data *ch, char *argument, int cmd)
{
char buf[100];
struct obj_data *scroll, *obj;
struct char_data *victim;
int i, bits;
bool equipped;

equipped = FALSE;
obj = 0;
victim = 0;

argument = one_argument(argument,buf);

if (!(scroll = get_obj_in_list_vis(ch,buf,ch->carrying))) {
scroll = ch->equipment[HOLD];
equipped = TRUE;
if ((scroll==0) || !isname(buf, scroll->name)) {
act("You do not have that item.",FALSE,ch,0,0,TO_CHAR);
return;
}
}

if (scroll->obj_flags.type_flag!=ITEM_SCROLL)
{
act("Recite is normally used for scroll's.",FALSE,ch,0,0,TO_CHAR);
return;
}

if (*argument) {
bits = generic_find(argument, FIND_OBJ_INV | FIND_OBJ_ROOM |
FIND_OBJ_EQUIP | FIND_CHAR_ROOM, ch, &victim, &obj);
if (bits == 0) {
send_to_char("No such thing around to recite the scroll on.\n\r", ch);
return;
}
} else {
victim = ch;
}

act("$n recites $p.", TRUE, ch, scroll, 0, TO_ROOM);
act("You recite $p which dissolves.",FALSE,ch,scroll,0,TO_CHAR);

for (i=1; i<4; i++)
if (scroll->obj_flags.value[i] >= 1)
((*spell_info[scroll->obj_flags.value[i]].spell_pointer)
((byte) scroll->obj_flags.value[0], ch, "", SPELL_TYPE_SCROLL, victim, obj));

if (equipped)
unequip_char(ch, HOLD);

extract_obj(scroll);
}

/* end of code segment - back to post now */

So, I understand the concept of parameters and number values through means of byte, int, float, whatever... but when things like THIS come around.. well, I only found damage numbers but it's something else I truly mean but these two are similar in my opinion:

void spell_shocking_grasp(byte level, struct char_data *ch,
struct char_data *victim, struct obj_data *obj)
{
int dam;
int dam_each[] =
{0, 0,0,0,0,0, 0,41,33,29,27, 25,25,25,25,25, 25,25,25,25,25,
25,25,25,25,25, 25,25,25,25,25};

Those NUNMBERS, there are several and some could be 4, -99, 0 in skills or classes and others have even MORE numbers. My question is how are they read and if it's in like a parameter format for a function with, we'll use (-4, 25) again, what's with that? What would it represent and why is it important to have that specific number? Whether it's to over estimate how many are populated if it's an object or what? I hope this is understandable, my apologize if it's hard to grasp what I'm asking. Thanks for your time though!!!

PS - I didn't make this clear, the point for the first code was to see if you all might agree that my general concept for WeaponSmithing could be turned from that 'recite' code if need be.
Redfox is offline   Reply With Quote