first: increment max_skill in merc.h (to add a skill or spell always do
this)

add the spell to your const.c (using the spell_drain function pointer for
the spell_fun part) try copying energy drain or another spell to see what
the exact format is, i'd help more with the const.c part except i've messed
with my const.c file so much its not reconizeable as stock...

when you add it, its going to need a slot(#) the way to add it, is merely
find the next free one out of all the spells in the const.c file (if its
stock i think its in the 523ish range, i dont really remember.) I kno you
need a TAR_ look at the definitions of what kind of TAR_ you want, prolly
OFFENSIVE...

once you do that, then you need to go to magic.h and
DECLARE_SPELL_FUN(spell_drain)

looks like the rest, eh?

now go to magic.c and make a function

void spell_drain( blah, blah, blah, blah, blah, blah ) /*copy those from any
other spell*/
{
       now heres the meat of you spell...
       to do all the messages you do act($n drains $N , ch, NULL, victim,
TO_(blah) )
       to do any damages you use the damage( ) function... really once your
here your
       golden... All you have to do is look at all the other spells to see
the format.
}

Now if your going to use the spell alot in other files, consider making a
gsn_drain or something... i personally always make gsns for my spells, but
im wierd.  to do that, you go to db.c and declare it like the rest of them,
then you go to merc.h and extern it, do you can include merc.h and it will
be included ( unless you have your own gsn.h which some people do...

I think i didnt forget anything... when it doubt, just grep another spell
and look where its used, i didnt do anything but that for the first whatever
of coding muds... course i still suck;)

Lemme know if this helps/is wrong;)

Josh
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, April 17, 2002 4:21 PM
Subject: Spells: A Newbie Question


> Hey everyone, I've been programming for a while in several different
> languages, but am relatively new to C.  I am also just learning how to
code,
> and have a question regarding spells.  I cant seem to find anywhere with a
> decent description of how to add spells, most just say 'then you have to
code
> the effects of the spell itself'.  Im looking to create a spell called
Drain.
>  I want it to deal between 50 and 200 hp of damage, depending on the
caster's
> skill and level.  I want it to send to the victim "<caster>'s drain saps
you
> for <#>."  To the caster, "Your drain saps <victim> for <#>.", and to
> bystanders, "<caster>'s drain saps <victim> for <#>."  I'd like it to be a
> level 5 spell.  If someone could please take the time to show me how to do
> this, and in what files to add what lines, I usually catch on very
quickly.
>
> Thanks in advance,
> Zack
>
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom


Reply via email to