Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
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
Old 08-11-2010, 01:57 AM   #2
Redfox
New Member
 
Join Date: Aug 2010
Posts: 2
Redfox is on a distinguished road
Re: Making a new skill with old code

I found a part of the answer to my own question Sorry I didn't see or think of it before but they're arrays from the other parts of .c or .h files. Still though, I don't quite understand how they're used in MUD coding for objects or damage or most importantly actual actions?
Redfox is offline   Reply With Quote
Old 08-11-2010, 05:23 AM   #3
Kylotan
Member
 
Join Date: Jun 2003
Location: Nottingham, UK
Home MUD: Abattoir (Smaug)
Home MUD: ex-Jellybean (Smaug)
Home MUD: ex-Dark Chambers (Merc)
Posts: 174
Kylotan is on a distinguished road
Send a message via ICQ to Kylotan Send a message via AIM to Kylotan Send a message via MSN to Kylotan Send a message via Yahoo to Kylotan
Re: Making a new skill with old code

You're looking for meaning where there is none.

Those lists of numbers... are just lists of numbers.

What is important is how they are used. The above example is an array called 'dam_each'. If you look further down the function you'll see how the values inside dam_each are accessed (eg. dam_each[10] reads the 11th entry). Typically they form part of some formula.
Kylotan is offline   Reply With Quote
Old 08-11-2010, 04:16 PM   #4
Newworlds
Legend
 
Join Date: Aug 2007
Name: NewWorlds
Home MUD: New Worlds
Posts: 1,425
Newworlds will become famous soon enoughNewworlds will become famous soon enough
Re: Making a new skill with old code

I am purely guessing, but look at other spell or other power functions and see if they all have this array dam_each. I would imagine they do and the numbers inside the array are placed in specific locations for the purpose of showing how much damage is done in specific instances. It could be against fire, ice, on land, on sea, in the air, from a distance, against metal, etc. Who knows. What matters is finding out how these numbers are utilized. Accessing them or modifying them is easy.
Newworlds is offline   Reply With Quote
Old 09-14-2010, 02:10 PM   #5
plamzi
Senior Member
 
Join Date: Nov 2009
Home MUD: bedlam.mudportal.com:9000
Home MUD: www.mudportal.com
Posts: 292
plamzi is on a distinguished road
Smile Re: Making a new skill with old code

find . | xargs grep "dam_each"

Do that in your source code directory and you'll prosper. It's like Google, only better!
plamzi is offline   Reply With Quote
Reply


Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 07:36 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2022