Re: [SMAUG] hmm need help
Re: [SMAUG] hmm need help
A note about this snippet, I'm pretty sure someone could use it to
crash the mud easily, since players have access to the format line of
act, which means they can use variables that don't exist, which might
crash the mud. I'm not sure about all this, since I haven't tested
it, and don't really feel like it since its just a snippet for merc.
To get it to work, make the define do this, its pretty pointless
since you might as well just call act.
#define deathmsg(format,ch,arg1,arg2,type)\
act(AT_BLOOD,(format),(ch),(arg1),(arg2),(type);
Obviously change AT_BLOOD to whatever color you want it to be.
I've tried adding the following snippet to my mud but I cant seem to get it
to work correctly. I get this error all the time.
fight.o: In function `hurt_person':
/home/mud/cs/gabe/cv/src/fight.c:2137: undefined reference to `act_sub'
/home/mud/cs/gabe/cv/src/fight.c:2138: undefined reference to `act_sub'
the area of the snippet I'm having problems with is the:
deathmsg(ch->pcdata->deathblow,ch,NULL,victim,TO_ROOM);
deathmsg(ch->pcdata->deathblow,ch,NULL,victim,TO_CHAR);
here's the snippet I'm trying to add:
This snippet was taken from www.grayarea.com/sneak.htm and MAY NOT be
posted on your web site. It MUST be linked back to the above URL for
download.
- In merc.h add:
- (you probably already have this so check!)
#define deathmsg(format,ch,arg1,arg2,type)\
act_sub((format),(ch),(arg1),(arg2),(type),POS_RESTING)
- Under struct pc_data add:
char * deathblow;
- In act_info.c add:
void set_deathblow( CHAR_DATA *ch, char *deathblow )
{
char buf[MAX_STRING_LENGTH];
if ( IS_NPC(ch) )
{
bug( "Set_deathblow: NPC.", 0 );
return;
}
strcpy( buf, deathblow );
free_string( ch->pcdata->deathblow );
ch->pcdata->deathblow = str_dup( buf );
return;
}
void do_deathblow( CHAR_DATA *ch, char *argument )
{ char deathmsg[MAX_STRING_LENGTH];
if ( IS_NPC(ch) )
return;
if ( argument[0] == '\0' )
{
send_to_char( "Change your deathblow message to what?\n\r", ch );
send_to_char( "Running deathblow with no argument sets deathblow to
none.\n\r",ch);
ch->pcdata->deathblow = NULL;
return;
}
if ( strlen(argument) > 45 )
argument[45] = '\0';
smash_tilde( argument );
set_deathblow( ch, argument );
send_to_char( "Deathblow message has been set to:\n\r", ch );
sprintf(deathmsg,"%s{x\n\r",ch->pcdata->deathblow);
send_to_char(deathmsg,ch);
}
- In fight.c in the damage() function rip out your case POS_DEAD: (all of the
code up
- to and including the first break; after POS_DEAD: and replace it with:
case POS_DEAD:
if(!IS_NPC(ch)) {
if(!ch->pcdata->deathblow) {
switch ( number_bits( 3 ) )
{
default: act("{x{WYou tear the {x{Mheart{x {W out of
$N!{x",ch,NULL,victim,TO_CHAR); break;
case 0: act("{x{WYou smash your weapon through $N's
skull!{x",ch,NULL,victim,TO_CHAR); break;
case 1: act("{x{WYou pull $N's spine out through their
mouth!{x",ch,NULL,victim,TO_CHAR); break;
case 2: act("{x{WYou land your blow directly on $N's
spine!{x",ch,NULL,victim,TO_CHAR); break;
case 4: act("{x{WYou cleave $N in half with one mighty
swing!{x",ch,NULL,victim,TO_CHAR); break;
case 5: act("{x{WYou tear $N's windpipe right out of their
throat!{x",ch,NULL,victim,TO_CHAR); break;
case 6: act("{x{WYou disembowel $N with amazing
skill!{x",ch,NULL,victim,TO_CHAR); break;
} } else
{
deathmsg(ch->pcdata->deathblow,ch,NULL,victim,TO_ROOM);
deathmsg(ch->pcdata->deathblow,ch,NULL,victim,TO_CHAR);
} }
act( "{R$n is DEAD!!{x", victim, 0, 0, TO_ROOM );
send_to_char( "{RYou have been KILLED!!{x\n\r\n\r", victim );
break;
- In interp.c insert this in your commands table:
{ "deathblow", do_deathblow, POS_DEAD, 0, LOG_NORMAL, 1},
- You must also declare it in interp.h DUH
- To make the messages save add this to save.c:
- Under fwrite_char add:
if(ch->pcdata->deathblow > 0)
fprintf( fp, "Dblow %s~\n", ch->pcdata->deathblow);
- Under case 'D': of fread_char() add:
KEY( "Dblow", ch->pcdata->deathblow, fread_string( fp ) );
- In recycle.c add:
- In the free_pcdata() function:
free_string(pcdata->deathblow);
- I put it right after free_string(pcdata->title);
Anyone have any idea's on what I can do to fix this problem? I think act_sub
needs to be defined maybe? and if it does how would I define it?
--
-Rhys