Re: Another how do i question

From: Arthur Sheffield (Arthur32865@aol.com)
Date: 03/18/01


brandon wrote:
>How would I go about making it so the only way a player could learn a
particular >spell is from an item.
>IE: Spell book, prayer book, etc.

here is one way to do it:

You will have to define ITEM_SPELLBOOK;

change the following code in look_at_target

from:
   /* Does the argument match an extra desc in the char's inventory? */
  for (obj = ch->carrying; obj && !found; obj = obj->next_content) {
    if (CAN_SEE_OBJ(ch, obj))
     if ((desc = find_exdesc(arg, obj->ex_description)) != NULL) {
    send_to_char(desc, ch);
    found = 1;
      }
   }

to:
   /* Does the argument match an extra desc in the char's inventory? */
  for (obj = ch->carrying; obj && !found; obj = obj->next_content) {
    if (CAN_SEE_OBJ(ch, obj))
+ {
+   if  (GET_OBJ_TYPE(obj) == ITEM_SPELLBOOK)  {
+     (not sure of the exact code here, doing this at work not at home, code
at home,
+      when i get home i can update this tonight if you need me to, but what
you put here is,
+      the part of the code that gives you the spell when you level (i hope
that was clear).
+     then after you put in that part of the code, put in a 'return' to get
out before the ex_description part
+     }

     if ((desc = find_exdesc(arg, obj->ex_description)) != NULL) {
    send_to_char(desc, ch);
    found = 1;
       }
     }
+ }

Note, if you put the min level to get spell stuff here when you level, you
will need to
take it out of the level command.

Disclaimer:  Like i said im doing this at work, not home, so this is
completly untested!
can test tonight when i get home brandon if you would like me to...

Arthur
RM

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST