Here goes nothing.

This is what I did to add pre-cast wait_states to a stock quickmud.
Yes, there are probably easier and better ways to do it... but. I'm tired and 
wanted to finish NOW.
/*********/
in merc.h
under the act flags
#define PLR_CASTING (bb)

/***********/

near IS_SET
#define IS_CASTING(ch)   (IS_SET((ch)->act, PLR_CASTING))

/**********/

in comm.c: unix_loop (I ignore dos_loop... who runs it on DOS?!?!)

            if (d->character != NULL && d->character->wait > 0)
            {
                --d->character->wait;
                continue;
            }

+            if (d->character != NULL && IS_CASTING(d->character))
+            {
+               do_cast(d->character, d->magic);
+               REMOVE_BIT(d->character->act, PLR_CASTING);
+               continue;
+            }
/**********/
in magic.c
in do_cast:
    OBJ_DATA *obj;
    void *vo;
    int mana;
    int sn;
    int target;

    /*
     * Switched NPC's can cast spells, but others can't.
     */
    if (IS_NPC (ch) && ch->desc == NULL)
        return;

+    strcpy(ch->desc->magic, argument);
    target_name = one_argument (argument, arg1);

/**********/

    if (!IS_NPC (ch) && ch->mana < mana)
    {
        send_to_char ("You don't have enough mana.\n\r", ch);
        return;
    }

+    if (!IS_CASTING(ch))
+    {
+       SET_BIT(ch->act, PLR_CASTING);
+       WAIT_STATE (ch, skill_table[sn].beats);
+       return;
+    }

    if (str_cmp (skill_table[sn].name, "ventriloquate"))
        say_spell (ch, sn);
/**********/

If you feel like giving credit. I'd appreciate it. If you don't. Just put 
credit in the code. If you don't do that... I'll never know the difference.

Mark Roberts... who released a "not-so-snippet"

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Reply via email to