|
Spells how to? [by Rasdan] |
|
|
|
Posted Wednesday, August 12th @ 11:37:18 PM, by George Greer in the Skills dept.
Added Mar 10, 1997. Click the link below to read it or download it.
From: Rasdan
Subject: Spell Help, since it's asked a lot
You can easily code spells for yourself. Adding spells to your mud isn't
that hard to do, just play around with the code in spells.h, magic.c,
spells.c, and spell_parser.c.
Here is some brief info on how to write new spells. I will use stoneskin
as an example.
Open spells.h, go down to the last spell define, declared in the top of
the file.
Right below that one, add:
#define SPELL_STONE_SKIN
##
where ## is the next available spell define.
Close and save the file.
Open magic.c
Go down to mag_affects in magic.c, and below the case SPELL_ARMOR (just
for reference), add:
case SPELL_STONE_SKIN:
af[0].location = APPLY_AC;
af[0].modifier = -30;
af[0].duration = 25;
af[0].bitvector = AFF_STONE_SKIN;
accum_duration = FALSE;
to_vict = "You skin turns to stone!";
to_room = "You watch in fascination as $n's skin turns to stone!";
break;
EXPLANATION:
The above block of code goes within the switch (spellnum) statement.
You can hold up to 3 affects within a spell definition.
If you wish to add another affect, instead of af[0] use af[1] or af[2]
nothing higher than that.
af[0].location = One of the applies as defined in structs.h
af[0].duration = how long the spell lasts.
af[0].modifier = How much the spell affects your stats.
af[0].bitvector = AFF flag the spell sets, if any. If none, leave blank.
*NOTE* The aff bitvector needs to be defined in structs.h, and
the actual affect for the bitvector needs to be defined
in the appropriate file.
ie: AFF_SANCTUARY actual modifications is set in fight.c
Close magic.c, open spell_parser.c
In the huge list of spells names near the top of the file, find the first
"!UNUSED!" and replace it with "stone skin".
This is the name used to practice or cast the spell.
Then, scroll to the bottom of the file, where the rest of the spello()
declares are.
spello(SPELL_XXX, MAX_MANA, MIN_MANA, MANA_CHANGE, MIN_POSITION,
CHAR_BITVECTOR, VIOLENT?, FUNCTION WHERE DECLARED);
Explanation:
SPELL_XXXX
= Define of the spell, as defined in spells.h
MAX_MANA
= Mana cost when player first gets spells.
MIN_MANA
= Lowest mana cost of spell.
MANA_CHANGE
= Change of Mana cost per level.
CHAR_BITVECTOR = See spells.h for a list of valid bitvectors
VIOLET
= True if yes, False if no.
FUNCTION
= one of the main spell functions.
So, a spello for stone skin could be:
spello(SPELL_STONE_SKIN, 50, 25, 3, POS_STANDING,
TAR_CHAR_ROOM | TAR_SELF_ONLY, FALSE, MAG_AFFECTS);
Close spell_parser.c, open constants.c.
Scroll down to const char *spell_wear_off_msg[] =
At the bottom of that list, before the last "!UNUSED!", add:
"Your skin slowly softens as it returns to normal",
Close that file, compile and cross your fingers.
Hope this helps.
James
<< Spellbooks Ideas [by Rasmus Romlev] | Reply | View as text | Threaded | Spell Sphere System [by Christoffer Lundberg] >> |
|
Related Links |
|
|
|
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.
|
|
|
|
|
|
|