Re: Dynamic Spec Assignment

From: Sean Butler (sbutler@DEVEAST.COM)
Date: 01/12/98


I wasnt able to get a response on this, is it impossible to do?

I am looking to assign a spec process after the mud is up and running.  For
example, I coded the innkeeper special proc and I want to be able to assign
the proc to ANY mob that the pc picks.  That way, if they want a FIDO to
run thier inn for them, they can.  (That would not please me for realism,
but you get the point.)  So, can anyone point me in the direction to learn
how this is done...
---------------------------------
It is possible to do, you just need to use the mobs RNUM as the index
for the array mob_index[] that is an array of structs called index_data.
mob_index[rnum].func  is a pointer to function containing the special proc.
so an assignment like:

mob_index[rnum].func = fido;

would make the mob referenced by rnum do the fido special proc. ie SPECIAL(fido)

However, two special procs I am not sure about, you would probably need to
add another function pointer to the mob.  But, if you were going to do
that, it might be a better idea to create a linked list of function
pointers:

struct mob_func {
    SPECIAL(*func);
    struct mob_func *next;
}

and then add that to the index_data structure and then change
mobile_activity() to step through the linked list of functions to perform.

If there are any better ideas on how to have multiple functions for a mob,
or if the idea I propose wont work, flame away. :-P

-- Sean Butler


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST