Weapons that cast spells...The Code.

From: Mark Crichton (macricht@indyunix.iupui.edu)
Date: 07/23/95


	YIPPEE!
	Thank to some kind souls out there, I have found my error.  Should
remember to check if someone has a weapon wielded before doing what I wanted
to do.  That has been fixed and BELOW is my code to give weapons spells.

How to do it:

1.)  UUdecode the below patch and apply it against Circle v3.00bpl8.  You 
might need to apply some of the stuff by hand.  Then recompile...
*DANGER*DANGER*DANGER*DANGER*DANGER*DANGER*DANGER*DANGER*DANGER*DANGER*DANGER*
*                THIS PATCH PLAYS AROUND WITH STRUCTS.H                      *
*			AND YOUR RENT FILES!!!        			     *
* YOU WILL *NEED* PURGE YOUR RENT FILES (and I have no idea about the pfiles *
DONT SAY I DIDN'T WARN YOU!!!

2.)  After getting over my shouting...here's how to add a spell to an object.

Hard way:  Use the S parameter just like the A parameter.  E has 3 numeric
parameters.  The first is the spellnum to cast, the second is the "level" of
the spell as used by call_magic, and the 3rd is a percentage.  0 is never cast,
100 is ALWAYS cast.

Easy way:  See hard way above. :)

EX: I currently have obj #12020 (Jupiter's Thunderbolt) casting the spell.  The
line in the 120.obj file for the Tbolt is the following:
S
26 10 100
Which casts a 10th level fireball at my opponent 100% of the time. :)
Also note that the spells are not limited to offensive spells.  You can have a
weapon that sancts your opponent in combat :P. (I think....should though)

If there any questions about the code, just mail me.  Flames to /dev/null.

Mark Crichton


PS.  There might be some bugs, esp. around the "percentage" if in
perform_violence.  The code is (hopefully) simple enough to understand so you
can tranverse it.  Also, I currently have each weapon limited to 3 spells each
for no real reason.  That can be changed in structs.h (MAX_SPELL_AFFECT).

Also, fsprintf DOESN'T crash the mud.  fprintf is used for the log file (seems
like autorun is redirecting stderr or something like that).

--CUT HERE--

begin 644 wpn.w.spell.patch.gz
M'XL(",7^$C`"`W=P;BYW+G-P96QL+G!A=&-H`*U7^U/;.!#^V?DKMO25A_,F
MD,9'AQ0"I1<2CH3I=;B,QW'DQ,2/C"U#,AW^]]N5G!>8`KTS9&Q)NROMI]UO
MI9%M69"/()\/F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