Ok here is my version of something i call poofslay. it allows the
immortals to set
there on slay message. Its realy simple to install. my name is Spifey and
ive been
a coder for about 3 years. There is prolly some other ways you can do
this. even add
more then 1 message if you like. go nuts and add 100 if you want. All i
ask is some
credit on how you like it. hate it. etc.. etc.. im not going to twist your
arm about
it. But ok ill quit rambling most of you prolly arent even reading this
anyway. my mud
addy is crossroads.2y.net 9409 for those of you who want to stop by and
have a look around.
we need RP builders we have olc but no olc experience is required just
knowlege of RP based
room descriptions mobs eq. etc.. ok here comes the code. Dont forget to
add the help file
somewhere. also make poofslay in your interp.c and interp.h if you dont
know how to do this
you realy shouldnt be coding. but ill be glad to help. I think i got all
the act messeges.
please email me if i missed any. leave comments on it. after all
this did take me 15 minutes. :P please send email to
[EMAIL PROTECTED]



fight.c:
find void do_slay and change it into this one.

void do_slay( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *victim;
    char arg[MAX_INPUT_LENGTH];
    char buf[MSL];

    one_argument( argument, arg );
    if ( arg[0] == '\0' )
    {
        send_to_char( "Slay whom?\n\r", ch );
        return;
    }

    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
        send_to_char( "They aren't here.\n\r", ch );
        return;
    }

    if (ch->pcdata->pslay ==NULL)
    {
        send_to_char("You must atleast set one of your slay
arguments!\n\r",ch);
        return;
    }

    if ( ch == victim )
    {
        send_to_char( "Suicide is a mortal sin.\n\r", ch );
        return;
    }

    if (IS_IMMORTAL(victim))
    {
        send_to_char( "Slaying another immortal would be
useless.\n\r",ch);
        return;
    }

    if ( !IS_NPC(victim) && victim->level >= get_trust(ch) )
    {
        send_to_char( "You failed.\n\r", ch );
        return;
    }

        if (ch->pcdata->pslay ||
        ch->pcdata->pslay2 ||
        ch->pcdata->pslay3 == NULL)
        {
             sprintf(buf, "%s\n\r", ch->pcdata->pslay);
             act(buf, ch, NULL, victim, TO_CHAR );
             sprintf(buf, "%s\n\r", ch->pcdata->pslay2);
             act(buf, ch, NULL, victim, TO_VICT );
             sprintf(buf, "%s\n\r", ch->pcdata->pslay3);
             act(buf, ch, NULL, victim, TO_NOTVICT );
         raw_kill( victim);
        return;
        }
        else
        act( "{1You slay $M in cold blood!{x",  ch, NULL, victim, TO_CHAR
);
        act( "{1$n slays you in cold blood!{x", ch, NULL, victim, TO_VICT
);
        act( "{1$n slays $N in cold blood!{x",  ch, NULL, victim,
TO_NOTVICT );
        raw_kill( victim );
        return;
}

next: add these commands

void do_pslay( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];

    if ( !IS_NPC(ch) )
    {
        smash_tilde( argument );

        if (argument[0] == '\0')
        {
            sprintf(buf,"Your poofslay To You is:
%s\n\r",ch->pcdata->pslay);
            send_to_char(buf,ch);
            return;
        }

        free_string( ch->pcdata->pslay );
        ch->pcdata->pslay = str_dup( argument );

        sprintf(buf,"Your poofslay To Them is now:
%s\n\r",ch->pcdata->pslay);
        send_to_char(buf,ch);
    }
    return;
}

void do_pslay2( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];

    if ( !IS_NPC(ch) )
    {
        smash_tilde( argument );
        if (argument[0] == '\0')
        {
            sprintf(buf,"Your poofslay To the one your slaying is:
%s\n\r",ch->pcdata->pslay2);
            send_to_char(buf,ch);
            return;
        }

        free_string( ch->pcdata->pslay2 );
        ch->pcdata->pslay2 = str_dup( argument );

        sprintf(buf,"Your poofslay to the one your slaying is:
%s\n\r",ch->pcdata->pslay2);
        send_to_char(buf,ch);
    }
    return;
}

void do_pslay3( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];

    if ( !IS_NPC(ch) )
    {
        smash_tilde( argument );

        if (argument[0] == '\0')
        {
            sprintf(buf,"Your poofslay to people in the room is:
%s\n\r",ch->pcdata->pslay3);
            send_to_char(buf,ch);
            return;
        }

        free_string( ch->pcdata->pslay3 );
        ch->pcdata->pslay3 = str_dup( argument );

        sprintf(buf,"Your poofslay to people in the room is now:
%s\n\r",ch->pcdata->pslay3);
        send_to_char(buf,ch);
    }
    return;
}

/*Replaces 3 commands for for lack of string management*/
void do_poofslay( CHAR_DATA *ch,char *argument)
{
    char arg[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];

    argument = one_argument(argument,arg);

    if ( arg[0] == '\0' )
    {
        sprintf(buf,"Your poofslay To You is: %s\n\r",ch->pcdata->pslay);
            send_to_char(buf,ch);
        sprintf(buf,"Your poofslay To The person your slaying:
%s\n\r",ch->pcdata->pslay2);
            send_to_char(buf,ch);
        sprintf(buf,"Your poofslay To people in the room:
%s\n\r",ch->pcdata->pslay3);
            send_to_char(buf,ch);
        return;
    }
    if (!str_prefix(arg,"1"))
    {
        do_function(ch, &do_pslay, argument);
        return;
    }
    if (!str_prefix(arg,"2"))
    {
        do_function(ch, &do_pslay2, argument);
        return;
    }

    if (!str_prefix(arg,"3"))
    {
        do_function(ch, &do_pslay3, argument);
        return;
    }
            do_function(ch, &do_poofslay, "");
}

next: open up merc.h and find pc_data struct
and add somewhere in that mess:

    char *              pslay;
    char *              pslay2;
    char *              pslay3;

next: open up save.c and find void fwrite_char( CHAR_DATA *ch, FILE *fp )
then just below fprintf( fp, "Wimp  %d\n",      ch->wimpy       ); add:

                fprintf( fp, "Pslay %s~\n",     ch->pcdata->pslay);
                fprintf( fp, "Pslay2 %s~\n",    ch->pcdata->pslay2);
                fprintf( fp, "Pslay3 %s~\n",    ch->pcdata->pslay3);

next: find void fread_char( CHAR_DATA *ch, FILE *fp )
make sure you put it in its proper place case 'S' if not it WONT WORK.
find it then add:
            KEY( "Pslay",        ch->pcdata->pslay,    fread_string( fp )
);
            KEY( "Pslay2",        ch->pcdata->pslay2,    fread_string( fp
) );
            KEY( "Pslay3",        ch->pcdata->pslay3,    fread_string( fp
) );

next: in rom.are or help.are add:

Syntax: poofslay 1 <message>
        poofslay 2 <message>
        poofslay 3 <message>

act poofslay
The _msg strings are parsed through the "act" function,
    instead of "send_to_char", so the following macros may be used:


    $t  Result is the 'arg1' argument interpreted as a string.

    $T  Result is the 'arg2' argument interpreted as a string.

    $n  Result is the name of 'ch'.  If 'ch' is not visible to the target
        character, result is the string 'someone'.

    $N  Result is the name of 'arg2' (considered as a victim).  If 'arg2'
        is not visible to the target character, result is the string
        'someone'.

    $e  Result is 'he', 'she', or 'it', depending on the sex of 'ch'.
    $E  Result is 'he', 'she', or 'it', depending on the sex of 'arg2'
        (considered as a victim).

    $m  Result is 'him', 'her', or 'it', depending on the sex of 'ch'.
    $M  Result is 'him', 'her', or 'it', depending on the sex of 'arg2'
        (considered as a victim).

    $s  Result is 'his', 'her', or 'its', depending on the sex of 'ch'.
    $S  Result is 'his', 'her', or 'its', depending on the sex of 'arg2'
        (considered as a victim).

    $p  Result is the short description of 'arg1' (considered as an
        object).
        If 'arg1' is invisible to the target character, result is the
        string 'something'.

    $P  Result is the short description of 'arg2' (considered as an
        object). If 'arg2' is invisible to the target character, result is
the
        string 'something'.

    $d  Result is the first word in 'arg2', considered as a string.  If
        'arg2' is NULL, result is the string 'door'.  This is meant for
        extracting the name from a door's keyword list, but may be used in
        general for other keyword lists.

Thats all there is too it. And dont forget please do email me.
[EMAIL PROTECTED]

sorry for the runlines after all it is pine :P


Reply via email to