Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Installing new damage types?

Installing new damage types?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Gtr   (38 posts)  Bio
Date Mon 19 Jul 2004 05:59 PM (UTC)
Message
Can anyone start me off on the right path to installing new damage types for use with skills and what not? I'v tried looking at how things currently are and tried adding it based off of what I saw and it didnt work right since then I'v uninstalled my changes, and heh turned here hoping someone could point me in the right direction.





-Thanks
Top

Posted by Buck   USA  (23 posts)  Bio
Date Reply #1 on Tue 20 Jul 2004 09:41 PM (UTC)
Message
First find this in const.c :

char * const attack_table [18] =
{
"hit",
"slice", "stab", "slash", "whip", "claw",
"blast", "pound", "crush", "grep", "bite",
"pierce", "suction", "bolt", "arrow", "dart",
"stone", "pea"


and change it thusly ( I used "shotgun" ):

char * const attack_table [19] =
{
"hit",
"slice", "stab", "slash", "whip", "claw",
"blast", "pound", "crush", "grep", "bite",
"pierce", "suction", "bolt", "arrow", "dart",
"stone", "pea", "shotgun"

Then, a little further down, there's this:

char ** const s_message_table[18] =
{
s_generic_messages, /* hit */
s_blade_messages, /* slice */
s_blade_messages, /* stab */
s_blade_messages, /* slash */
s_blunt_messages, /* whip */
s_blade_messages, /* claw */
s_generic_messages, /* blast */
s_blunt_messages, /* pound */
s_blunt_messages, /* crush */
s_generic_messages, /* grep */
s_blade_messages, /* bite */
s_blade_messages, /* pierce */
s_blunt_messages, /* suction */
s_generic_messages, /* bolt */
s_generic_messages, /* arrow */
s_generic_messages, /* dart */
s_generic_messages, /* stone */
s_generic_messages /* pea */
};

char ** const p_message_table[18] =
{
p_generic_messages, /* hit */
p_blade_messages, /* slice */
p_blade_messages, /* stab */
p_blade_messages, /* slash */
p_blunt_messages, /* whip */
p_blade_messages, /* claw */
p_generic_messages, /* blast */
p_blunt_messages, /* pound */
p_blunt_messages, /* crush */
p_generic_messages, /* grep */
p_blade_messages, /* bite */
p_blade_messages, /* pierce */
p_blunt_messages, /* suction */
p_generic_messages, /* bolt */
p_generic_messages, /* arrow */
p_generic_messages, /* dart */
p_generic_messages, /* stone */
p_generic_messages /* pea */
};


Alter it, checking your commas:

char ** const s_message_table[19] =
{
s_generic_messages, /* hit */
s_blade_messages, /* slice */
s_blade_messages, /* stab */
s_blade_messages, /* slash */
s_blunt_messages, /* whip */
s_blade_messages, /* claw */
s_generic_messages, /* blast */
s_blunt_messages, /* pound */
s_blunt_messages, /* crush */
s_generic_messages, /* grep */
s_blade_messages, /* bite */
s_blade_messages, /* pierce */
s_blunt_messages, /* suction */
s_generic_messages, /* bolt */
s_generic_messages, /* arrow */
s_generic_messages, /* dart */
s_generic_messages, /* stone */
s_generic_messages, /* pea */
s_generic_messages /* shotgun */
};

char ** const p_message_table[19] =
{
p_generic_messages, /* hit */
p_blade_messages, /* slice */
p_blade_messages, /* stab */
p_blade_messages, /* slash */
p_blunt_messages, /* whip */
p_blade_messages, /* claw */
p_generic_messages, /* blast */
p_blunt_messages, /* pound */
p_blunt_messages, /* crush */
p_generic_messages, /* grep */
p_blade_messages, /* bite */
p_blade_messages, /* pierce */
p_blunt_messages, /* suction */
p_generic_messages, /* bolt */
p_generic_messages, /* arrow */
p_generic_messages, /* dart */
p_generic_messages, /* stone */
p_generic_messages, /* pea */
p_generic_messages /* shotgun */
};

Then in mud.h change this:

typedef enum
{
DAM_HIT, DAM_SLICE, DAM_STAB, DAM_SLASH, DAM_WHIP, DAM_CLAW,
DAM_BLAST, DAM_POUND, DAM_CRUSH, DAM_GREP, DAM_BITE, DAM_PIERCE,
DAM_SUCTION, DAM_BOLT, DAM_ARROW, DAM_DART, DAM_STONE, DAM_PEA
} damage_types;

To this:

typedef enum
{
DAM_HIT, DAM_SLICE, DAM_STAB, DAM_SLASH, DAM_WHIP, DAM_CLAW,
DAM_BLAST, DAM_POUND, DAM_CRUSH, DAM_GREP, DAM_BITE, DAM_PIERCE,
DAM_SUCTION, DAM_BOLT, DAM_ARROW, DAM_DART, DAM_STONE, DAM_PEA, DAM_SHOTGUN
} damage_types;

Then further down in mud.h change the 18 to 19 here:

extern char * const attack_table [18];

Find this in fight.c:

default: *gsn_ptr = -1; break;
case DAM_HIT:
case DAM_SUCTION:
case DAM_BITE:
case DAM_BLAST: *gsn_ptr = gsn_pugilism; break;
case DAM_SLASH:
case DAM_SLICE: *gsn_ptr = gsn_long_blades; break;
case DAM_PIERCE:
case DAM_STAB: *gsn_ptr = gsn_short_blades; break;
case DAM_WHIP: *gsn_ptr = gsn_flexible_arms; break;
case DAM_CLAW: *gsn_ptr = gsn_talonous_arms; break;
case DAM_POUND:
case DAM_CRUSH: *gsn_ptr = gsn_bludgeons; break;
case DAM_BOLT:
case DAM_ARROW:
case DAM_DART:
case DAM_STONE:
case DAM_PEA: *gsn_ptr = gsn_missile_weapons; break;


...and add case DAM_SHOTGUN: above the case you wish to emulate, i.e. above case DAM_PEA: to make it a missile weapon. Make clean and recompile. Hope that does it for you. That's all I remember from when I did it, though if anyone notices I noobed anything up, chime in :) Cheers...



-Buck.
tbgamecock@yahoo.com
"I am Homer of Borg. Prepare to be assim... ooooo, Doughnuts!"
Top

Posted by Gtr   (38 posts)  Bio
Date Reply #2 on Wed 21 Jul 2004 03:56 PM (UTC)
Message
Heh thanks..I did pretty much all that my first time around, but when I tried to use the damage in a function of mine it didnt come out right, the function worked with other damage types..just not the one I added, I'll give it another go thou.

Thanks again
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


13,881 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.