Spellbooks Ideas [by Rasmus Romlev]
Snippet Posted Wednesday, August 12th @ 11:37:13 PM, by George Greer in the Skills dept.
Added May 6, 1997. Click the link below to read it or download it.

From: Rasmus 'Con' Ronlev 
Subject: Spellbooks

Mmm, well, the idea posted by Angus, is possible. It is good in the sense
that it only alocates memory when there is a need for a spell-book object
type.. (You still have a pointer allocation for each object I beleave).
On the other hand why bother with making a special object type structure ?
Use some of the 'spare' OBJ_VAL slots to store the spell-book spell, and
the amount of 'learned' it will add/delete from the char that uses the
spell book...... it's like the hit and damroll stored on WEAPON objects...

GET_OBJ_VAL(spellbookobj, 1)

/* use this for the spellnum
*/
GET_OBJ_VAL(spellbookobj, 2)

/* use this for the learn %
*/

See how it assigns the values in the db.c file when it loads in WEAPON
type objects, and modify the object loading code (as well as OLC if you
have it) to support an extra ITEM_xxxx flag (ITEM_SPELLBOOK), and add a
check for this ITEM into the recite code, as well as the look/examine
code, to detect if it's a spellbook, and you're set..

Think this is a semi-walkthrough (on a general non code basis) of how to
implement a spellbook item (going to do it this way myself some day), as
well as an item you can like HOLD, and if you do it also increases the
learned levels of spells/skills (same idea in assignign values), just
another way of checking how to add/remove the learned values given by the
object...

Guess I'm finnish(ed),
Con.

d.


<< Special Assigns [by Gekke] | Reply | View as text | Flattened | Spells how to? [by Rasdan] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.